MCPcopy Create free account
hub / github.com/LabPy/lantz / rawCounter

Method rawCounter

lantz/drivers/labjack/_internal/u12.py:834–904  ·  view source on GitHub ↗

Name: U12.rawCounter(StrobeEnabled = False, ResetCounter = False) Args: StrobeEnable, set to True to enable strobe. ResetCounter, set to True to reset the counter AFTER reading. Desc: This command controls and reads the 32-bit counter. See Section

(self, StrobeEnabled = False, ResetCounter = False)

Source from the content-addressed store, hash-verified

832 return returnDict
833
834 def rawCounter(self, StrobeEnabled = False, ResetCounter = False):
835 """
836 Name: U12.rawCounter(StrobeEnabled = False, ResetCounter = False)
837 Args: StrobeEnable, set to True to enable strobe.
838 ResetCounter, set to True to reset the counter AFTER reading.
839 Desc: This command controls and reads the 32-bit counter. See
840 Section 5.3 of the User's Guide.
841
842 Returns: A dictionary with the following keys:
843 D15toD8States, a BitField representing the states of D15-D8.
844 D7toD0States, a BitField representing the states of D7-D0.
845 IO3toIO0States, a BitField representing the states of IO3-IO0.
846 Counter, the value of the counter
847
848 Example:
849 >>> import u12
850 >>> d = u12.U12()
851 >>> d.rawCounter()
852 {
853 'D15toD8States':
854 <BitField object: [ D15 = Low (0), D14 = Low (0), D13 = Low (0),
855 D12 = Low (0), D11 = Low (0), D10 = Low (0),
856 D9 = Low (0), D8 = Low (0) ] >,
857
858 'D7toD0States':
859 <BitField object: [ D7 = Low (0), D6 = Low (0), D5 = Low (0),
860 D4 = Low (0), D3 = Low (0), D2 = Low (0),
861 D1 = Low (0), D0 = Low (0) ] >,
862
863 'IO3toIO0States':
864 <BitField object: [ IO3 = Low (0), IO2 = Low (0), IO1 = Low (0),
865 IO0 = Low (0) ] >,
866
867 'Counter': 0
868 }
869
870
871 """
872 command = [ 0 ] * 8
873
874 bf = BitField()
875 bf.bit1 = int(StrobeEnabled)
876 bf.bit0 = int(ResetCounter)
877
878 command[0] = int(bf)
879
880 bf.fromByte(0)
881 bf.bit6 = 1
882 bf.bit4 = 1
883 bf.bit1 = 1
884 command[5] = int(bf)
885
886 self.write(command)
887 results = self.read()
888
889 returnDict = {}
890
891 if results[0] != command[5]:

Callers 1

eCountMethod · 0.95

Calls 5

fromByteMethod · 0.95
writeMethod · 0.95
readMethod · 0.95
BitFieldClass · 0.70
U12ExceptionClass · 0.70

Tested by

no test coverage detected