11:59 am
March 23, 2015
When I read the data registers in the ADXL345 3-axis accelerometer they come across as a U16 integer, but they are stored 2's Complement format. There are a couple of ways of converting the 16-bit code into 2's complement (see example below) in standard LabVIEW, but some of the VI's are not available in the PWS Library.
eg. I read a 16-bit code of 0xFFF2 (65,522 dec) from the register, but it should be converted to the 2's complement of -14(dec) - is it possible to do this within the PWS Library?
Chris
2:37 am
March 23, 2015
OK I just realised that the 2's Complement Input in the above example was an I16, but in my PWS Code it is coming in as a U16.
Standard LabVIEW has the "To sign Word Integer" I16 Conversion VI which does the job, but of course the PWS Library doesn't.
It seems to me I only have two options:
1) Create a very large lookup table and index the correct I16 value out - yuk!
2) Write the U16 to I16 conversion in Arduino code and call that in LabVIEW - I think that is possible using the PWS Library?
Chris
39
1 Guest(s)