Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

NEXTION - PIC16F877A

Jtomas

New Member
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.
 
Thanks Dogflu66,
I entered the function and it worked, I left the UART initialization at 1000ms. because I had already tried to modify it without obtaining good results.

Thank you very much.
 
Hello,
Do you have a solution for this problem? I would not be interested in creating a function to represent the messages sent to the Nextion Screen, I only have a String variable declared.
Thanks.
 

Attachments

  • Captura de pantalla 2024-10-12 010823.png
    Captura de pantalla 2024-10-12 010823.png
    10.6 KB · Views: 20
  • LOOP_CAT_v1_11102024.bas
    7.5 KB · Views: 18
Too many strings... Ask yourself if you need all the strings.

put strings into CODE space and pull them one by one when you need them.

read the code byte by byte and fill strings when needed... microcontrollers are never really ram abundant.. compromises are needed.

DogFlu66 I can't seem to see a way of storing constants.. Come of Vlad using code space would be an ideal instead of using up data space
 
I don't know what you mean, I have compiled the program you left and it is both in RAM and in flash under 40% in use and it doesn't give me any error. I recommend that you update the IDE because the strings have been greatly improved. Variables can be saved in flash in several ways, the simplest is to declare them with Const.

'TxT
Const Tex1 = "BANDA..."
Const Tex2 = "t2.txt="
Const Tex3 = "POSICIONANT..."
Const Tex4 = "ÿÿÿ"

'Motor position at end of stroke

'ms_Nextion
value = Qt + "" + Qt
value = Qt + Tex3 + Qt
UART_Write Tex2, value, Tex4
WaitMs 200
 

Attachments

  • v968.jpg
    v968.jpg
    77.6 KB · Views: 18
Hello,

Due to insufficient memory on the PIC16F877A I have switched to the PIC18F4520 and the programmer I used until now, the K150, gives me an error. I have been googling and if I am not mistaken it does not support this type of PIC, although the software recognises them but gives an error when recording. Is there a solution to this? Or should I consider purchasing a programmer for this type of PIC? If so, see if you can advise me.

I am attaching a screenshot of the error.

Thanks.
 

Attachments

  • Captura de pantalla 2024-10-15 232251.png
    Captura de pantalla 2024-10-15 232251.png
    79.4 KB · Views: 11
Do you have enough money for an XGecu TL866II ? I find this cheap programmer one of the best.. It can do Soooo many devices, You can get them for as little as £30..

As for the K150.. Seeing as the pic18F2520 is on the list just select that.. Its the same chip.
The error you see is an EEprom error.. Can you dissable the writing to eeprom?
 
Hi, I have found the list of PICs that the K150 supports, but the list of PICF18XXX does not appear, I do not understand why the K150 software has it as selectable. I have disabled Eprom writing and it does not work. Well, thanks for the answer. Regards.
 
The K150 is a pic16f628.. there may be a firmware update..

 
Hello,
Well I have already managed to program the PIC18F4520 with the PICKIT3, I decided on this PIC because its pins correspond to the PIC I was using, the PIC16F877A, my surprise was that the UART does not work with my NEXTION screen, in the simulation in PIC SIMULATOR IDE the UART works fine. I have not modified delays, I do not know if I have to have any previous configuration with this PIC18F4520, since it is the first time I use this PIC, I have carried out code tests to verify that it is recorded correctly with the PICKIT3, but the UART has not been possible. I attach the files. Let's see if someone with more knowledge can help me.
Greetings.
 

Attachments

  • LOOP_CAT_v1_15102024_PIC18F4520.asm
    95.2 KB · Views: 3
  • LOOP_CAT_v1_15102024_PIC18F4520.bas
    9.7 KB · Views: 3
  • LOOP_CAT_v1_15102024_PIC18F4520.hex
    28.5 KB · Views: 2
Well, a few days ago I received a classic training card, the HL-K18, and it has the Pic18F4520. I have downloaded a program with a serial buffer to test the RS232 and it works perfectly.
 
I have used it with an external 10Mhz x 4PLL = 40Mhz crystal and apparently the program you left works.

#define CONFIG1L = 0x00
#define CONFIG1H = 0x06
#define CONFIG2L = 0x1E
#define CONFIG2H = 0x1E
#define CONFIG3L = 0x00
#define CONFIG3H = 0x83
#define CONFIG4L = 0x80
#define CONFIG4H = 0x00
#define CONFIG5L = 0x0F
#define CONFIG5H = 0xC0
#define CONFIG6L = 0x0F
#define CONFIG6H = 0xE0
#define CONFIG7L = 0x0F
#define CONFIG7H = 0x40


' LOOP-CAT ver4.0 - jaume tomàs 2024
' PIC18F4520
' PANTALLA NEXTION 028
AllDigital
Define SINGLE_DECIMAL_PLACES = 2
'Define SIMULATION_WAITMS_VALUE = 10 'Definim temps per simulació
Define CLOCK_FREQUENCY = 40
'Define STRING_MAX_LENGTH = 16
 
Back
Top