![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
6.15 DIO Functions
Modules for the following DIOs exist:
-
witio_48 Wasco WITIO-48 ISA DIO card by Messcomp Datentechnik GmbH
-
me_dio_X DIO subsystem of cards by Meilhaus Electronic GmbH
To use a module in an experiment put its name into the DEVICES
section of the EDL script.
Both cards reqyuire the use of of a kernel module and an additional
library that have been successfully installed. The driver and library
for the Wasco WITIO-48 card comes with fsc2,
the one for the ones for the Meihaus cards can be downloaded from the
Meilhaus web site.
List of DIO functions:
Since the cards differ quite a bit in their capabilities the arguments required to be passed to the functions also can be different!
Descriptions of DIO functions:
- `dio_name()'
Returns a string with the name of the DIO device being used.
- `dio_reserve_dio()'
This function can be used to reserve (or un-reserve) a DIO so that it can only be used with a pass-phrase. This will mainly be used by modules for other devices that require a DIO to keep an
EDLscript from accdentally changing the output or reading the input of the DIO.In the case of the Wasco Wasco WITIO-48 card the first argument is the DIO to be reserved (or released). This must be either a number,
1or2or, better, a symbolic name,DIO1orDIO2. For the Meilhaus DIO subsystem the whole subsystem gets locked or unlocked, so no DIO number can be passed to the function.If there is no further argument an integer is returned. If it is
1the DIO or subsystem is reserved, if it's0it's not reserved and can be used without a pass-phrase.The next argument is a string variable to be used as the pass-phrase in later calls of the functions dio_mode() and dio_value().
The final argument is optional. If is not given the function will try to reserve the DIO or subsystem. If called with either an argument of
0or a string"OFF"the DIO or subsystem is released so that it can be freely used again. If called with either an argument of1or a string"ON"the DIO or subsystem is reserved (which is identical to not passing it this argument).The function returns an integer, if it is
1the operation (i.e. reserving or releasing the DIO or subsystem) succeeded, if it is0the operation failed.- `dio_mode()'
The Wasco WITIO-48 card has two DIO chips, both allowing 24 bit wide input and output. These DIOs can be further split up into sub-DIOs of smaller width. By calling this function you can set the way a DIO is split up.
In contrast, the Meilhaus card DIO subsystem has a single 32-bit wide DIO which can be split up into either 32 1-bit wide DIO channels, 4 8-bit wide channels, 2 16-bit wide channels or 1 32-wide channel.
For the Wasco WITIO 48 card the function expects at least one argument, the DIO to be used with the function. This must be either a number,
1or2or, better, a symbolic name,DIO1orDIO2. When called without another argument the current mode is returned as an integer number (as they could also be specified to set a mode, see below). If there is a second argument this is the mode to be set. You can use either a number or a string to specify the new mode:- `
0or"3x8"' The DIO is split up into three independent 8-bit DIOs, which then can be addressed as channels in calls of the function dio_value().
- `
1or"2x12"' The DIO is split up into two independent 12-bit DIOs, which then can be addressed as channels in calls of the function dio_value().
- `
2or"1x24"' The DIO isn't split up at all but used as a 24-bit wide DIO.
- `
3or"16_8"' The DIO is split up into two independent DIOs, one with a width of 16 bit and one 8-bit wide. These can be addressed as channels in calls of the function dio_value().
If no mode is set for a DIO the mode for 24-bit input and output is used per default.
For a Meilhaus me6000 card DI, DO or DIO subsystem the only argment is optional. If none is given the current mode is returned as a number, either
1for the mode where 8 1-bit wide channels are used and8for the mode with 1 8-bit wide channel. If instead one of these numbers is passed to the function the corresponding mode is set (if available).- Please note:
If the DIO or subsystem had previously been reserved by a call of the function dio_reserve_dio() the pass-phrase specified in that call has to be passed to the function as the very first argument if you want to be able to change the mode of the DIO.
- `
- `dio_value()'
This function is used to either input or output a value. For the Wasco WITIO-48 card the first arguments must be the DIO to be used (preferably use the symbolic names
DIO1andDIO2). and a channel. For both modules the channels to be used must be specified. Depending on the mode the DIO has been set to using the function dio_mode(), for the Wasco WITIO-48 either one, two or three channels can be used, for the Meilhaus card DIO subsystem one, two, four or 32 can be available. Always use the symbolic namesCH1,CH2,CH3etc. If there is no further argument data will be read in from the DIO and passed back to theEDLscript as the return value of the function.If there's a third argument it is taken as the value to output at the DIO (or, to be precise, the channel of the DIO). How many channels can be used, what range of data can be output and how each bit the value is mapped to the output pins depends on the mode the DIO is been set to.
For the Wasco WITIO-48 card we have:
- `
"3x8"mode' Since in this mode there are three independent sub-DIOs, three channels,
CH1,CH2andCH3, can be used. Each channel is 8-bit wide, so the range of values that can be output (or input) is restricted to numbers between0and255.If the channel is
CH1the bits of the value are output at the pins of the connector labeled1PA7to1PA0forDIO1and at the pins2PA7to2PA0forDIO2, where the most significant bit goes to the highest numbered pin 7 and the least sigificant bit to the pin numbered 0. If a channel ofCH2has been selected the bits are mapped to the pins1PB7to1PB0or2PB7to2PB0and forCH3to the pins1PC7to1PC0or2PC7to2PC0.- `
"2x12"mode' In this mode the DIO is split into two 12-bit wide sub-DIOs, so only
CH1andCH2can be used to output a value between0and4096. ForCH1the topmost 4 bits of the value are mapped to the pins1PC7to1PC4or2PC7to2PC4(with the most sigificant bit at1PC7or2PC7) while the lower 8 bits go to the pins1PA7to1PA0or2PA7to2PA0(depending on the selected DIO). ForCH2the topmost 4 bits of the value appear at the pins1PC3to1PC0or2PC3to2PC0and the lower 8 bits are mapped to theB-pins,1PB7to1PB0or2PB7to2PB0.- `
"1x24"mode' The DIO isn't split into sub-DIOs, so the only allowed channel in this mode is
CH1and the range of valid values is0to16777215. The highest 8 bits of the value go to theC-pins (i.e.1PC7to1PC0forDIOor2PC7to2PC0forDIO2), the middle byte is mapped to theB-pins and the lowest byte of the value to theA-pins.- `
"16_8"mode' In this mode the DIO is split into a 16-bit and an 8-bit wide DIO.
CH1is the 16-bit DIO, allowing to output values between0and65535, andCH2is the 8-bit DIO, allowing a the value to be between0and255. ForCH1the upper byte of the value is mapped to theB-pins while the lower byte appears at theA-pins. TheC-pins are used to output the value forCH2.
For the Meilhaus me6000 card DIO subsystem we have:
- `1-bit mode'
In this mode the DI, DO or DIO is split up into 8 channels and for each channel only a value of
0and1can be set.- `8-bit mode'
In this mode the DI, DO or DIOO has a single channel, 8 bit wide. Values between
0and255can be used.Please note that a DI subsystem can only be used for input and a DO subsystem only for output. Also note that for a number of these cards only all 8 bits of a DIO subsystem can be switched between input and output together and not individually.
- Please note:
Except in the case of the Meilhaus card DIO subsystem in 32-bit mode trying to output a negative value will make the program abort immediately as will trying to output too large a value during the test run. During the experiment a too large value will be truncated to the allowed range by stripping off the higher order bits and a warning message is printed out.
- Also note:
if the DIO had previously been reserved by a call of the function dio_reserve_dio() the pass-phrase specified in that call has to be passed to the function as the very first argument if you want to be able to read from or write to the DIO.
The function can only be used in the
EXPERIMENTsection of anEDLscript.- `
![]() |
![]() |
![]() |
![]() |
![]() |
This document was generated by Jens Thoms Toerring on September 6, 2017 using texi2html 1.82.








