MATLAB: How to read int16 data using the Arduino I2C Support Package
simulink
How do I read int16 data using the Arduino I2C Support Package?
Output data from the accelerometer I'm using is 16-bit Two's Complement according to the data sheet (attached). When I set the data size to N=6 (6 bytes of data from registers 0x32 – 0x37), I see 5 lines rather than 3, 1 for each axis. Also, only 1 line actually seems to be showing acceleration data. If I up the data size to 8, there are 3 lines that appear to be showing acceleration data along with extra lines.
So it seems there is an issue with packaging the data from the accelerometer in two's complement format into a format that would be readable on my end. How do I figure this out?
The I2C block
Related Question
- How to parse XML data sent via UDP in a Simulink Desktop Real-Time application
- Can I read data from a serial port and a data acquisition board simulataneously using the Data Acquisition Toolbox 2.14 (R2009a)
- How to obtain the average price using the “history” function
- Data truncation to 4 word lengths when using the SPI Transmit block in the TI C2000 support package for Embedded Coder
- Serial port reading.
- Can I eliminate the extra copy of a variable that is created in the generated code when using a “MATLAB function” block with a “Data Store Read” block as the input
Best Answer