+ Reply to Thread
Results 1 to 11 of 11
  1. #1
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    2,914

    Default Nextion Touchscreen LCD User Interface

    Recently I tried the Nextion 7" and 3.2" touch screen LCDs.

    They have a simple, not well documented, IDE that is hard to learn because you rely on YouTube tutorial videos of other users.

    The LCDs have internal controller that does good job on taking the load off the MCU and almost work on its own.

    I 'll post what I have done without any PIC connected yet.

    I am very impressed of these relatively cheap devices that make good user interface without much load on the controller chip, without real buttons and having good graphics like bars, gauges numeric displays or impressive backgounds.

    I need more info on how to setup the communication or the settings of the LCD since I could not find a pdf Manual yet.

    Spent days to find out that the if (.....) command should not have a space after the if and had to rely on my observation that every one did not put a space there.

    Anyway, is a very interesting interface to PIC's

    Ioannis

  2. #2

    Default Re: Nextion Touchscreen LCD User Interface

    I had heard that the downside of these modules was the price, so I was going to scoff at your use of "relatively cheap" but when I looked at their site I see that the cheapest module 240x320 is only $16.

    Anybody know the difference between basic and enhanced models?
    George

  3. #3
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    2,914

    Default Re: Nextion Touchscreen LCD User Interface

    I think they are the cheapest smart LCD with touch at the moment.

    Enhanced are faster (in screen fill with new image), more memory and with RTC among few others.

    One 7" enhanced has also Capacitive touch option that gives more clear image and better touch feeling. But more expensive.

    Ioannis
    Last edited by Ioannis; - 18th June 2019 at 14:26.

  4. #4
    Join Date
    Apr 2014
    Location
    Northeast
    Posts
    308

    Default Re: Nextion Touchscreen LCD User Interface

    The manual lists all of the serial commands & error codes. It specifies when to use spaces. If not mentioned, use no space.
    Code:
    t1.txt="Hello World"
    When you want to send that through UART, it looks like:
    Code:
    "t1.txt=", $22, "Hello World", $22, $FF, $FF, $FF
    The ASCii value for the double quote (") is $22. Commands sent to the Nextion need to be terminated with 3 bytes of $FF.
    I don't need the world to know my name, but I want to live a life so all my great-grandchildren proudly remember me.

  5. #5
    Join Date
    Apr 2014
    Location
    Northeast
    Posts
    308

    Default Re: Nextion Touchscreen LCD User Interface

    Furthermore, numeric values must be transmitted in ASCii as well:
    Code:
    "n2.val=", $22, "123", $22, $FF, $FF, $FF
    where you're not transmitting a single byte value of 123, you're sending $31, $32, $33; the ASCii representation of the characters "1", "2", & "3".

    If you want to read an ADC-8 value & send it to the Nextion, first do your ADCIN and get a value. Next, convert it to ASCii. You will need a Variable for the ADC value plus an Array for the ASCii converted equivalent:
    Code:
    AdcVal VAR BYTE
    AdcVal_A VAR BYTE[3]
    
    ADCIN 2, AdcVal
    ARRAYWRITE AdcVal_A, [#AdcVal]
    SEROUT 0,N9600,["n2.val=", $22, AdcVal_A, $22, $FF, $FF, $FF]
    I don't need the world to know my name, but I want to live a life so all my great-grandchildren proudly remember me.

  6. #6
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    2,914

    Default Re: Nextion Touchscreen LCD User Interface

    It is good to know that we have an experienced user of Nextion here!

    Thanks for replying.

    Ioannis

  7. #7
    Join Date
    Apr 2014
    Location
    Northeast
    Posts
    308

    Default Re: Nextion Touchscreen LCD User Interface

    I actually wrote an article for Nuts and Volts on using the Nextion with the PIC using PBP.

    Another thought, when you look at the User's Guide in the section that covers error codes (near the end of the Manual), there are several gaps in the values. I was able to incorporate my own "command codes" by locating them in the gaps; specifically: $06 >> $10, $13 >> $19, $21 >> $22, $25 >> $64, $72 >> $85, and $8A >> FC.
    I don't need the world to know my name, but I want to live a life so all my great-grandchildren proudly remember me.

  8. #8
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    2,914

    Default Re: Nextion Touchscreen LCD User Interface

    Which issue was that?

    Your own "command codes", what are you using them for?

    Ioannis
    Last edited by Ioannis; - 19th June 2019 at 14:41. Reason: typo

  9. #9
    Join Date
    Sep 2009
    Posts
    774

    Default Re: Nextion Touchscreen LCD User Interface

    Now you get me interested in this display...
    I installed editor, and I got very nice surprise. You can use PIC with simulator/debugger.
    Second, I think that this code
    Code:
    AdcVal VAR BYTE
    AdcVal_A VAR BYTE[3]
    
    ADCIN 2, AdcVal
    ARRAYWRITE AdcVal_A, [#AdcVal]
    SEROUT 0,N9600,["n2.val=", $22, AdcVal_A, $22, $FF, $FF, $FF]
    won't work properly. As far as I know in serout it missing STR in front AdcVal_A.
    Also why not use it like this
    Code:
    AdcVal VAR BYTE
    ADCIN 2, AdcVal 
    SEROUT 0,N9600,["n2.val=", $22, #AdcVal, $22, $FF, $FF, $FF]

  10. #10

    Default Re: Nextion Touchscreen LCD User Interface

    I found links to the articles mentioned above in post #3 of this https://www.microchip.com/forums/m1076503.aspx thread
    George

  11. #11
    Join Date
    Apr 2014
    Location
    Northeast
    Posts
    308

    Default Re: Nextion Touchscreen LCD User Interface

    It was supposed to be the current Nuts & Volts, but to my surprise, my article wasn't there. I don't use the SEROUT command, so was just going from the book. As for creating your own "command codes", $06 could be for your Pot1 value, $07 could be a button was pushed, $08 could be a "RESET" function...whatever your needs are. Due to the 8-bit UART buffer size (1 byte) I try to keep packets at 2 bytes when possible.
    I don't need the world to know my name, but I want to live a life so all my great-grandchildren proudly remember me.

Similar Threads

  1. Replies: 6
    Last Post: - 17th May 2019, 19:22
  2. Nextion LCDs... How to comunicate ???
    By WMakoto in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 26th November 2017, 08:53
  3. New user frustration (16F688 + LCD)
    By wcpesp in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 3rd February 2013, 16:52
  4. Graphical user interface
    By rocky79 in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 15th October 2005, 12:25
  5. User Configuration Interface in PBP
    By Radiance in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 7th February 2004, 08:00

Members who have read this thread : 20

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts