Digital IO Commands

These commands are for control and monitoring of all Digital I/O devices (including built in TTL capabilities on all Hardware Systems) that can be recognized by __prod_name.

Device Name

All device names are automatically generated by __prod_name when the DigitalIO board is detected.   They are used to identify the TTL I/O board throughout
the system.

The name for add-on Digital I/O devices is constructed as follows: 

DeviceType_BoardNumber

Example: A Measurement Computing DIO24 device assigned to board 3 will be PCI-DIO24_3.

TTL boards for Hardware Systems are constructed using the acquisition system name instead of the device type:

AcquisitionSystemName_BoardNumber

See the Hardware Systems section for more information on the TTL IO capabilities of your system.

The NetCom command -GetDigitalIOBoardList will return a complete list of the device names installed on your system.

Port Numbers

Most TTL devices divide their total number of I/O bits into groups called ports.  These groups allow you to section of the bits of the card for separate uses.
One typical use is dividing the board into separate input and output ports, allowing bi-directional TTL with only a single TTL device.  Values for ports can
also be read and written independently of other ports on the same device.

The number of ports available is dependent on the TTL I/O device you are using.  For a list of the TTL capabilities of your device, see the Hardware Systems
section of this guide.


 -DigitalIOTtlPulse <Device Name> <Port Number> <Bit Number> <Pulse Type>
Performs a TTL pulse on the specified bit on the specified port.  The length of the pulse is set by the - SetDigitalIOPulseDuration command.

Example :  -DigitalIOTtlPulse AcqSystem1_0 0 6 High
Default:
 __prod_name defaults to pulse type high for TTL pulses.
Usage:  This command can be used at any time.
Arguments
Device Name The name of the device which is to be modified.
Port Number
The number of the port that contains the bit you wish to pulse.
Bit Number The bit number to be pulsed.  The number of bits available is dependent upon the device being used.  Bit numbers are 0 based.
State
The pulse type to execute.  This value must be one of the following:
  1. Low : The pulse will go from high to low and back to high as shown in the below image:

  1. High: The pulse will got from low to high and back to low as shown in the below image:

  -GetDigitalIOBitsPerPort <Device Name>
Returns the size of all DigitalIO ports on the device.

Example :   -GetDigitalIOBitsPerPort
Default:  N/A
Usage:  This command should only be used from a NetCom client application after a connection to a server has been established.
Arguments
Device Name The name of the device whose data is being requested.
NetCom Reply
Error Code
If the command is successful, this value will be equal to 0.  Otherwise, the value will be equal to -1.
Value The number of bits in each port of the device.

  -GetDigitalIOBoardList
Returns a list of all DigitalIO boards on this system.

Example :   -GetDigitalIOBoardList
Default:  N/A
Usage:  This command should only be used from a NetCom client application after a connection to a server has been established.
NetCom Reply
Error Code
If the command is successful, this value will be equal to 0.  Otherwise, the value will be equal to -1.
Value A space separated list of the names of all TTL input and output boards installed on this system.

 -GetDigitalIOEventsEnabled <Device Name> <Port Number>
Returns the current state of event generation for a TTL port.

Example :   -GetDigitalIOEventsEnabled AcqSystem1_2 3
Default:  N/A
Usage:  This command should only be used from a NetCom client application after a connection to a server has been established.
Arguments
Device Name The name of the device whose data is being requested.
Port Number The port number for which the data is being requested.
NetCom Reply
Error Code
If the command is successful, this value will be equal to 0.  Otherwise, the value will be equal to -1.
Value This must be one of the following values:
  1. True - An event is created whenever a TTL port value change is detected .
  2. False - An event is not created whenever a TTL port value is detected.

 -GetDigitalIOPortString <Device Name> <Port Number>
Returns the current state of each of the bits for the specified port number on the specified device in a single string.  This string is in binary numerical format with bit 0 being the rightmost character in the string.

Example :   -GetDigitalIOPortString AcqSystem1_1 3
Default:  N/A
Usage:  This command should only be used from a NetCom client application after a connection to a server has been established.
Arguments
Device Name The name of the device whose data is being requested.
Port Number The port number for which the data is being requested.
NetCom Reply
Error Code
If the command is successful, this value will be equal to 0.  Otherwise, the value will be equal to -1.
Value The current state of each of the bits for the specified port number on the specified device in a single string.  This string is in binary numerical format with bit 0 being the rightmost character in the string.  The state of each bit is represented by a single character:
  1. 0 : The bit is currently set to off.
  2. 1: The bit is currently set to on.

Example: If "00000100" is returned, it means that ll bits are off except for bit 2.

 -GetDigitalIOPortValue <Device Name> <Port Number>
Returns the decimal equivalent of the TTL value for the port number of the specified device.

Example :   -GetDigitalIOPortValue PCI-DIO24_0 3
Default:  N/A
Usage:  This command should only be used from a NetCom client application after a connection to a server has been established.
Arguments
Device Name The name of the device whose data is being requested.
Port Number The port number for which the data is being requested.
NetCom Reply
Error Code
If the command is successful, this value will be equal to 0.  Otherwise, the value will be equal to -1.
Value The current value for the specified port number in decimal form.

 -GetDigitalIOPulseDuration <Device Name> <Port Number>
Retrieves the current pulse duration for the specified TTL port.

Example :   -GetDigitalIOPulseDuration PCI-DIO24_0 3
Default:  N/A
Usage:  This command should only be used from a NetCom client application after a connection to a server has been established.
Arguments
Device Name The name of the device whose data is being requested.
Port Number The port number for which the data is being requested.
NetCom Reply
Error Code
If the command is successful, this value will be equal to 0.  Otherwise, the value will be equal to -1.
Duration This is the duration used for the TTL pulse in ms.

 -GetDigitalIOUseStrobeBit <Device Name> <port number>
Gets the current strobe bit enabled state for the port on the specified device.

Example :   -GetDigitalIOUseStrobeBit PCI-DIO24_0 0
Default: N/A
Usage:  This command should only be used from a NetCom client application after a connection to a server has been established.
Arguments
Device Name
The name of the device which will be queried.
Port Number Specifies the TTL port you wish to query.
NetCom Reply
Error Code
If the command is successful, this value will be equal to 0.  Otherwise, the value will be equal to -1.
Value The current strobe bit enabled state for the port on the specified device.

 -SetDigitalIOBit <Device Name> <Port Number> <Bit Number> <State>
Sets the state for the specified bit number.

Example :  -SetDigitalIOBit PCI-DIO24_0 0 7 On
Default:
 N\A
Usage:  This command can be used at any time.
Arguments
Device Name The name of the device which is to be modified.
Port Number
The port number that contains the bit you wish to set.
Bit Number The bit number to be modified.  The number of bits available is dependent upon the device being used.  Bit numbers are 0 based.
State
The state to set the specified bit value to.  This value must be one of the following:
  1. On : The bit will be set to on (logical 1).
  2. Off: The bit will be set to off (logical 0).

 -SetDigitalIOBitsPerPort <Device Name> <Port Bit Count>
Sets the size of each port on the device to the specified bit count.

NOTE Depending on your particular hardware, the options for setting port sizes may vary. See documentation for the hardware system for more details.

Example :  -SetDigitalIOBits AcqSystem1 16
Default:
 N\A
Usage:  This command can be used at any time.
Arguments
Device Name The name of the device which is to be modified.
Port Bit Count
The port size in bits you wish to set.

 -SetDigitalIOEventsEnabled <Device Name> <Port Number> <Enabled>
Set events enabled for the specified port.  An event record will be generated anytime there is a change in value for that port

Example :  -SetDigitalIOEventsEnabled AcqSystem1_0 1 true
Default:  __prod_name defaults event enabled to be true; meaning events are generated for every TTL port value change.
Usage:  This command can be used at any time.
Arguments
Device Name The name of the device which is to be modified.
Port Number The port number to be modified.
Enabled This must be one of the following values:
  1. True An event is created whenever a TTL port value change is detected.
  2. False : An event is not created whenever a TTL port value is detected.
NOTE:  If -SetDigitalIOUseStrobeBit is enabled, input events are only generated when the strobe bit is used, not on every port value change.

 -SetDigitalIOInputScanDelay <Device Name> <Delay>
Sets the delay in between scans when reading the input port(s).  This command is not available for all Digital IO devices.  Digital IO devices that are part of Hardware Systems are scanned at the sample frequency of the Hardware System.

Example :  -SetDigitalIOInputScanDelay PCI-DIO24_0 5
Default:  __prod_name defaults the input delay to a value of  1 ms for all non-Hardware System Digital IO devices.
Usage:  This command can be used at any time.
Arguments
Device Name The name of the device which is to be modified.
Delay This is the delay used in between reading the input ports for the specified device.  The delay must be between 1 and 10000 ms.

 - SetDigitalIOPortDirection <Device Name> <Port Number> <Direction>
Sets the direction for the specified port number.  The number of ports is determined by the hardware device.  Port direction is independent for each port of a device.  The direction of a port determines what commands may be used on that port, as many of the commands are direction specific.  Not all ports are bidirectional, see the Hardware Systems section of this guide for more information on your specific hardware.  This command will fail if the port direction cannot be changed because it is use for some other purpose in __prod_name (e.g. Spike TTL Response ).

NOTE Depending on your particular TTL hardware, changing the port direction to input may clear the values currently on other output ports on the same device.  This behavior is not controlled by __prod_name.  To avoid unwanted value clearing, it is best to set ports to the proper direction before beginning any experiments.

Example :  -SetDigitalIOPortDirection PCI-DIO24_0 1 Input
Default:  __prod_name defaults the port direction to Input for all ports once an interface has been created.
Usage:  This command can be used at any time.
Arguments
Device Name The name of the device which is to be modified.
Port Number The port number to be modified.
Direction
The direction of the port.  This must be one of the following values:
  1. Input : Sets the port direction for reading voltage values.
  2. Output : Sets the port direction for setting voltage values.

 -SetDigitalIOPortString <Device Name> <Port Number> <Value>
Sets the state for each of the bits for the specified port number on the specified device in a single string.  This string is in binary numerical format with bit 0 being the rightmost character in the string.

Example :  -SetDigitalIOPortString PCI-DIO24_0 4 "0100XXXX"
Default:  N\A
Usage:  This command can be used at any time.
Arguments
Device Name The name of the device which is to be modified.
Port Number The port number to be modified.
Value The state to set for each the bits for the specified port number on the specified device in a single string.  This string is in binary numerical format with bit 0 being the rightmost character in the string.  The maximum string length is determined by the number of bits associated with the port number you wish to write.  If the string is longer than the number of bits in the port, the extra characters will be ignored.   If the string is shorter than the number of bits in the port,  the remainder of the bits will be ignored.  Each character must be one of the following:
  1. 0 : The bit will be set to off.
  2. 1: The bit will be set to on.
  3. X : The bit will be ignored.

Example:   The following sequence of strings represent the value used in consecutive calls to this command. The output port state is shown after each command is processed.  It is assumed that the port being used has only 8 bits.

Value Output Port
"00000000" 00000000
"00000011" 00000011
"000001X0" 00000110
"0X" 00000100
"1100000011" 00000011


 -SetDigitalIOPortValue <Device Name> <Port Number> <Value>
Sets the value for the specified port number.  This command is most often used to set the state of multiple bits at the same time.

Example :  -SetDigitalIOPortValue AcqSystem1_0 4 16
Default:  N\A
Usage:  This command can be used at any time.
Arguments
Device Name The name of the device which is to be modified.
Port Number The port number to be modified.
Value This value will be set as the current output for the specified port number.  The value is in decimal numerical format.

 - SetDigitalIOPulseDuration <Device Name> <Port Number> <Duration>
Sets the duration of a TTL pulse generated by the -DigitalIOTTLPulse command. 

Example :  -SetDigitalIOPulseDuration PCI-DIO24_0 0 200
Default:  __prod_name defaults the pulse duration to a value of  15 m s.
Usage:
 This command can be used at any time.
Arguments
Device Name The name of the device which is to be modified.
Port Number
Specifies the TTL port whose pulse duration is to be set.
Duration This is the duration used for the TTL pulse.  The duration must be between 1 and 10000 ms.

Example:  Assume the TTL pulse duration is set to 10ms.  The command:

 -DigitalIOTTLPulse PCI-DIO24_0 0 2 High

will remain high (logical 1) for 10ms before returning to a low (logical 0) value as shown in the below image:



Note: __prod_name is capable of sending TTL pulses to a Digital IO device faster than the device can process the pulse.  You need to test your desired pulse duration with your hardware to ensure that the device will consistently deliver pulses.  This test will need to be run multiple times, as some boards will deliver a TTL pulse of a particular duration only occasionally.

 - SetDigitalIOUseStrobeBit <Device Name> <Port Number> <Value>
Sets the port on the specified device to require that the most significant bit (i.e. bit 7 of an 8 bit port, bit 15 of a 16 bit port, etc) be strobed from low to high in order to generate a TTL event.  This means that __prod_name will only generate TTL input events when the most significant bit of the TTL input port is strobed.

Example :   -SetDigitalIOUseStrobeBit PCI-DIO24_0 true
Default: Strobe bit usage is normally False.
Usage:  This command can be used at any time.
Arguments
Device Name
The name of the device which will be modified.
Port Number Specifies the TTL port on which input strobing will be enabled.
Value This can be one of the following:
  1. True:  A value of true will cause __prod_name to only read TTL input ports when the most significant bit is strobed from low to high.  The table below shows a sequence of changes on the TTL port along with the values read by __prod_name after each change.  Changes are shown in bold .
TTL Port Value
Value Read by __prod_name
Notes
00000000
None
Starting value
000 1 0000
None
Nothing is read until the MSB (bit 7) goes high.
0001000 1
None
Nothing is read until the MSB (bit 7) goes high.
1 0010001
10010001
The MSB goes from low to high, this is a strobe.  The entire port value is now read by __prod_name.
100 0 0001
None
The MSB has not changed so nothing is read.
0 0000001
None
The strobe only is registered when the MSB goes from low to high.   Nothing happens on a high to low transition.  This is considered a reset to get ready for the next strobe.
1 0000001
10000001
The MSB goes from low to high and the entire port value is read.

  1. False:  A value of false will cause __prod_name to read the TTL input port when any bit is turned either on or off.  Here is the same sequence shown above with strobe bit usage set to false.
TTL Port Value
Value Read by __prod_name
00000000
00000000
000 1 0000
00010000
0001000 1
00010001
1 0010001
10010001
100 0 0001
10000001
0 0000001
00000001
1 0000001
10000001