Ninacs Gergo
New Member
Hello
I am using an LM3S9B92 microcontroller and i want to connect it with a TSOP31238 IR receiver to do something when i press some buttons on the remote control.
I have been reading the documentation for this mC for hours now and I can't read the signal sent by the receiver.
The output pin of the IR receiver is connected to PA0 pin on the mC
GND of the receiver is connected to the GND pin on the mC
VCC of the receiver is connected to a 5V pin on the mC
I tried this code but it doesn't work
#define TARGET_IS_TEMPEST_RC1
#include "inc/lm3s9b92.h"
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "driverlib/debug.h"
#include "driverlib/gpio.h"
#include "driverlib/rom.h"
#include "driverlib/sysctl.h"
#include "utils/uartstdio.h"
#define RX_BUFFER_SIZE 16
int
main(void)
{
volatile unsigned long signal;
//
// Set the clocking to run directly from the crystal.
//
ROM_SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |
SYSCTL_XTAL_16MHZ);
//
// Initialize the UART.
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
GPIOPinConfigure(GPIO_PA0_U0RX);
GPIOPinConfigure(GPIO_PA1_U0TX);
ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
UARTStdioInit(0);
UARTprintf("Finished initializing!\n");
while(1)
{
UARTprintf("Value: %x\n",ROM_UARTCharGet(UART0_BASE));/*
if (ROM_UARTCharsAvail(UART0_BASE))
{
UARTprintf("There are chars in the FIFO!\n");
UARTprintf("The value read is:%x\n", ROM_UARTCharGetNonBlocking(UART0_BASE));
}
else
{
UARTprintf("There are no chars in the FIFO!\n");
}
}
}
Can someone tell me what am I doing wrong? or How to properly read the signal sent by the IR receiver?
Regards,
Gergo
I am using an LM3S9B92 microcontroller and i want to connect it with a TSOP31238 IR receiver to do something when i press some buttons on the remote control.
I have been reading the documentation for this mC for hours now and I can't read the signal sent by the receiver.
The output pin of the IR receiver is connected to PA0 pin on the mC
GND of the receiver is connected to the GND pin on the mC
VCC of the receiver is connected to a 5V pin on the mC
I tried this code but it doesn't work
#define TARGET_IS_TEMPEST_RC1
#include "inc/lm3s9b92.h"
#include "inc/hw_memmap.h"
#include "inc/hw_types.h"
#include "driverlib/debug.h"
#include "driverlib/gpio.h"
#include "driverlib/rom.h"
#include "driverlib/sysctl.h"
#include "utils/uartstdio.h"
#define RX_BUFFER_SIZE 16
int
main(void)
{
volatile unsigned long signal;
//
// Set the clocking to run directly from the crystal.
//
ROM_SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |
SYSCTL_XTAL_16MHZ);
//
// Initialize the UART.
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
GPIOPinConfigure(GPIO_PA0_U0RX);
GPIOPinConfigure(GPIO_PA1_U0TX);
ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
UARTStdioInit(0);
UARTprintf("Finished initializing!\n");
while(1)
{
UARTprintf("Value: %x\n",ROM_UARTCharGet(UART0_BASE));/*
if (ROM_UARTCharsAvail(UART0_BASE))
{
UARTprintf("There are chars in the FIFO!\n");
UARTprintf("The value read is:%x\n", ROM_UARTCharGetNonBlocking(UART0_BASE));
}
else
{
UARTprintf("There are no chars in the FIFO!\n");
}
}
}
Can someone tell me what am I doing wrong? or How to properly read the signal sent by the IR receiver?
Regards,
Gergo