Skip to content

Commit

Permalink
Added a getTemperature function to U3 class.
Browse files Browse the repository at this point in the history
  • Loading branch information
LabJackAdmin committed Jul 26, 2010
1 parent 4ff52ac commit 82f3980
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/u3.py
Expand Up @@ -456,6 +456,22 @@ def getFIOState(self, fioNum):
return self.getFeedback(BitStateRead(fioNum))[0]
getFIOState.section = 3

def getTemperature(self):
"""
Name: U3.getTemperature()
Args: None
Desc: Reads the internal temperature sensor on the U3. Returns the
temperature in Kelvin.
"""

bits = self.getFeedback( AIN(30, 31) )[0]

return self.binaryToCalibratedAnalogTemperature(bits)



def getAIN(self, posChannel, negChannel = 31, longSettle=False, quickSample=False):
"""
Name: U3.getAIN(posChannel, negChannel = 31, longSettle=False,
Expand Down Expand Up @@ -1481,6 +1497,14 @@ def binaryToCalibratedAnalogVoltage(self, bits, isLowVoltage = True, isSingleEnd
raise Exception, "Can't do differential on high voltage channels"
binaryToCalibratedAnalogVoltage.section = 3

def binaryToCalibratedAnalogTemperature(self, bytesTemperature):
hasCal = self.calData is not None

if hasCal:
return self.calData['tempSlope'] * float(bytesTemperature)
else:
return float(bytesTemperature) * 0.013021

def voltageToDACBits(self, volts, dacNumber = 0, is16Bits = False):
"""
Name: U3.voltageToDACBits(volts, dacNumber = 0, is16Bits = False)
Expand Down

0 comments on commit 82f3980

Please sign in to comment.