114
M2i.60xx / M2i.60xx-exp Manual
Different functions
Option BaseXIO
Special Input Functions
This way of operating the option BaseXIO requires the lower of the above mentioned group of four lines (XIO3…XIO0) to be set as input.
The upper group can be programmed to be either input or output.
The four lower input bits then can have additional func-
tions besides working as asynchronous digital inputs:
• XIO0: additional TTL trigger ExtraTrig0 (M2i only)
• XIO1: additional TTL trigger ExtraTrig1 (M2i only)
• XIO2: RefClock for timestamp option
• XIO3: no special feature yet
All of the above mentioned special features are ex-
plained in detail in the relating section of this manual.
When using one or more of the inputs with their special features, it is still possible to sample them asynchronously as described in the section
before. So as an example when using bit 0 as an additional TTL trigger 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 mode one can enable a special auto sampling option, that samples the
eight BaseXIO lines synchronously with each trigger event. This feature is independent of the BaseXIO line settings. For details, please refer
to the timestamp chapter in this manual.
This special sampling feature requires the Timestamp mode to be enabled.
Electrical specifications
The electrical specifications of the BaseXIO inputs and outputs can be found either in the technical data section of this manual or in the
datasheet.
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