Divide 4 bytes variable into individual bytes (VBS)
Posted: Fri 16. Dec 2011, 17:17
I have an virtual variable which is 4 bytes unsigned type
I have to put this value in a char array before transmitting via PCAN
But Data(2) keeps overflowing.
Please can anyone help me resolve this issue.
I have to put this value in a char array before transmitting via PCAN
Code: Select all
Set TrimValue = Signals("Trim Value (Set)")
Data(2) = TrimValue.Value/16777216 '2^24 i used this because i think right shift does not work in 'PCAN
Data(3) = TrimValue.Value/65536 '2^16
Data(4) = TrimValue.Value/256 '2^8
Data(2) = TrimValue.Value & &HFF
Please can anyone help me resolve this issue.