Hello, I am using the uart in the 5402. I would like to have a program (in C code if possible) that triggers an interrupt when it has received a data. Could you help? I have connected 2 with 3, 3 with 2 and 5 with 5. Does I need to use any more connections? I have used this program but my isr does not execute. Could you provide a program for my purpose? UartBaud baud= UART_BAUD_9600; //set 1 stop bit parity = UART_EVEN_PARITY; //enable even parity fifoControl = UART_FIFO_ENABLE; //enable FIFO control loopEnable = UART_LOOPBACK; UartWordLen wlen=UART_WORD8 UartStopBits stopBits=UART_STOP1; UartFifoControl fifoControl=UART_FIFO_ENABLE; UartLoop loopEnable = UART_NOLOOPBACK; uart_init() uart_reset(); uart_setup(UartBaud baud, UartWordLen wlen, UartStopBits stopBits, UartParity parity, UartFifoControl fifoControl, UartLoop loopenable); port4&=0xffef; /*associate int1 with uart*/ if( uart_interrupt_control(uart_rint, True) == OK ) {printf( UART interrupt enabled\n"); } if( uart_interrupt_hook(uartIsr) == OK ) {printf( UART interrupt hook created\n\n ); } while(1)/*waiting for interrupts*/ { } void uartIsr(void) { printf( ***** Interrupt occurred ***** \n); return; } I can see in the screen the two first printf but I do not see the printf of the Isr. Yours faithfully, Roberto Espinosa Espeleologic Devices. --------------------------------- Antivirus Filtros antispam 6 MB gratis Todav no tienes un correo inteligente? |
interrupts of uart
Started by ●November 15, 2003