SIMATIC PCIe DIO4
Compact Operating Instructions, 11/2011, A5E03493449-01
17
Examples and register assignments
4
4.1
Initializing and enabling DIO
Enabling the DIO
To enable the DIO, abbreviation of digital IO module, proceed as follows:
1.
Map the MMIO memory area from BAR0, hereafter referred to as BASE.
2.
Check the version and the properties of the DIO from the VER register: BASE + 0x0000:
–
Version = VER & 0xFF
–
Revision = (VER >> 8) & 0xFF
–
NumberOfInputs = (VER >> 16) & 0x1F
–
NumberOfOutputs = (VER >> 21) & 0x1F
–
NumberOfTimers = (VER >> 26) & 0x1F
3.
Acquire the INUSE flag: InUse = (GSR & 1)
The INUSE flag prevents that several software components access the DIO at the same
time. Before a software accesses the DIO, the software must check if the module in
already in use by means of the INUSE flag. The result of the INUSE bit must be "0" when
the Global Status Register GSR is read for the first time. All other read accesses must
result in "1". The DIO is in use.
4.
Set the GCR.EN. The DIO is enabled and the 24 V outputs are activated.
If you delete GCR.EN (0), all internal registers are reset.
The software now uses the DIO to run its program.
Disabling the DIO
Delete the GCR.EN. The internal registers are reset and the 24 V outputs are disabled.
Enabling the DIO
Write the INUSE flag GSR.INUSE; this step resets the INUSE flag.