brucelee2
Member level 2
Hi,
I have a HMI which sends two 8-bit chars which represent a 16-bit touch screen coordinate.
So in an example, the HMI sends:
0X03 then 0X0E (both seperate) which represent the coordinate 030E (782).
How can i combine the two into a single variable to represent the number 782? I was thinking of creating a 'int' and shifting each into it some how.
ie.
char first = 0x03;
char second = 0x0E;
int number;
number=first;
number=number<<8;
---Now im stuck---
Any Ideas?
Thanks a lot.
I have a HMI which sends two 8-bit chars which represent a 16-bit touch screen coordinate.
So in an example, the HMI sends:
0X03 then 0X0E (both seperate) which represent the coordinate 030E (782).
How can i combine the two into a single variable to represent the number 782? I was thinking of creating a 'int' and shifting each into it some how.
ie.
char first = 0x03;
char second = 0x0E;
int number;
number=first;
number=number<<8;
---Now im stuck---
Any Ideas?
Thanks a lot.