124
M3i.48xx / M3i.48xx-exp Manual
Different functions
Option BaseXIO
Special Input Functions
Some of the BaseXIO lines can be used in special functions, which requires the respective of the above mentioned groups of four lines
(XIO3…XIO0) or (XIO4…XIO7) to be set as input. The upper group can be programmed to be either input or output, when only using the
timestamp reference option and thus only uses one input in the lower group:
• XIO0: no special function yet
• XIO1: no special function yet
• XIO2: RefClock for timestamp option
• XIO3: Count input for incremental counter1
• XIO4: Count input for incremental counter2
• XIO5: Reset input for incremental counter1
• XIO6: no special function yet
• XIO7: Reset input for incremental counter2
All of the above mentioned special features are explained in detail in the relating section of this manual. Because the incremental counter
also implies the RefClock usage (see timestamp chapter for details) the only two valid setups using special features are:
• None of the special inputs are used, both groups can be input or output
• Only RefClock used, other group can be either input or output
• RefClock and incremental counters are used, so both groups must be set to input
When using one or more of the inputs with their special features, it is still possible to sample the groups asynchronously as described in the
section before. So as an example when using only bit 2 as an reference clock input the remaining three lines of the input group can still be
used as asynchronous digital inputs. When reading the data of the inputs all bits are sampled, even those that are used for special purposes.
In these cased the user might mask the read out digital data manually, to not receive unwanted lines.
The table below shows the direction register for the remaining upper group and the possible values. To combine the values for both groups
you can easily OR them bitwise.
Transfer Data
The outputs can be written or read by a single 32 bit register. If the register is read, the actual pin data will be sampled. Therefore reading
the lines declared as outputs gives back the generated pattern. The single bits of the digital I/O lines correspond with the number of the bit
of the 32 bit register. Values written to the three upper bytes will be ignored.
Programming Example
The following example shows, how to program the lower group to be input and the upper group to be output, and how to write and read
and interpret/mask the digital data:
Special Sampling Feature
When using the option BaseXIO in combination with the timestamp option one can enable two special auto sampling option: one that samples
the eight BaseXIO lines synchronously with each trigger event and another that samples values from two 10 bit counters for incremental en-
coder applications. This feature is independent of the BaseXIO line settings. For details, please refer to the timestamp chapter in this manual.
Register
Value
Direction
Description
SPC_XIO_DIRECTION
47100
read/write
Defines the direction of the remaining digital I/O lines.
XD_CH0_INPUT
0
The direction of the lower group (bit D3…D0) must be set to input, when using the special features.
XD_CH1_INPUT
0
Sets the direction of the upper group (bit D7…D4) to input.
XD_CH1_OUTPUT
2
Sets the direction of the upper group (bit D7…D4) to output.
Register
Value
Direction
Description
SPC_XIO_DIGITALIO
47110
r
Reads the data directly from the pins of all digital I/O lines either if they are declared as inputs or
outputs.
SPC_XIO_DIGITALIO
47110
w
Writes the data to all digital I/O lines that are declared as outputs. Bytes that are declared as inputs
will ignore the written data.
// Define direction: set Ch0 as Input and Ch1 as output
spcm_dwSetParam_i32 (hDrv, SPC_XIO_DIRECTION, XD_CH0_INPUT | XD_CH1_OUTPUT);
spcm_dwSetParam_i32 (hDrv, SPC_XIO_DIGITALIO, 0xA0); // Set all even output bits HIGH, all odd to LOW
// The write to the inputs will be ignored
spcm_dwGetParam_i32 (hDrv, SPC_XIO_DIGITALIO, &lData); // Read back the digital data (incl. outputs)
// Bits 7…4 will be the output value 0xA
lData = lData & (uint32) 0x0F // Mask out the output bits to have inputs only