Hey
I recently picked up a project where I need to use the I2C. However my value required is stored on two separate registers (MSB and LSB). The questions is how can I easily put the MSB and LSB together to get my 16 bit integer?
There must be a simple way of doing this.
Thanks
LSB and MSB
-
- Flowcode V4 User
- Posts: 288
- Joined: Wed Nov 02, 2011 11:15 pm
- Has thanked: 29 times
- Been thanked: 30 times
- Contact:
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
-
- Flowcode V4 User
- Posts: 288
- Joined: Wed Nov 02, 2011 11:15 pm
- Has thanked: 29 times
- Been thanked: 30 times
- Contact:
-
- Flowcode V4 User
- Posts: 288
- Joined: Wed Nov 02, 2011 11:15 pm
- Has thanked: 29 times
- Been thanked: 30 times
- Contact:
Re: LSB and MSB
Please note...
Not sure its my ignorance with I2C, but using the MIC2_Recieve_Byte_Transaction macro always doubles the device_ID when used on hardware...
IE = Device_ID = 0x64
Gives
0xB8 when measured on scope
Not sure its my ignorance with I2C, but using the MIC2_Recieve_Byte_Transaction macro always doubles the device_ID when used on hardware...
IE = Device_ID = 0x64
Gives
0xB8 when measured on scope
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: LSB and MSB
Hello,
The transaction macro assumes you pass in the 7-bit address and the macro then manages the 1-bit read/write flag for you. So if you need to send 0x64 including the read/write bit then you should pass the value 0x32.
The transaction macro assumes you pass in the 7-bit address and the macro then manages the 1-bit read/write flag for you. So if you need to send 0x64 including the read/write bit then you should pass the value 0x32.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel