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.
Hi there Keil forums, I have a question about how my LPC 1114 responds to data over a Uart connection.
This is my UART interrupt code:
/* UART Data Received Interrupt */ void UART_IRQHandler(void) { static NetworkLayerState networkState = Network_Idle; unsigned int interruptId = LPC_UART->IIR; while((interruptId & 1) == 0) { switch((interruptId >> 1) & 0x07) { case 0x02: //Receive Data Available case 0x06: //Character time-out indicator (buffer flush) networkState = NetworkStateMachine(LPC_UART->RBR & 0xFF, networkState); break; case 0x03: //Receive Line Status interrupt break; //Not handling frame errors } interruptId = LPC_UART->IIR; } }
My computer and mcu are connected via a usb to uart cable. I want to know what kind of data I need to send to my mcu in order to trigger this interrupt. For example if I want to send the integer "1" to my mcu how would I do that and then I can store that integer value in a variable within the firmware of the MCU. My GUI is done in C# and it is what I use to communicate with the mcu.
Basically identically the same question Anthony Serra asked: http://www.keil.com/forum/59814/
You want a serial port to receive "1"?
Don't you then think the most logical thing to send would be "1"? The UART doesn't do anything magic. You send three characters '1', '2', '3' to it and it will receive '1', '2', '3' assuming the data was sent with the correct baudrate, number of data bits etc.
And as already discussed earlier - you can use a terminal program instead of that GUI and just send any characters you like. The UART will then receive exactly the same characters.