1. Einführung
The following sections show the pins, parameters, and functions that are supplied by "canonical devices". All HAL device drivers should supply the same pins and parameters, and implement the same behavior.
Note that only the _<io-type>_
and _<specific-name>_
fields are defined for a canonical device. The _<device-name>
, _<device-num>_
, and _<chan-num>_
fields are set based on the characteristics of the real device.
2. Digital Input
Der kanonische Digitaleingang (E/A-Typfeld: "digin") ist recht einfach.
2.1. Pins
- (bit) in
-
Zustand des Hardware-Eingangs.
- (bit) in-not
-
Invertierter Zustand des Eingangs.
2.2. Parameter
Keine
2.3. Funktionen
- (funct) read
-
Lesen der Hardware und Setzen der HAL-Pins "in" und "in-not".
3. Digital Output
Der kanonische digitale Ausgang (engl. output) (E/A-Typfeld: digout
) ist ebenfalls sehr einfach.
3.1. Pins
- (bit) out
-
Wert, der (eventuell invertiert) an den Hardware-Ausgang geschrieben werden soll.
3.2. Parameter
- (bit) invert
-
Wenn TRUE, wird out vor dem Schreiben in die Hardware invertiert.
3.3. Funktionen
- (funct) write
-
Lesen Sie out und invert und stellen Sie die Hardwareausgabe entsprechend ein.
4. Analog Input
The canonical analog input (I/O type: adcin
). This is expected to be used for analog to digital converters, which convert e.g. voltage to a continuous range of values.
4.1. Pins
- (float) Wert
-
Der Hardware-Messwert, skaliert gemäß den Parametern Skala und Offset.
Wert = ((Eingangsmesswert, in hardwareabhängigen Einheiten) * Skala) - Offset
4.2. Parameter
- (Float) Skala (engl. scale)
-
Die Eingangsspannung (oder der Strom) wird mit Skala multipliziert, bevor sie als Wert ausgegeben wird.
- (float) Offset
-
Dieser Wert wird nach Anwendung des Skalenmultiplikators von der Hardware-Eingangsspannung (oder dem Strom) subtrahiert.
- (float) bit_weight
-
The value of one least significant bit (LSB). This is effectively the granularity of the input reading.
- (float) hw_offset
-
The value present on the input when 0 Volts is applied to the input pin(s).
4.3. Funktionen
- (funct) read
-
Read the values of this analog input channel. This may be used for individual channel reads, or it may cause all channels to be read.
5. Analog Output
The canonical analog output (I/O Type: adcout). This is intended for any kind of hardware that can output a more-or-less continuous range of values. Examples are digital to analog converters or PWM generators.
5.1. Pins
- (float) Wert
-
Der zu schreibende Wert. Der tatsächliche Wert, der an die Hardware ausgegeben wird, hängt von den Parametern Skala und Offset ab.
- (bit) aktivieren (engl. enable)
-
Wenn false, dann wird 0 an die Hardware ausgegeben, unabhängig vom value Pin.
5.2. Parameter
- (float) Offset
-
Dies wird zu dem Wert (engl. value) hinzugefügt, bevor die Hardware aktualisiert wird.
- (Float) Skala (engl. scale)
-
Dies sollte so eingestellt werden, dass eine Eingabe von 1 am value-Pin dazu führt, dass der Analogausgangspin 1 Volt anzeigt.
- (float) high_limit (optional)
-
Wenn bei der Berechnung des an die Hardware auszugebenden Wertes value
offset größer ist als high_limit, wird stattdessen high_limit verwendet. - (float) low_limit (optional)
-
Wenn bei der Berechnung des an die Hardware auszugebenden Wertes value
offset kleiner als low_limit ist, wird stattdessen low_limit verwendet. - (float) bit_weight (optional)
-
Der Wert des niedrigstwertigen Bits (LSB) in Volt (oder mA bei Stromausgängen).
- (float) hw_offset (optional)
-
The actual voltage (or current) that will be output if 0 is written to the hardware.
5.3. Funktionen
- (funct) write
-
This causes the calculated value to be output to the hardware. If enable is false, then the output will be 0, regardless of value, scale, and offset. The meaning of "0" is dependent on the hardware. For example, a bipolar 12-bit A/D may need to write 0x1FF (mid scale) to the D/A get 0 volts from the hardware pin. If enable is true, read scale, offset and value and output to the adc (scale * value) + offset. If enable is false, then output 0.