Hi all
I'm currently working through my first project using a Vision PLC, although I have worked with some other controllers. I was hoping I could get some help on an issue that has stumped me.
The problem I am having relates to using a J1939 CAN to read values from a tilt sensor. I am able to read the 4-byte values from the sensor into 2 MIs, which is where the problem comes in. The PLC interprets both values (the least significant byte is the biggest problem for me) as signed/"2s complement" integers, when I want it to be an unsigned integer so I can combine the values inside the PLC.
The only data types I seem to be able to put the J1939 values into are MI and XI, so I can't put them into a DW, which would solve the issue if it were possible.
If I try to move the MI value into a DW, it stays as a negative number, i.e. with leading (hex) Fs.
In the documentation for MI numbers, it says it can be used as a 16-bit signed or unsigned integer, however I can't see a way of making the PLC view it as an unsigned integer.
Does anyone have any ideas about how i might solve the problem? Can these PLCs treat integers as unsigned? Can they convert 2 side-by-side MIs into a DW?
Any help would be greatly appreciated.
Thanks.