Menu

Nexion Displays

Anobium
2018-02-18
2020-03-07
<< < 1 2 3 4 > >> (Page 2 of 4)
  • stan cartwright

    stan cartwright - 2018-03-18

    I spent an hour trying to see how out the box nextion can be used with microcontroller and no wiser than when I used with picaxe. Do I program a blank project then flash sdcard and put in nextion and power? I know it's wrong to ask nextion questions here but if others get one then same problems as me.
    I can't find a way to get out the installed demo and make a blank display that can be prorammed with serprint commands and data. The last nextion I had was the same and I erased the demo but forgot how..and never got it working.

     
  • stan cartwright

    stan cartwright - 2018-03-18

    Commands like GLCDPrint_Nexion will be in next release.
    Out the box the display has been programmed with the demo.
    I think I download a blank project from the nextion editor then load it to sd card with say win32 disk imager then insert sd card in display an power on and it programs the device.
    The use the device with microcontroller when the device has already been programmed is not easy to find on google.
    This is my second nextion and both came programmed with the same demo.

     
    • Anobium

      Anobium - 2018-03-18

      Just start. with the. Help. You do not need Win32 disk imager. Just read the Help from the Nextion Editor. This is really easy to use.

       
  • stan cartwright

    stan cartwright - 2018-03-18

    I don't think it's easy to use. Did your nextion have a demo running when powered?
    How to make it a blank display on power on and ready to accept hserprint commands which do nothing in demo mode. You got to reprogram the device some way. sd card is one method, think can be serial to.

     

    Last edit: stan cartwright 2018-03-18
  • stan cartwright

    stan cartwright - 2018-03-20

    I tried using a usb to serial converter with the nextion and the ilead gui and it works.
    TX to TX. RX to RX
    On arduino it's tx to rx and rx to tx.
    I tried this code and cls colour works but not line or print. So some joy.
    I programmed it with just screen 0 and a font .zi file.
    Strange if I flash the uno with it connected to the display, I get stk errors but if I flash the uno with the display not connected it flashes ok. I connect the display and the screen changes colour.

    #chip mega328p, 16
    #option Explicit
    #define USART_BAUD_RATE 9600
    #define USART_BLOCKING
    wait 10 ms
    
    HSerPrint "cls RED"
    ff
    HSerPrint "draw 0, 0, 100, 100, RED"
    ff
    HSerPrint "cir 100, 100, 30, WHITE"
    ff
    HSerPrint "print ""123"""
    ff
    end
    ;
    sub ff
      repeat 3
        HSersend (255) ; ff,ff,ff end of command line
      end repeat
      wait 5 ms
    end sub
    
     

    Last edit: stan cartwright 2018-03-20
  • stan cartwright

    stan cartwright - 2018-03-20

    I got a line and circle by removing spaces

    HSerPrint "cir 100,100,30,WHITE"
    

    Now to sort print..getting there

     
  • stan cartwright

    stan cartwright - 2018-03-20

    I got a line and circle by removing spaces

    HSerPrint "cir 100,100,30,WHITE"
    

    Now to sort print..getting there

     
    • Anobium

      Anobium - 2018-03-20

      Here you go - the library and a demo. This will work with your release.

      Demo is attached - get the lastest glcd.h and the new GLCD_NEXION320x480L.h Put in the correct place. Shows how to do everything. Get from https://sourceforge.net/p/gcbasic/code/HEAD/tree/GCBASIC/trunk/include/

      See the attachment for the demo - it is very easy to use.

      Setup serial, then define the fonts if you wan to use Nextion Fonts - and, you do!

      #define GLCD_TYPE GLCD_TYPE_NEXION320x480L
      #define NextionFont0      0, 8, 16    'Arial 8x16
      #define NextionFont1      1, 12, 24   '24point 12x24 charset
      #define NextionFont2      2, 16, 32   '32point 16x32 charset
      

      This automatically detects if you are using hardware or software serial. The default is hardware serial. You can change the serial command also by adding this to your user code.

      hardware serial

      #define GLCD_NEXIONSerialPrint HSerPrint
      #define GLCD_NEXIONSerialSend  HSerSend
      

      if you use software serial - a valid serial command is required.

      #define GLCD_NEXIONSerialPrint SerPrint 1,
      #define GLCD_NEXIONSerialSend  SerSend 1,
      

      A few special functions are included - the demo shows the usage.

      'update Nextion display object with a long number
      GLCDUpdateObject_Nexion ( in nextionobject as string , in nextionnumberData as long )

      'update Nextion display object with an integer
      GLCDUpdateObject_Nexion ( in nextionobject as string , in nextionnumberData as integer )

      'send a Op Instruction Nextion display object with a string Like select a page...
      GLCDSendOpInstruction_Nexion ( in nextionobject as string , in nextionstringData as string )

       
  • stan cartwright

    stan cartwright - 2018-03-20

    Thank you. I'll test it with my smaller display.
    I thought the original thread was using nextion with gcb not an include.
    I actually wanted to use the nextion commands from gcb as the synatax is odd a bit. Just to.
    The error flashing uno with display tx/rx connected has got me. same com port?

     
  • stan cartwright

    stan cartwright - 2018-03-20

    I used the new glcd,the nextion include .It needed ssd1331 and hx8347 to compile the Nextion Test for xplorer board and just a blank display.
    The following I expected rx and tx. Again unfamiliar.

                'Module: EUSART
                RC0PPS = 0x0010    'TX > RC0
                TXPPS = 0x0010    'RC0 > TX (bi-directional)
                RC5PPS = 0x0010    'TX > RC5
                TXPPS = 0x0015    'RC5 > TX (bi-directional)
    

    I'll try glcd commands next.

     
    • Anobium

      Anobium - 2018-03-20

      Just cable it up and try the demo. Then, examine. The PPS is already setup for the Xpress board you are using a xplorer board?

       
  • stan cartwright

    stan cartwright - 2018-03-20

    The xpress board demo did nothing as did changing to mega328p'
    This does nothing either. not even cls black
    I know the display does that and box and circle so must be wired ok and working. It's the smallest display nextion do.

    #chip mega328p, 16
    #option Explicit
     #include <glcd.h>
        #define GLCD_TYPE GLCD_TYPE_NEXION320x480L
        #define NextionFont0      0, 8, 16    'Arial 8x16
        #define NextionFont1      1, 12, 24   '24point 12x24 charset
        #define NextionFont2      2, 16, 32   '32point 16x32 charset
    #define USART_BAUD_RATE 9600
    #define USART_BLOCKING
    wait 10 ms
    GLCDCLS TFT_BLACK
    ;GLCDPrintString (2, 1, "GCB",TFT_WHITE )
    ;GLCDPrintString (56,1,"v0.98.02",TFT_YELLOW)
    ;GLCDPrintString (2, 18, "DrawStr",TFT_WHITE)
    box 0,0,GLCD_WIDTH-1, GLCD_HEIGHT-1, TFT_YELLOW
    end
    
     
  • stan cartwright

    stan cartwright - 2018-03-20

    Using the nextion command HSerPrint "cir 100,100,30,WHITE" it doesn't work with variables like
    HSerPrint "cir 100,100,variable,WHITE"
    Sorry not positive feedback. Not much other either. Not popular displays with gcb users maybe.
    Must be supported in gcb though as it seems to be popular..look at youtube.

     
  • stan cartwright

    stan cartwright - 2018-03-21

    If you put bauds=115200 in the ilead ide event window you can use #define USART_BAUD_RATE 115200. Works. Should be fast if I get stuff working.

     

    Last edit: stan cartwright 2018-03-21
    • Anobium

      Anobium - 2018-03-21

      @Stan. Stop guessing. I know the library works. Read the Help for the Nextion.

      Reset the device. Connect the Xpress Board and it will work with the demo, then, fiddle.

      If you change the comm to115k you will break the Nextion support for interrups/touch display. So, do not do this.

       
  • stan cartwright

    stan cartwright - 2018-03-21

    I reset the nextion to 9600 baud. Xpress board nextion test still not working.
    Are you assuming I have installed a gauge and nextion fonts in the ilead ide? because I haven't. Is that the problem?

     
    • Anobium

      Anobium - 2018-03-21

      No idea. Really.

      Load the default Nextion demo to start with from the Nextion IDE. Then, test.

       
  • stan cartwright

    stan cartwright - 2018-03-21

    GOOD NEWS...ish. I downloaded the original demo everyone gets out the box and progged it and it worked as it did. Then tried the xpress board demo and IT WORKED! Nice one Anobiwan.
    Lots to learn with these nextions. Thanks for your patience.
    ps I like stan wars

     

    Last edit: stan cartwright 2018-03-21
  • Anobium

    Anobium - 2018-03-21

    Tell me the 'ish' issue

    Now figure out   how it all works.

     
  • stan cartwright

    stan cartwright - 2018-03-21

    Ish ...cut and paste is not understanding. I got the idea you can't use what you haven't installed in the project. Items have id and properties. Takes a while to use.
    Your demo works with avr after a few changes.

    ;Anobium Nextion demo converted to avr
    ;BE AWARE- this demo assumes you have an out the box display demo running
    ;as it uses nextion gauge and fonts installed in that nextion demo.
        #chip mega328p,16
        #option explicit
        #include <glcd.h>
        #define GLCD_TYPE GLCD_TYPE_NEXION320x480L
        #define NextionFont0      0, 8, 16    'Arial 8x16
        #define NextionFont1      1, 12, 24   '24point 12x24 charset
        #define NextionFont2      2, 16, 32   '32point 16x32 charset
    
        #define SWITCH_DOWN         0
        #define SWITCH_UP           1
    
        #define SWITCH      PORTA.5
    
        #define USART_BAUD_RATE 9600
        #define USART_TX_BLOCKING
    
        dim adcval as word
        dim ScaledValue as Integer
        dim myString as string * 32
    
        wait 1 s
        GLCDSendOpInstruction_Nexion( "page",  "gauges" )
    
        do
    
              adcval = ReadAD( portc.4 )
              ;rest the same as original
    
     
  • Anobium

    Anobium - 2018-03-22

    OK.

    Pay back time now....

    Can you take the demo and create a few demos - at the moment the file has a copy of demos and this is not not that clear.
    May be one for guages, one for glcd test and for the PIC and AVR.
    Can you put the standard demo header on the files then I can post to GitHub.

    Ta,

     
  • stan cartwright

    stan cartwright - 2018-03-23

    Hi again. a bit of experimenting and seems to use nextion then in the ide create fonts and save and click install in project or sending text wont work. Sort device then display. like glcd landscape or portrait. Then compile, then update. this works faster using a usb-ttl adapter.
    Ok, now your demo has a glcd demo which works...a bit.
    I commented out gauges. No circle cos screen size?
    Circle( GLCD_WIDTH/2, GLCD_HEIGHT/2, 50, TFT_WHITE ) ;center
    FilledCircle( GLCD_WIDTH/2, GLCD_HEIGHT/2, 25, TFT_DARKGREY )
    where is the circle error?
    You have nextion320x480 and it implies for one model only not general nextion

     

    Last edit: stan cartwright 2018-03-23
  • Anobium

    Anobium - 2018-03-23

    That looks very different. Where have all the strings gone?
    What are the dimensions of your new display? I think we can add an adaption to easily handle the different screen sizes, so, you do not have to fiddled with the glcd.h

     
  • stan cartwright

    stan cartwright - 2018-03-23

    I changed If GLCD_TYPE = GLCD_TYPE_NEXION320x480L Then in GLCD.h lines GLCD_WIDTH = 320, GLCD_HEIGHT = 240 as I'm using Nextion NX3224T024 320x240 STANDARD, NOT ENHANCED if that matters. I set up the display in the editor for horizontal.
    Why these line don't make circle?
    Circle( GLCD_WIDTH/2, GLCD_HEIGHT/2, 50, TFT_WHITE ) ;center
    FilledCircle( GLCD_WIDTH/2, GLCD_HEIGHT/2, 25, TFT_DARKGREY )

     
<< < 1 2 3 4 > >> (Page 2 of 4)

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.