Ken Roach
Lifetime Supporting Member + Moderator
I'm writing a PLC-5 program that receives a barcode string over DH+ that ends up in an Integer register in the controller.
The challenge is that the data is "byte swapped", so that when I move it into a STRING data type the individual bytes in each word are backwards from human readable.
I have: ABCRDO1E
I want: BARCODE1
Does anyone have a code snippet or subroutine to share that will swap the bytes in an array of PLC-5 integers? In the SLC-500 and ControlLogix I have the convenient SWP instruction, but in the PLC-5 I have to do it by hand.
The challenge is that the data is "byte swapped", so that when I move it into a STRING data type the individual bytes in each word are backwards from human readable.
I have: ABCRDO1E
I want: BARCODE1
Does anyone have a code snippet or subroutine to share that will swap the bytes in an array of PLC-5 integers? In the SLC-500 and ControlLogix I have the convenient SWP instruction, but in the PLC-5 I have to do it by hand.