« Close

Datasheets and User Guides

App Notes

Software & Driver

 

5.2.3 - ConfigIO

Writes and reads the current IO configuration.

Table 5.2.3-1. ConfigIO Command Response

Command:    
Byte    
0 Checksum8  
1 0xF8  
2 0×03  
3 0×0B  
4 Checksum16 (LSB)  
5 Checksum16 (MSB)  
6 WriteMask  
    Bit 5: Write UART Related settings
    Bit 4: Reserved, Pass 0
    Bit 3: EIOAnalog
    Bit 2: FIOAnalog
    Bit 1: DAC1Enable
    Bit 0 : TimerCounterConfig
7 Reserved  
8 TimerCounterConfig  
    Bits 4-7: TimerCounterPinOffset
    Bit 3: Enable Counter1
    Bit 2: Enable Counter0
    Bits 0-1: Number of timers enabled
9 DAC1Enable (ignored on hardware rev 1.30+) 
    Bit 2: Assign UART Pins (HW 1.30 only)
    Bit 1: Reserved, Pass 0
    Bit 0: Enable DAC1
10 FIOAnalog  
11 EIOAnalog  
     
     
Response:    
Byte    
0 Checksum8  
1 0xF8  
2 0×03  
3 0×0B  
4 Checksum16 (LSB)  
5 Checksum16 (MSB)  
6 Errorcode  
7 Reserved  
8 TimerCounterConfig  
9 DAC1Enable  
10 FIOAnalog  
11 EIOAnalog  
  • WriteMask: Has bits that determine which, if any, of the parameters will be written.
  • TimerCounterConfig: Used to enable/disable timers and counters. Timers/counters will be assigned to IO pins starting with FIO0 plus TimerCounterPinOffset (4-8 only starting with hardware revision 1.30). Timer0 takes the first IO pin, then Timer1, Counter0, and Counter1. Whenever this function is called and timers are enabled, the timers are initialized to mode 10, so the desired timer mode must always be specified after every call to this function. Note that Counter0 is not available when using a timer clock base that supports a timer clock divisor (TimerClockBase = 3-6).
  • Assign UART Pins: On hardware 1.30 setting this bit will assign IO lines to the UART module. This setting will be ignored unless the UART write bit is set in the WriteMask byte.
  • DAC1Enable: On hardware revisions 1.20/1.21 only, bit 0 enables DAC1. When DAC1 is disabled, it outputs a constant voltage of 1.5 times the internal Vref (~2.44 volts). When DAC1 is enabled, the internal Vref is not available for the analog inputs and Vreg (~3.3 volts) is used as the AIN reference. Starting with hardware revision 1.30, DAC1 is always enabled.
  • FIOAnalog: Each bit determines whether that bit of FIO is analog input (=1) or digital I/O (=0).
  • EIOAnalog: Each bit determines whether that bit of EIO is analog input (=1) or digital I/O (=0).

LabJackPython Example

  
>>> import u3
>>> d = u3.U3()
>>> d.debug = True
'''Assign timer0 to FIO6, set FIO4, FIO5 as analog input, and set EIO1, EIO2 as analog input'''
>>> d.configIO(TimerCounterPinOffset = 6, NumberOfTimersEnabled = 1, FIOAnalog = 0x30, EIOAnalog = 0x03)
Sent:  [0xa8, 0xf8, 0x3, 0xb, 0xa1, 0x0, 0xd, 0x0, 0x61, 0x0, 0x30, 0x3]
Result:  [0x9b, 0xf8, 0x3, 0xb, 0x94, 0x0, 0x0, 0x0, 0x61, 0x0, 0x30, 0x3]
{'NumberOfTimersEnabled': 1, 'TimerCounterPinOffset': 6, 'DAC1Enable': 0, 'FIOAnalog': 48, 'EIOAnalog': 3, 'TimerCounterConfig': 97, 'EnableCounter1': False, 'EnableCounter0': False}
  

2 comments

Just a documentation suggestion.  The LabJackPython example would be easier to make sense of if the argument values were specified in hex, e.g. FIOAnalog = 0x30, instead of decimal.  No big deal, just makes for quicker understanding.

Cheers,

Mike

Thank you for your suggestion.  I agree that the FIOAnalog and EIOAnalog parameters would make more sense in hex since each bit represents a specific channel, but the other parameters in the example make sense in their decimal form.  I updated the example to reflect his.