cromda Posted March 14, 2011 Share Posted March 14, 2011 Hi, I would read a pressure sensor BMP085 trough I2C bus with a Labjack U6. Does it seems possible to implement the algorytm in page 13 of the datasheet (see attachment) into DAQFactory ? BST_BMP085_DS000_05.pdf Link to comment Share on other sites More sharing options...
AzeoTech Posted March 14, 2011 Share Posted March 14, 2011 Certainly. Its just a bunch of math. You may need to do some artificial type casting since DAQFactory only has one numeric data type. Link to comment Share on other sites More sharing options...
cromda Posted March 14, 2011 Author Share Posted March 14, 2011 The problem is variable casting : variable read/write to I2C are byte, but variables in DAQFactory are double. So, if I give a double to DF, what he will send as a byte to I2C ? Reversely, if I get a byte from I2C into a Double, what will be in the double ? Link to comment Share on other sites More sharing options...
AzeoTech Posted March 15, 2011 Share Posted March 15, 2011 DAQFactory largely does the casting for you. However, there are cases, mostly in write routines, where you need to make sure the value you are sending is in range. In other words, not sending 256 to a byte value. The easiest way to do this is with what I called artificial type casting. If you take a number and & it with 0xff, you basically are type casting it an unsigned byte: value & 0xff Its still a double, its just limited to the range of an unsigned byte. The rest is handled for you. In the reverse, when you are receiving a byte, it will automatically get converted to a double. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.