General > Technical support

Reading a string using MODBUS RTU

<< < (2/2)

support:
Sorry for the confusion as the forum reformatted the code section because I forgot to enclose the section with the code markup - this has now been fixed.

I have attached the PC7 program file for demonstration. You should observe DM[1] to DM[20] contains the ASCII value of each byte in the string A$ = "OPEN EMERG STOP SW"  The screen capture below shows these byte values in HEX mode.

Lorne Van Dusen:
I must be missing something as i downloaded your latest version and ran it in the simulator and all I get is the value 32 in the DM[20] location.
All other DM's are blank

A$ = "OPEN EMERG STOP SW  "

J = LEN(A$)

FOR I = 1 to J
   DM[J] = ASC(A$,I)
NEXT

support:
Sorry about that. Please try the attached Rev 1.


A$ = "OPEN EMERG STOP SW  "

J = LEN(A$)

FOR I = 1 to J
   DM[I] = ASC(A$,I)
NEXT

Lorne Van Dusen:
Now it works properly

Navigation

[0] Message Index

[*] Previous page

Go to full version