
SuperCoupe (Customer) asked a question.
I am getting a ASCII string form a scale that I need do to a little math with and display on a HMI. I can read the ASCII string just fine, but I am trying to use AEX to pull out and convert the data I need. With the AEX I can get one digit or number and several periods, example . 2...........
Format from scale the is: ST,GS,+/-, "data"lb,CR,LF, for a total of 18 spots. "data" is the reading of the scale. Not sure what I am doing wrong with this or am I using the wrong commands. Have searched on here and on PLCS forum with no luck.
Thanks,
In this scenario
V2000 holds the character count for the ASCII string.
V2001 (byte 0) is the start of the ASCII string data.
Starting at V2001, byte offsets 7 through 13 hold the actual weight value. However, the byte order makes sense for a STRING, but NOT for a DWORD integer. Therefore, the byte order must be manipulated and some math must be performed.
Below, I used the VPRINT instruction to create your string but used a weight of 1,234,567 for testing. I've included the CR/LF ($N), as well.
I used a decimal format to populate V5000 and V5001 with the DWORD value 1,234,567. See if this approach will help your project.