Home/Support/Support Forum/How to use serial Interrupt
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

How to use serial Interrupt

0 votes
Hello everybody.
I need to use the serial port directly, using my own code and receive data by interrupt process.
I wrote the next code but it does not work.
I can see the incoming data and the UART status register change but the interrupt does not work.

/*********************************
This is the Interrupt service Routine
**********************************/
int ISR_A5_RX (void *isrParameter)
{
short data;
data=serial->data_reg;

serial->status_a|=0x80000200;

return 0;
}

void init_serial(void)
{
serial= MERCURY_REGS_1;
serial->ctrl_a=0x0B000A00;//0x3B000A00; 8 bit 1stp parity Odd
serial->bit_rate_reg=0xC014017F;//x16 a 2400bps (FCLK=14.745.600)
serial->ctrl_b=0x04000000;
serial->ctrl_a|=0x80000200;//Starts UART

}
/************************************
MAIN
*************************************/
void applicationStart (void)

{
int num,i;
naIsrInstall(SER2RX_INTERRUPT, ISR_A5_RX, NULL);
init_serial();
naInterruptEnable(SER2RX_INTERRUPT);
tx_interrupt_control(TX_INT_ENABLE);
while(1)
{
num=0;
for(i=0;i<200;i++)
num++;
}
tx_thread_suspend(tx_thread_identify());
}

Any suggestions would be appreciated.
asked Jan 22, 2010 in NET+OS by Alvaro_Meneses New to the Community (2 points)
recategorized Dec 3, 2013 by tuxembb

Please log in or register to answer this question.

2 Answers

0 votes
I`m sorry but the information about the interrupt ID it is not clear, I use the SER1RX_INTERRUPT and it worked.
answered Jan 22, 2010 by Alvaro_Meneses New to the Community (2 points)
0 votes
aps, remember to disable the command line interface, It uses the PORTB (SER1).
answered Jan 22, 2010 by Alvaro_Meneses New to the Community (2 points)
...