drbitboy
Lifetime Supporting Member
Here is an experiment to make my point:
- Create three string tags:
- four, initialize as '4'
- ScanSim, initialize as 'P1234'
- ScanString, initialize as '$00$00$00$00$00$00$00$00'
- Write and run the a program with the following rungs:
- MOV ScanSim ScanString
- Simulates barcode read
- ScanString will be 'P1234' after evaluation of this rung
- EQU ScanString.DATA[0] 80 DELETE ScanString 1 1 ScanString
- Strips 'P' prefix
- ScanString will be '1234' after evaluation of this rung.
- ScanString.DATA[3] and ScanString.DATA[4] will both be '4' i.e. SINT value 52 decimal = 34H
- MOV 53 ScanString.DATA[3]
- Overwrite '4' in string with '5' but leaves stale '4' after string
- MOV -99 result
- result is a scalar INT tag
- Ensure next command's execution can be verified
- FIND ScanString four 1 result
- Will overwrite value of -99 from previous rung in result with a value of 0
- because there will be no one-character sub-string four (='4') in ScanString,
- which proves the '4' (52 dec = 34Hex) at ScanString.DATA[4] is not part of "STRING" tag ScanString
- Will overwrite value of -99 from previous rung in result with a value of 0
- MOV ScanSim ScanString