Problem with a PDL driver
I am writing a PDL driver for my energy analyzer. The data from the internal registers is returned in binary rather than ASCII format with two sequential bytes representing the MSB and LSB or a 16bit signed Integer. What is the easiest way to convert these to an INT4 field in the "Store=" structure?
So far the only thing that works is (for bytes 3 and 4 in the reply)
Store=
Register1 = Add(Mul(ToInt4(Extract(&Reply, Card1, 3)), 256) ,Extract(&Reply, Card1, 4));
EndStore;
This seems long winded and I am not sure yet if it will work for negative numbers. Is there a better way?
PJG
|