Several modbus tags as string

I have 9 modbus registers containing the ascii value of each character in a string.
What’s the easiest way to convert that in to a string tag defined in the Flexy?

Just to clarify, do you mean that you want to read in each individual ascii character and then merge them all into one string?

If that’s the case you could create a new ewon tag and run a script that grabs the values of all the strings.

something like newstring@ = ascii1 + ascii2 + … + final_ascii

Each tag contains the numeric value for the ascii character.
I read about enabling string historization, but the note about “complete format of Ewon” scared me a bit.

If you want to historically log strings you will need to do a new format of the device unfortunately. It allocates a separate area of memory for string tags that it will use. Alternatively, you could write your tag values to a custom csv with an onchange or ondate script if you want to avoid doing this new formatting

is there a BASIC command to convert a tag with the numeric value to the actual character?

Hi Lars,

Simon has some code available here for Modbus Ascii

https://techforum.ewon.biz/thread-171.html

I’m creating a JSON string to be used in MQTT and I found that I could use the CHR$ command to convert fom a number to the character, but now I have the problem that some positions might be ascii value =0 (null), and the JSON string fails. Tried using RTRIM and LTRIM, but it does not seem to work properly.

What do you want the device to do if it has an ascii value of 0? You might be able to do some if statements to avoid the issue you’re running into?

Topic closed due to inactivity.