Hello everyone,
I'm glad I found this site, I would appreciate if someone has made a connection between a Nextion screen and a PIC, using PIC SIMULATOR IDE, I'm stuck and I'm not able to capture the codes of the buttons that I've entered on the NEXTION screen from the PIC. I'm able to send data from the PIC to the Nextion but not the other way around. I'd appreciate some help.
Thank you very much.
Its really the ONLY way when using the UART.. Its not hard to set up an interrupt to fill a buffer.
In my setup I normally read ASCII.. So I would send 1,XX,XX,XX,CRLF where XX is my data in text.
Only when the LF is received I sort out the Data back into integers.
That way I don't have to worry about missing any data.
Code:
set interrupt to receive 1 byte continuously
set the index to 0
set sync run to 1
interrupt
if LF is received traverse the data to get the data out.
if sync run = 1 set sync run to 0 then exit
Fill buffer byte by byte
clear the buffer set the index to 0.
clear
set data received flag
all done
Its really the ONLY way when using the UART.. Its not hard to set up an interrupt to fill a buffer.
In my setup I normally read ASCII.. So I would send 1,XX,XX,XX,CRLF where XX is my data in text.
Only when the LF is received I sort out the Data back into integers.
That way I don't have to worry about missing any data.
Hello,
I need to create a UART interrupt on a PIC18F4550. I need to exit a loop when I receive data via the serial port and I haven't used any interrupts in my small projects. I use the PIC SIMULATOR IDE. Can you explain to me how to configure the registers? I attach the code. Thanks
I'm sorry but I can't insert a uart+interrupts code in the example code you left, this is due to the lack of formatting of the text (text indentation) and the use of "goto" which hasn't been used in programming for more than 30 years. Due to lack of time I have adapted an old code to your needs. To see which registers are used you only have to consult the attached library. Anyway, if you have problems later I will review the code I have uploaded and remove all the fluff to leave it at what is strictly necessary.
Note: I forgot to comment on the code it does is to receive a key press from a serial console and forward it to the same, that is, the well-known hardware key echo.