Start a new topic

Send data from MCU to HMI

Hi all,


Since this week i have my first Nextion UART HMI.


Now i'm playing with the HMI and found it's quiet easy to send data from the HMI to the MCU with:  

print n0.val //returns n0.val 0x00 0x00 0x00

Now i have a question about sending data from my PIC MCU to the Nextion HMI.


I would like to send a button press to "b0 on page 1".

What HEX do i need to send to the HMI?


And what HEX do i need to send if i want to write a new value to a number?


Can some one please explain me how this is working? And is there a instruction set for all commands what can be received by the HMI?


Please review the information in (and follow links contained within)

https://www.itead.cc/wiki/Nextion_HMI_Solution


In there is also the Nextion Instruction Set link

which outlines the format and accepted text based instructions


Kind of curious

print n0.val should return

0x00 0x00 0x00 0x00

when n0.val is equal to 0, perhaps oversight of one 0x00


1)  click page1.b1,1ÿÿÿ  will trigger a b1 press if page1 is the current page

  the hex for this is

      636C69636B2070616765312E62312C31FFFFFF


2)  n0.val=15384ÿÿÿ  will set n0 to 15384 in decimal,

   the hex for this is

      6E302E76616C3D3135333834FFFFFF


Almost all Nextion packaging has URL that will take you to the above link

QR coded too

Okay, now i got it. Thanks for explain it to me.
First i was looking for pre defined HEX commands which of course i could not find as it is written as ASCII :)

About my "n0.val" this means a value equal to 0x00-0xff. I should have write it down like that to make it more easy to understand.

 

range on n0 is signed 32 bit therefore  -2147483648 to 2147483647

when returned from Nextion 0x00 0x01 0x02 0x03 it is in little endian

   0x00 * 1 + 0x01 * 256 + 0x02 * 65536 + 0x03 * 16777216

Thx for the help Patrick, i will keep that in mind.

 

Login or Signup to post a comment