We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello,
I'm using LPC 3250 Developer's Kit. I want to study the UART 5 with the TX interrupt enabled. Here is the piece of c code compiled using RVDS and debugged using DSTREAM.
The program is transmitting the characters to hyper terminal but I was expecting the character 'I' to be transmitted when it enters the IRQ ISR. But it didn't.
Need your assistance to generate interrupt in IRQ mode for UART 5 Transmission.
Thank You S GR
#include "lpc32xx_uart.h" #include "lpc32xx_timer.h" #include "lpc32xx_chip.h" /**************************************************************************************** *Function :send_data *Inputs :string *Output :none *Purpose :To print the string on serial port ****************************************************************************************/ void send_data(unsigned char ch) { UartReg.dll_fifo=ch; while(!(UartReg.lsr & 0x20)); } /**************************************************************************************** *Function :send_data *Inputs :string *Output :none *Purpose :To print the string on serial port ****************************************************************************************/ void send_string(volatile unsigned char *str) { while(*str != '\0') { send_data(*str); str++; } } /**************************************************************************************** *Function :receive_data *Inputs :string *Output :none *Purpose :To print the string on serial port ****************************************************************************************/ unsigned char receive_data(void) { unsigned char ch; while(!(UartReg.lsr & 0x01)); ch=UartReg.dll_fifo; return(ch); } /**************************************************************************************** *Function :uart5_MICInit *Inputs : *Output : *Purpose : ****************************************************************************************/ void uart5_MICInit(void) { UartReg.dlm_ier = UART_IER_THRE; // Enable UART Tx Interrupt MIC_APR |= (1<<9); // Activation Polarity (Active High for UART 5) MIC_ATR &= ~(1<<9); // Activation Type (Level 0) MIC_ITR &= ~(1<<9); // Interrupt Type (IRQ = 0) MIC_ER |= (1<<9); // Enable register for UART 5 } int main(void) { uart5_MICInit(); send_string((unsigned char *)"UART5 LPC3250 \n\r"); while(1) { ch = receive_data(); send_data(ch); } return 1; } __irq void IRQ_Handler(void) { send_data('I'); // for uart5 return; }
Drew Kneel
In the function uart5_MICInit() I'm trying to enable the UART's Tx interrupt and MIC registers for UART5. I'm expecting the character I to be transmitted to hyper terminal when Interrupt occurs.
Thx S GR