52
WITIO-PCIe192
ULTRA
© 2018 by Messcomp Datentechnik GmbH
DV0101
52
WITIO-PCIe192
ULTRA
© 2018 by Messcomp Datentechnik GmbH
EV0103
52
52
wasco
®
wasco
®
11.1.2 Calculation of the register values
OCPERIODx
(2)
= Period_duration_in_µs + 1 [µs]
OCUNITORx
(2)
= Pulse_duration_in_µs [µs]
OCTIMER = clocks [µs]
11.1.3 Application example
1. Deactivate the OC unit by clearing the corresponding bit in the register
OCUNITxe
(2)
.
2.Connect the OC unit to the required digital output. For this, select the
source in the DOUTMUXyCNx
(1)
register allocated to the digital output (see
chapter „Assigning digital outputs with other hardware components“)
3. Preload the OC timer of the OC unit. Here usually the value 0x00000000
is written to the register OCTIMERx
(2)
.
4. Define the period duration of the PWM. For this, write the period duration
to the register OCUNITORx
(2)
as follows:
OCPERIODx
(2)
= Period duration - 1 [µs]
5. Define the pulse duration. For this, write the pulse duration to the regi
-
ster OCPULSx
(2)
as follows:
OCPULSx
(2)
= Pulse duration [µs]
6. Select the mode of the OC unit. For using the PWM, the value 0 has to
be written to the register OCCONFIGx
(2)
7. Activate the OC unit by setting the corresponding bit in the register
OCUNITxe
(2)
.
1
(y = Register number, x = Connector number)
2
(x = OC number)
11.1.2 Berechnung der Registerwerte
OCPERIODx
(2)
= Periodendauer_in_µs + 1 [µs]
OCUNITORx
(2)
= Pulsdauer_in_µs [µs]
OCTIMER = Takte [µs]
11.1.3 Anwendungsbeispiel
1. OC-Einheit durch das Löschen des entsprechenden Bits im Register
OCUNITxe
(2)
deaktivieren.
2. OC-Einheit mit dem gewünschten digitalen Ausgang verbinden. Dafür
muss in dem zum digitalen Ausgang gehörigen DOUTMUXyCNx-Register
(1)
die Quelle ausgewählt werden (siehe Kapitel „Digitale Ausgänge mit an
-
deren Hardwarekomponenten belegen“).
3. Den OC-Timer der OC-Einheit vorladen. Hier wird in der Regel der Wert
0x00000000 in das Register OCTIMERx
(2)
geschrieben.
4. Die Periodendauer der PWM festlegen. Hierfür muss die Periodendauer
wie folgt in das Register OCUNITORx
(2)
geschrieben werden:
OCPERIODx
(2)
= Periodendauer - 1 [µs]
5. Die Pulsdauer festlegen. Hierfür muss die Pulsdauer wie folgt in das
Register OCPULSx
(2)
geschrieben werden:
OCPULSx
(2)
= Pulsdauer [µs]
6. Den OC-Unit-Modus auswählen. Für das Verwenden der PWM muss
der Wert 0 im Bereich Mode des Registers OCCONFIGx
(2)
geschrieben
werden.
7. OC-Einheit durch das Setzen des entsprechenden Bits im Register
OCUNITxe
(2)
aktivieren.
1
(y = Registernummer, x = Connector-Nummer)
2
(x = OC-Nummer)