Instrument control package: Difference between revisions

Jump to navigation Jump to search
Line 370: Line 370:
</syntaxhighlight>
</syntaxhighlight>


In the example case the temperature sensor is connected to the i2c-ch341-usb device, as as sufficient permissions to access the device as a user.  
In the example case the temperature sensor is connected to the i2c-ch341-usb device, and it is assumed the user has sufficient permissions to access the device.  


According to the datasheet, the temperature device uses address 0x40, so create a i2c device using the linux device and address:
According to the datasheet, the temperature device uses address 0x40, so create a i2c device using the linux device and address:
Line 378: Line 378:
</syntaxhighlight>
</syntaxhighlight>


To read  the termaturem register 0xF3 must be addressed and read (2 bytes of data):
To read  the temperature, register 0xF3 must be addressed and read (2 bytes of data):


<syntaxhighlight lang="octave" style="font-size:13px">
<syntaxhighlight lang="octave" style="font-size:13px">
Line 386: Line 386:
data = fread (i2cdev, 3);
data = fread (i2cdev, 3);
</syntaxhighlight>
</syntaxhighlight>
The data must be converted to a deg K value by making  16 bit number of the value and masking out unused bits.


<syntaxhighlight lang="octave" style="font-size:13px">
<syntaxhighlight lang="octave" style="font-size:13px">
Anonymous user

Navigation menu