Created
June 21, 2010 22:00
-
-
Save labjack/447577 to your computer and use it in GitHub Desktop.
LabJackPython docstrings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Analog Input Feedback command | |
specify the positive and negative channels to use | |
(0-16, 30 and 31 are possible) | |
also specify whether to turn on longSettle or quick Sample | |
returns 16-bit signed int sample | |
>>> import u3 | |
>>> d = u3.U3() | |
>>> d.debug = True | |
>>> d.getFeedback(u3.AIN(PositiveChannel = 0, NegativeChannel=31, LongSettling=False, QuickSample=False)) | |
Sent: [0x1b, 0xf8, 0x2, 0x0, 0x20, 0x0, 0x0, 0x1, 0x0, 0x1f] | |
Response: [0xab, 0xf8, 0x3, 0x0, 0xaf, 0x0, 0x0, 0x0, 0x0, 0x20, 0x8f, 0x0] | |
[36640] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Read the digital direction of one I/O | |
IONumber: 0-7=FIO, 8-15=EIO, 16-19=CIO | |
returns 1 = Output, 0 = Input | |
>>> import u3 | |
>>> d = u3.U3() | |
>>> d.debug = True | |
>>> d.getFeedback(u3.BitDirRead(IONumber = 5)) | |
Sent: [0xc, 0xf8, 0x2, 0x0, 0x11, 0x0, 0x0, 0xc, 0x5, 0x0] | |
Response: [0xfb, 0xf8, 0x2, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x1] | |
[1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BitDirWrite Feedback command | |
Set the digital direction of one I/O | |
IONumber: 0-7=FIO, 8-15=EIO, 16-19=CIO | |
Direction: 1 = Output, 0 = Input | |
>>> import u3 | |
>>> d = u3.U3() | |
>>> d.debug = True | |
>>> d.getFeedback(u3.BitDirWrite(IONumber = 5, Direction = 0)) | |
Sent: [0xd, 0xf8, 0x2, 0x0, 0x12, 0x0, 0x0, 0xd, 0x5, 0x0] | |
Response: [0xfa, 0xf8, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0] | |
[None] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BitStateRead Feedback command | |
read the state of a single bit of digital I/O. Only digital | |
lines return valid readings. | |
IONumber: 0-7=FIO, 8-15=EIO, 16-19=CIO | |
return 0 or 1 | |
>>> import u3 | |
>>> d = u3.U3() | |
>>> d.debug = True | |
>>> d.getFeedback(u3.BitStateRead(IONumber = 5)) | |
Sent: [0xa, 0xf8, 0x2, 0x0, 0xf, 0x0, 0x0, 0xa, 0x5, 0x0] | |
Response: [0xfb, 0xf8, 0x2, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x1] | |
[1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BitStateWrite Feedback command | |
write a single bit of digital I/O. The direction of the | |
specified line is forced to output. | |
IONumber: 0-7=FIO, 8-15=EIO, 16-19=CIO | |
State: 0 or 1 | |
>>> import u3 | |
>>> d = u3.U3() | |
>>> d.debug = True | |
>>> d.getFeedback(u3.BitStateWrite(IONumber = 5, State = 0)) | |
Sent: [0xb, 0xf8, 0x2, 0x0, 0x10, 0x0, 0x0, 0xb, 0x5, 0x0] | |
Response: [0xfa, 0xf8, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0] | |
[None] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Counter Feedback command | |
Reads a hardware counter, optionally resetting it | |
counter: 0 or 1 | |
Reset: True ( or 1 ) = Reset, False ( or 0 ) = Don't Reset | |
Returns the current count from the counter if enabled. If reset, | |
this is the value before the reset. | |
>>> import u3 | |
>>> d = u3.U3() | |
>>> d.debug = True | |
>>> d.configIO(EnableCounter0 = True, FIOAnalog = 15) | |
Sent: [0x5f, 0xf8, 0x3, 0xb, 0x58, 0x0, 0x5, 0x0, 0x44, 0x0, 0xf, 0x0] | |
Response: [0x5a, 0xf8, 0x3, 0xb, 0x53, 0x0, 0x0, 0x0, 0x44, 0x0, 0xf, 0x0] | |
{'NumberOfTimersEnabled': 0, 'TimerCounterPinOffset': 4, 'DAC1Enable': 0, 'FIOAnalog': 15, 'EIOAnalog': 0, 'TimerCounterConfig': 68, 'EnableCounter1': False, 'EnableCounter0': True} | |
>>> d.getFeedback(u3.Counter(counter = 0, Reset = False)) | |
Sent: [0x31, 0xf8, 0x2, 0x0, 0x36, 0x0, 0x0, 0x36, 0x0, 0x0] | |
Response: [0xfc, 0xf8, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0] | |
[0] | |
>>> # Tap a ground wire to counter 0 | |
>>> d.getFeedback(u3.Counter(counter = 0, Reset = False)) | |
Sent: [0x31, 0xf8, 0x2, 0x0, 0x36, 0x0, 0x0, 0x36, 0x0, 0x0] | |
Response: [0xe9, 0xf8, 0x4, 0x0, 0xec, 0x0, 0x0, 0x0, 0x0, 0xe8, 0x4, 0x0, 0x0, 0x0] | |
[1256] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Counter0 Feedback command | |
Reads hardware counter0, optionally resetting it | |
Reset: True ( or 1 ) = Reset, False ( or 0 ) = Don't Reset | |
Returns the current count from the counter if enabled. If reset, | |
this is the value before the reset. | |
>>> import u3 | |
>>> d = u3.U3() | |
>>> d.debug = True | |
>>> d.configIO(EnableCounter0 = True, FIOAnalog = 15) | |
Sent: [0x5f, 0xf8, 0x3, 0xb, 0x58, 0x0, 0x5, 0x0, 0x44, 0x0, 0xf, 0x0] | |
Response: [0x5a, 0xf8, 0x3, 0xb, 0x53, 0x0, 0x0, 0x0, 0x44, 0x0, 0xf, 0x0] | |
{'NumberOfTimersEnabled': 0, 'TimerCounterPinOffset': 4, 'DAC1Enable': 0, 'FIOAnalog': 15, 'EIOAnalog': 0, 'TimerCounterConfig': 68, 'EnableCounter1': False, 'EnableCounter0': True} | |
>>> d.getFeedback(u3.Counter0( Reset = False ) ) | |
Sent: [0x31, 0xf8, 0x2, 0x0, 0x36, 0x0, 0x0, 0x36, 0x0, 0x0] | |
Response: [0xfc, 0xf8, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0] | |
[0] | |
>>> # Tap a ground wire to counter 0 | |
>>> d.getFeedback(u3.Counter0(Reset = False)) | |
Sent: [0x31, 0xf8, 0x2, 0x0, 0x36, 0x0, 0x0, 0x36, 0x0, 0x0] | |
Response: [0xe, 0xf8, 0x4, 0x0, 0x11, 0x0, 0x0, 0x0, 0x0, 0x11, 0x0, 0x0, 0x0, 0x0] | |
[17] | |
>>> # Tap a ground wire to counter 0 | |
>>> d.getFeedback(u3.Counter0(Reset = False)) | |
Sent: [0x31, 0xf8, 0x2, 0x0, 0x36, 0x0, 0x0, 0x36, 0x0, 0x0] | |
Response: [0x19, 0xf8, 0x4, 0x0, 0x1c, 0x0, 0x0, 0x0, 0x0, 0xb, 0x11, 0x0, 0x0, 0x0] | |
[4363] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Counter1 Feedback command | |
Reads hardware counter1, optionally resetting it | |
Reset: True ( or 1 ) = Reset, False ( or 0 ) = Don't Reset | |
Returns the current count from the counter if enabled. If reset, | |
this is the value before the reset. | |
>>> import u3 | |
>>> d = u3.U3() | |
>>> d.debug = True | |
>>> d.configIO(EnableCounter1 = True, FIOAnalog = 15) | |
Sent: [0x63, 0xf8, 0x3, 0xb, 0x5c, 0x0, 0x5, 0x0, 0x48, 0x0, 0xf, 0x0] | |
Response: [0x5e, 0xf8, 0x3, 0xb, 0x57, 0x0, 0x0, 0x0, 0x48, 0x0, 0xf, 0x0] | |
{'NumberOfTimersEnabled': 0, 'TimerCounterPinOffset': 4, 'DAC1Enable': 0, 'FIOAnalog': 15, 'EIOAnalog': 0, 'TimerCounterConfig': 72, 'EnableCounter1': True, 'EnableCounter0': False} | |
>>> d.getFeedback(u3.Counter1(Reset = False)) | |
Sent: [0x32, 0xf8, 0x2, 0x0, 0x37, 0x0, 0x0, 0x37, 0x0, 0x0] | |
Response: [0xfc, 0xf8, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0] | |
[0] | |
>>> # Tap a ground wire to counter 1 | |
>>> d.getFeedback(u3.Counter1(Reset = False)) | |
Sent: [0x32, 0xf8, 0x2, 0x0, 0x37, 0x0, 0x0, 0x37, 0x0, 0x0] | |
Response: [0xfd, 0xf8, 0x4, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0] | |
[1] | |
>>> # Tap a ground wire to counter 1 | |
>>> d.getFeedback(u3.Counter1(Reset = False)) | |
Sent: [0x32, 0xf8, 0x2, 0x0, 0x37, 0x0, 0x0, 0x37, 0x0, 0x0] | |
Response: [0xb4, 0xf8, 0x4, 0x0, 0xb7, 0x0, 0x0, 0x0, 0x0, 0x6b, 0x2b, 0x21, 0x0, 0x0] | |
[2173803] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16-bit DAC Feedback command for DAC0 | |
Controls DAC0 in 16-bit mode. | |
Value: 0-65535 | |
>>> import u3 | |
>>> d = u3.U3() | |
>>> d.debug = True | |
>>> d.getFeedback(u3.DAC0_16(Value = 0x1122)) | |
Sent: [0x54, 0xf8, 0x2, 0x0, 0x59, 0x0, 0x0, 0x26, 0x22, 0x11] | |
Response: [0xfa, 0xf8, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0] | |
[None] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8-bit DAC Feedback command for DAC0 | |
Controls DAC0 in 8-bit mode. | |
Value: 0-255 | |
>>> import u3 | |
>>> d = u3.U3() | |
>>> d.debug = True | |
>>> d.getFeedback(u3.DAC0_8(Value = 0x33)) | |
Sent: [0x50, 0xf8, 0x2, 0x0, 0x55, 0x0, 0x0, 0x22, 0x33, 0x0] | |
Response: [0xfa, 0xf8, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0] | |
[None] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16-bit DAC Feedback command | |
Controls a single analog output | |
Dac: 0 or 1 | |
Value: 0-65535 | |
>>> import u3 | |
>>> d = u3.U3() | |
>>> d.debug = True | |
>>> d.getFeedback(u3.DAC16(Dac = 0, Value = 0x5566)) | |
Sent: [0xdc, 0xf8, 0x2, 0x0, 0xe1, 0x0, 0x0, 0x26, 0x66, 0x55] | |
Response: [0xfa, 0xf8, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0] | |
[None] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16-bit DAC Feedback command for DAC1 | |
Controls DAC1 in 16-bit mode. | |
Value: 0-65535 | |
>>> import u3 | |
>>> d = u3.U3() | |
>>> d.debug = True | |
>>> d.getFeedback(u3.DAC1_16(Value = 0x2233)) | |
Sent: [0x77, 0xf8, 0x2, 0x0, 0x7c, 0x0, 0x0, 0x27, 0x33, 0x22] | |
Response: [0xfa, 0xf8, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0] | |
[None] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8-bit DAC Feedback command for DAC1 | |
Controls DAC1 in 8-bit mode. | |
Value: 0-255 | |
>>> import u3 | |
>>> d = u3.U3() | |
>>> d.debug = True | |
>>> d.getFeedback(u3.DAC1_8(Value = 0x22)) | |
Sent: [0x40, 0xf8, 0x2, 0x0, 0x45, 0x0, 0x0, 0x23, 0x22, 0x0] | |
Response: [0xfa, 0xf8, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0] | |
[None] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8-bit DAC Feedback command | |
Controls a single analog output | |
Dac: 0 or 1 | |
Value: 0-255 | |
>>> import u3 | |
>>> d = u3.U3() | |
>>> d.debug = True | |
>>> d.getFeedback(u3.DAC8(Dac = 0, Value = 0x55)) | |
Sent: [0x72, 0xf8, 0x2, 0x0, 0x77, 0x0, 0x0, 0x22, 0x55, 0x0] | |
Response: [0xfa, 0xf8, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0] | |
[None] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The FeedbackCommand class is the base for all the Feedback commands. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LED Toggle | |
specify whether the LED should be on or off by truth value | |
1 or True = On, 0 or False = Off | |
>>> import u3 | |
>>> d = u3.U3() | |
>>> d.debug = True | |
>>> d.getFeedback(u3.LED(State = False)) | |
Sent: [0x4, 0xf8, 0x2, 0x0, 0x9, 0x0, 0x0, 0x9, 0x0, 0x0] | |
Response: [0xfa, 0xf8, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0] | |
[None] | |
>>> d.getFeedback(u3.LED(State = True)) | |
Sent: [0x5, 0xf8, 0x2, 0x0, 0xa, 0x0, 0x0, 0x9, 0x1, 0x0] | |
Response: [0xfa, 0xf8, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0] | |
[None] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PortDirRead Feedback command | |
Reads the direction of all digital I/O. | |
>>> import u3 | |
>>> d = u3.U3() | |
>>> d.debug = True | |
>>> d.getFeedback(u3.PortDirRead()) | |
Sent: [0x16, 0xf8, 0x1, 0x0, 0x1c, 0x0, 0x0, 0x1c] | |
Response: [0xfb, 0xf8, 0x3, 0x0, 0xfe, 0x1, 0x0, 0x0, 0x0, 0xf0, 0xff, 0xf] | |
[{'CIO': 15, 'FIO': 240, 'EIO': 255}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PortDirWrite Feedback command | |
Direction: A list of 3 bytes representing FIO, EIO, CIO | |
WriteMask: A list of 3 bytes, representing which to update. Default is all ones. | |
>>> import u3 | |
>>> d = u3.U3() | |
>>> d.debug = True | |
>>> d.getFeedback(u3.PortDirWrite(Direction = [0xaa, 0xcc, 0xff], WriteMask = [0xff, 0xff, 0xff])) | |
Sent: [0x91, 0xf8, 0x4, 0x0, 0x8f, 0x5, 0x0, 0x1d, 0xff, 0xff, 0xff, 0xaa, 0xcc, 0xff] | |
Response: [0xfa, 0xf8, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0] | |
[None] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PortStateRead Feedback command | |
Reads the state of all digital I/O. | |
>>> import u3 | |
>>> d = u3.U3() | |
>>> d.debug = True | |
>>> d.getFeedback(u3.PortStateRead()) | |
Sent: [0x14, 0xf8, 0x1, 0x0, 0x1a, 0x0, 0x0, 0x1a] | |
Response: [0xeb, 0xf8, 0x3, 0x0, 0xee, 0x1, 0x0, 0x0, 0x0, 0xe0, 0xff, 0xf] | |
[{'CIO': 15, 'FIO': 224, 'EIO': 255}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PortStateWrite Feedback command | |
State: A list of 3 bytes representing FIO, EIO, CIO | |
WriteMask: A list of 3 bytes, representing which to update. | |
The Default is all ones. | |
>>> import u3 | |
>>> d = u3.U3() | |
>>> d.debug = True | |
>>> d.getFeedback(u3.PortStateWrite(State = [0xab, 0xcd, 0xef], WriteMask = [0xff, 0xff, 0xff])) | |
Sent: [0x81, 0xf8, 0x4, 0x0, 0x7f, 0x5, 0x0, 0x1b, 0xff, 0xff, 0xff, 0xab, 0xcd, 0xef] | |
Response: [0xfa, 0xf8, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0] | |
[None] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
For reading Quadrature input timers. They are special because their values | |
are signed. | |
(Section 2.9.1.8 of the User's Guide) | |
Args: | |
UpdateReset: Set True if you want to reset the counter. | |
Value: Set to 0, and UpdateReset to True to reset the counter. | |
Returns a signed integer. | |
>>> import u3 | |
>>> d = u3.U3() | |
>>> d.debug = True | |
>>> d.configIO(NumberOfTimersEnabled = 2) | |
Sent: [0x4a, 0xf8, 0x3, 0xb, 0x43, 0x0, 0x1, 0x0, 0x42, 0x0, 0x0, 0x0] | |
Response: [0x58, 0xf8, 0x3, 0xb, 0x51, 0x0, 0x0, 0x0, 0x42, 0x0, 0xf, 0x0] | |
{'NumberOfTimersEnabled': 2, 'TimerCounterPinOffset': 4, 'DAC1Enable': 0, 'FIOAnalog': 15, 'EIOAnalog': 0, 'TimerCounterConfig': 66, 'EnableCounter1': False, 'EnableCounter0': False} | |
>>> # Setup the two timers to be quadrature | |
>>> d.getFeedback(u3.Timer0Config(8), u3.Timer1Config(8)) | |
Sent: [0x66, 0xf8, 0x5, 0x0, 0x68, 0x0, 0x0, 0x2b, 0x8, 0x0, 0x0, 0x2d, 0x8, 0x0, 0x0, 0x0] | |
Response: [0xfa, 0xf8, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0] | |
[None, None] | |
>>> # Read the value | |
[0] | |
>>> d.getFeedback(u3.QuadratureInputTimer()) | |
Sent: [0x26, 0xf8, 0x3, 0x0, 0x2a, 0x0, 0x0, 0x2a, 0x0, 0x0, 0x0, 0x0] | |
Response: [0xf5, 0xf8, 0x4, 0x0, 0xf5, 0x3, 0x0, 0x0, 0x0, 0xf8, 0xff, 0xff, 0xff, 0x0] | |
[-8] | |
>>> d.getFeedback(u3.QuadratureInputTimer()) | |
Sent: [0x26, 0xf8, 0x3, 0x0, 0x2a, 0x0, 0x0, 0x2a, 0x0, 0x0, 0x0, 0x0] | |
Response: [0x9, 0xf8, 0x4, 0x0, 0xc, 0x0, 0x0, 0x0, 0x0, 0xc, 0x0, 0x0, 0x0, 0x0] | |
[12] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
For reading the value of the Timer. It provides the ability to update/reset | |
a given timer, and read the timer value. | |
(Section 5.2.5.14 of the User's Guide) | |
timer: Either 0 or 1 for timer 0 or timer 1 | |
UpdateReset: Set True if you want to update the value | |
Value: Only updated if the UpdateReset bit is 1. The meaning of this | |
parameter varies with the timer mode. | |
Mode: Set to the timer mode to handle any special processing. See classes | |
QuadratureInputTimer and TimerStopInput1. | |
Returns an unsigned integer of the timer value, unless Mode has been | |
specified and there are special return values. See Section 2.9.1 for | |
expected return values. | |
>>> import u3 | |
>>> d = u3.U3() | |
>>> d.debug = True | |
>>> d.configIO(NumberOfTimersEnabled = 1) | |
Sent: [0x49, 0xf8, 0x3, 0xb, 0x42, 0x0, 0x1, 0x0, 0x41, 0x0, 0x0, 0x0] | |
Response: [0x57, 0xf8, 0x3, 0xb, 0x50, 0x0, 0x0, 0x0, 0x41, 0x0, 0xf, 0x0] | |
{'NumberOfTimersEnabled': 1, 'TimerCounterPinOffset': 4, 'DAC1Enable': 0, 'FIOAnalog': 15, 'EIOAnalog': 0, 'TimerCounterConfig': 65, 'EnableCounter1': False, 'EnableCounter0': False} | |
>>> d.getFeedback(u3.Timer(timer = 0, UpdateReset = False, Value = 0, Mode = None)) | |
Sent: [0x26, 0xf8, 0x3, 0x0, 0x2a, 0x0, 0x0, 0x2a, 0x0, 0x0, 0x0, 0x0] | |
Response: [0xfc, 0xf8, 0x4, 0x0, 0xfe, 0x1, 0x0, 0x0, 0x0, 0x63, 0xdd, 0x4c, 0x72, 0x0] | |
[1917640035] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
For reading the value of the Timer0. It provides the ability to | |
update/reset Timer0, and read the timer value. | |
(Section 5.2.5.14 of the User's Guide) | |
UpdateReset: Set True if you want to update the value | |
Value: Only updated if the UpdateReset bit is 1. The meaning of this | |
parameter varies with the timer mode. | |
Mode: Set to the timer mode to handle any special processing. See classes | |
QuadratureInputTimer and TimerStopInput1. | |
>>> import u3 | |
>>> d = u3.U3() | |
>>> d.debug = True | |
>>> d.configIO(NumberOfTimersEnabled = 1) | |
Sent: [0x49, 0xf8, 0x3, 0xb, 0x42, 0x0, 0x1, 0x0, 0x41, 0x0, 0x0, 0x0] | |
Response: [0x57, 0xf8, 0x3, 0xb, 0x50, 0x0, 0x0, 0x0, 0x41, 0x0, 0xf, 0x0] | |
{'NumberOfTimersEnabled': 1, 'TimerCounterPinOffset': 4, 'DAC1Enable': 0, 'FIOAnalog': 15, 'EIOAnalog': 0, 'TimerCounterConfig': 65, 'EnableCounter1': False, 'EnableCounter0': False} | |
>>> d.getFeedback(u3.Timer0(UpdateReset = False, Value = 0, Mode = None)) | |
Sent: [0x26, 0xf8, 0x3, 0x0, 0x2a, 0x0, 0x0, 0x2a, 0x0, 0x0, 0x0, 0x0] | |
Response: [0x51, 0xf8, 0x4, 0x0, 0x52, 0x2, 0x0, 0x0, 0x0, 0xf6, 0x90, 0x46, 0x86, 0x0] | |
[2252771574] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This IOType configures Timer0. | |
TimerMode = See Section 2.9 for more information about the available modes. | |
Value = The meaning of this parameter varies with the timer mode. | |
>>> import u3 | |
>>> d = u3.U3() | |
>>> d.debug = True | |
>>> d.configIO(NumberOfTimersEnabled = 1) | |
Sent: [0x49, 0xf8, 0x3, 0xb, 0x42, 0x0, 0x1, 0x0, 0x41, 0x0, 0x0, 0x0] | |
Response: [0x57, 0xf8, 0x3, 0xb, 0x50, 0x0, 0x0, 0x0, 0x41, 0x0, 0xf, 0x0] | |
{'NumberOfTimersEnabled': 1, 'TimerCounterPinOffset': 4, 'DAC1Enable': 0, 'FIOAnalog': 15, 'EIOAnalog': 0, 'TimerCounterConfig': 65, 'EnableCounter1': False, 'EnableCounter0': False} | |
>>> d.getFeedback(u3.Timer0Config(TimerMode = 1, Value = 0)) | |
Sent: [0x28, 0xf8, 0x3, 0x0, 0x2c, 0x0, 0x0, 0x2b, 0x1, 0x0, 0x0, 0x0] | |
Response: [0xfa, 0xf8, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0] | |
[None] | |
>>> d.getFeedback(u3.Timer0Config(TimerMode = 1, Value = 65535)) | |
Sent: [0x28, 0xf8, 0x3, 0x0, 0x2a, 0x2, 0x0, 0x2b, 0x1, 0xff, 0xff, 0x0] | |
Response: [0xfa, 0xf8, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0] | |
[None] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
For reading the value of the Timer1. It provides the ability to | |
update/reset Timer1, and read the timer value. | |
(Section 5.2.5.14 of the User's Guide) | |
UpdateReset: Set True if you want to update the value | |
Value: Only updated if the UpdateReset bit is 1. The meaning of this | |
parameter varies with the timer mode. | |
Mode: Set to the timer mode to handle any special processing. See classes | |
QuadratureInputTimer and TimerStopInput1. | |
>>> import u3 | |
>>> d = u3.U3() | |
>>> d.debug = True | |
>>> d.configIO(NumberOfTimersEnabled = 2) | |
Sent: [0x4a, 0xf8, 0x3, 0xb, 0x43, 0x0, 0x1, 0x0, 0x42, 0x0, 0x0, 0x0] | |
Response: [0x58, 0xf8, 0x3, 0xb, 0x51, 0x0, 0x0, 0x0, 0x42, 0x0, 0xf, 0x0] | |
{'NumberOfTimersEnabled': 2, 'TimerCounterPinOffset': 4, 'DAC1Enable': 0, 'FIOAnalog': 15, 'EIOAnalog': 0, 'TimerCounterConfig': 66, 'EnableCounter1': False, 'EnableCounter0': False} | |
>>> d.getFeedback(u3.Timer1(UpdateReset = False, Value = 0, Mode = None)) | |
Sent: [0x28, 0xf8, 0x3, 0x0, 0x2c, 0x0, 0x0, 0x2c, 0x0, 0x0, 0x0, 0x0] | |
Response: [0x8d, 0xf8, 0x4, 0x0, 0x8e, 0x2, 0x0, 0x0, 0x0, 0xf3, 0x31, 0xd0, 0x9a, 0x0] | |
[2597335539] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This IOType configures Timer1. | |
TimerMode = See Section 2.9 for more information about the available modes. | |
Value = The meaning of this parameter varies with the timer mode. | |
>>> import u3 | |
>>> d = u3.U3() | |
>>> d.debug = True | |
>>> d.configIO(NumberOfTimersEnabled = 2) | |
Sent: [0x4a, 0xf8, 0x3, 0xb, 0x43, 0x0, 0x1, 0x0, 0x42, 0x0, 0x0, 0x0] | |
Response: [0x58, 0xf8, 0x3, 0xb, 0x51, 0x0, 0x0, 0x0, 0x42, 0x0, 0xf, 0x0] | |
{'NumberOfTimersEnabled': 2, 'TimerCounterPinOffset': 4, 'DAC1Enable': 0, 'FIOAnalog': 15, 'EIOAnalog': 0, 'TimerCounterConfig': 66, 'EnableCounter1': False, 'EnableCounter0': False} | |
>>> d.getFeedback(u3.Timer1Config(TimerMode = 6, Value = 1)) | |
Sent: [0x30, 0xf8, 0x3, 0x0, 0x34, 0x0, 0x0, 0x2d, 0x6, 0x1, 0x0, 0x0] | |
Response: [0xfa, 0xf8, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0] | |
[None] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This IOType configures a particular timer. | |
timer = # of the timer to configure | |
TimerMode = See Section 2.9 for more information about the available modes. | |
Value = The meaning of this parameter varies with the timer mode. | |
>>> import u3 | |
>>> d = u3.U3() | |
>>> d.debug = True | |
>>> d.configIO(NumberOfTimersEnabled = 1) | |
Sent: [0x49, 0xf8, 0x3, 0xb, 0x42, 0x0, 0x1, 0x0, 0x41, 0x0, 0x0, 0x0] | |
Response: [0x57, 0xf8, 0x3, 0xb, 0x50, 0x0, 0x0, 0x0, 0x41, 0x0, 0xf, 0x0] | |
{'NumberOfTimersEnabled': 1, 'TimerCounterPinOffset': 4, 'DAC1Enable': 0, 'FIOAnalog': 15, 'EIOAnalog': 0, 'TimerCounterConfig': 65, 'EnableCounter1': False, 'EnableCounter0': False} | |
>>> d.getFeedback(u3.TimerConfig(timer = 0, TimerMode = 0, Value = 0)) | |
Sent: [0x27, 0xf8, 0x3, 0x0, 0x2b, 0x0, 0x0, 0x2b, 0x0, 0x0, 0x0, 0x0] | |
Response: [0xfa, 0xf8, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0] | |
[None] | |
>>> d.getFeedback(u3.TimerConfig(timer = 0, TimerMode = 0, Value = 65535)) | |
Sent: [0x27, 0xf8, 0x3, 0x0, 0x29, 0x2, 0x0, 0x2b, 0x0, 0xff, 0xff, 0x0] | |
Response: [0xfa, 0xf8, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0] | |
[None] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
For reading a stop input timer. They are special because the value returns | |
the current edge count and the stop value. | |
(Section 2.9.1.9 of the User's Guide) | |
Args: | |
UpdateReset: Set True if you want to update the value. | |
Value: The stop value. Only updated if the UpdateReset bit is 1. | |
Returns a tuple where the first value is current edge count, and the second | |
value is the stop value. | |
>>> import u3 | |
>>> d = u3.U3() | |
>>> d.debug = True | |
>>> d.configIO(NumberOfTimersEnabled = 2) | |
Sent: [0x4a, 0xf8, 0x3, 0xb, 0x43, 0x0, 0x1, 0x0, 0x42, 0x0, 0x0, 0x0] | |
Response: [0x58, 0xf8, 0x3, 0xb, 0x51, 0x0, 0x0, 0x0, 0x42, 0x0, 0xf, 0x0] | |
{'NumberOfTimersEnabled': 2, 'TimerCounterPinOffset': 4, 'DAC1Enable': 0, 'FIOAnalog': 15, 'EIOAnalog': 0, 'TimerCounterConfig': 66, 'EnableCounter1': False, 'EnableCounter0': False} | |
>>> # Setup the timer to be Stop Input | |
>>> d.getFeedback(u3.Timer1Config(9, Value = 30)) | |
Sent: [0x50, 0xf8, 0x3, 0x0, 0x54, 0x0, 0x0, 0x2d, 0x9, 0x1e, 0x0, 0x0] | |
Response: [0xfa, 0xf8, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0] | |
[None] | |
>>> d.getFeedback(u3.TimerStopInput1()) | |
Sent: [0x28, 0xf8, 0x3, 0x0, 0x2c, 0x0, 0x0, 0x2c, 0x0, 0x0, 0x0, 0x0] | |
Response: [0x1b, 0xf8, 0x4, 0x0, 0x1e, 0x0, 0x0, 0x0, 0x0, 0x1e, 0x0, 0x0, 0x0, 0x0] | |
[(0, 0)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WaitLong Feedback command | |
specify the number of 32ms time increments to wait | |
>>> import u3 | |
>>> d = u3.U3() | |
>>> d.debug = True | |
>>> d.getFeedback(u3.WaitLong(Time = 70)) | |
Sent: [0x47, 0xf8, 0x2, 0x0, 0x4c, 0x0, 0x0, 0x6, 0x46, 0x0] | |
Response: [0xfa, 0xf8, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0] | |
[None] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WaitShort Feedback command | |
specify the number of 128us time increments to wait | |
>>> import u3 | |
>>> d = u3.U3() | |
>>> d.debug = True | |
>>> d.getFeedback(u3.WaitShort(Time = 9)) | |
Sent: [0x9, 0xf8, 0x2, 0x0, 0xe, 0x0, 0x0, 0x5, 0x9, 0x0] | |
Response: [0xfa, 0xf8, 0x2, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0] | |
[None] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment