This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

serial IO interrupt

I am having a problem with getting a serial port interrupt. The timer 1 & serial port interrupts are being set to the high priority level. Timer1 is being used to create the 9600 baud for my serial IO. I can transmit out by writing to the SBUF register and clearing TI outside of the Interrupt Service Routine(ISR). The ISR vector is:
interrupt [0x23] void RITI_int (void)
{
P2.0=0;
P2.0=1;
EA=0;
if (TI != 0)
TI=0; //clear transmit interrupt bit
if (RI != 0)
{
// read in the byte & put the data in the buffer.
incoming_msg_buffer[incoming_hdr_ptr++] = SBUF;

if (incoming_hdr_ptr >= RXBUFFER_SIZE)
incoming_hdr_ptr = 0;
rx_empty=FALSE;
// renable rx interrupt
RI = 0;
}
EA=1;
}.

I believe I am setting the sfrs correctly they are as follows:
TMOD= 0x20; //8bit auto-reload timer1
TH1=0xfd; //value for 9600 baud
TCON=0x40; //timer1 on
SCON=0x40; //mode1 8bit uart,reciever enabled
IE=0x98; //enable serial port interrupts, timer 1 interrupt
SPE=0; //disable SPI interface
P1=0xF0; //configure P1 lower nibble as digital inputs for key row read
REN=1; //set reciever enable
IP=0x18 // set timer1 & uart interrupts to high priority
WDE=0; //disable watchdog-for now

As I understand the TI is set by hardware on the stop bit when a byte is written to SBUF. RI is set when the stop bit is recieved into SBUF(separate from tx SBUF).
When the ISR starts EA is set low, disableing all interrupts, and set back high at the end.
In the ISR I am toggling a port pin and montoring with a scope on the target. It appears that the ISR is never initiated although I can transmit & recieving data outside of the ISR. Is there anything that doesn't look right?
Thanks,

Parents Reply Children
No data