Start a new topic

Data support for custom commands

Id like to be able to output unique strings from push buttons on my screen

like raw commands (without the FF ect in the headers)

I have a tow/plow light bar that uses serial to control its internal serial modules

example output from original control head over rs485:control wires:

The controllers send to the bar: 

64 02 01 01 01 10 2F F6 00 00 00 9E
The I/O board in the bar sees that and says: oh, I need to turn on all strobes with the cometflash pattern, sync'd.

I'd like to use the nextion to create a new touch screen for the needed commands to send using an image of the older mpc01 control head

Tried to make a screen using the controller image but had trouble resizing it to fit the screen layout

might have to design something new that will work

1 person likes this

Good work so far.  Always lots to do :)

the needed hardware support to program or send commands are

- 2-Wire RS-485 operation

-9600 baud.

-echo on.

-send data control.

Planning to sniff out the individual commands for each mode to use on the screen depending on what buttons pressed 

Already implemented using print and printh commands

Nextion Instruction Set - print and printh

ahh so the commands need to be in a txt file for each button or in the command output  box?

you don't need a txt file.

create a button and do an action to it in nextion editor.

Touch release:

print "123" //returns the ASCII of string "123":0x31 0x32 0x33

That will send 123

Thats exact what you want:

2. When use print command to obtain data, the device sends only the data content, no start identifier, nor end mark.

Probably what you need is to put your command in the button's Press Release Event.

So if your command is 64 02 01 01 01 10 2F F6 00 00 00 9E for cometflash strobes and you have a button in your HMI as b1 that is what the user pressed to send the command, then in the Press Release Event of the button b1 you would put:

printh 64 02 01 01 01 10 2F F6 00 00 00 9E

That will cause only 12 bytes being sent over the Rx/Tx wire - the 12 bytes of your command.  There may be some limit as to the number of bytes that can be sent in one command, though I am not currently aware of what that limit might be.

Ahh ok perfect ,so i could send what i need that way that makes sense now

I was working before on something else on an older version of the editor and couldn't get that to work , never tried again

NOTE: The output is done from the actual Nextion, and not from in the Editor Debug session.

As Alex pointed out print with text in quotes will send hex value of each char inside the quotes

but if your output requires char values below 32 (as per your example) and upper ASCII values that might be difficult to enter, I would definitely use the printh command - especially if you already know the hex values in advance.

I guess I will have to capture all commands and see what modes will work within the 32 value output

and just try a sample hmi to see what happens

32 value?  I am not certain what you are referring to.
Assuming your command is what you posted

printh 64 02 01 01 01 10 2F F6 00 00 00 9E

would accomplish sending those 12 bytes.

I was merely pointing out that the print "text" has limits as it would be difficult to have what you listed in a text string: 02, 01, 01, 01, 10 are below decimal value 32 and generally considered non printable - certainly no font support for those characters. 00 is a null character, not able to be represented in a text value, 9E and F6 are upper ascii and maybe interfered with by iso-8859 translation, leaving just 64 and 2F as characters with no issues in a text value for the print command

printh command for print-hex takes your hex pairs and outputs without any issues.  No translations, and no difficulty as long as you know what the hex values are.  Your string of 12 bytes should not present an issues that I can see at all ... using the printh

So I am not sure what you meant by within the 32 value output.

i meant in hopes all commands would be within the 32 bytes

I am now reviewing all of the Feature Requests, this will take some time, patience please.

print and printh commands pre existed

Although this wasn't a real feature request, it is now marked as reviewed.

Login or Signup to post a comment