weAut_01 / weAutSys    R 2.2.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines
Functions | Variables
Digital / Analogue input
+ + Process I/O and HMI functions + +

Overview

weAut_01 (weAutSys' target hardware) has 8 protected input channels for +/-70V input voltage (surviving 250 Veff as absolute max. rating).

Every channel can be configured as


Functions

uint8_t actDI (void) __attribute__((always_inline))
 Actual digital (process) input DI.
uint8_t dctDI (void) __attribute__((always_inline))
 Digital (process) input DI (direct)
uint8_t filDI (void) __attribute__((always_inline))
 The final or filtered digital (process) input DI.
uint8_t lbpDI (void) __attribute__((always_inline))
 Last before previous digital (process) input DI.
void procDIcyc (void)
 Digital (process) input DI (system implementation)
uint8_t prvDI (void) __attribute__((always_inline))
 Previous digital (process) input DI.
void setAIchannels (uint8_t mask)
 Set the usage of channel(s) as AI instead of DI.

Variables

uint8_t aiChannels
 Use channel(s) as AI instead of DI.
uint8_t aiConvd
 Analogue input available.
uint8_t aiResult [8]
 Analogue input results.
uint8_t upDIthresh4hyst
 Shift DI thresholds up mask conditionally / larger hysteresis.
uint8_t upDIthreshForce
 Shift DI thresholds up mask permanently.

Function Documentation

uint8_t dctDI ( void  )

Digital (process) input DI (direct)

This function returns the (8) digital inputs in one byte. The value by this function will be the immediate un-filtered read. Hence it is a low level function rarely (not to say never) to be used by user /application software directly.

For configurations without such inputs 0 will be returned. Channels used (in weAut_01 e.g.) for analogue input and disabled for digital reading (by DIDR0 the digital input disable register) will also return 0 in the respective bit position.

void procDIcyc ( void  )

Digital (process) input DI (system implementation)

Must not to be used by user / application software.

uint8_t actDI ( void  )

Actual digital (process) input DI.

This function returns the (8) digital inputs in one byte. The value by this function will be the actual un-filtered read, done by system software within the last one millisecond. Hence, the value is 0..1 ms old.

Hint: This statement is true for the normal configuration where all DI processing is done in the 1 ms system thread. If done more seldom by system (re-) configuration, apply the appropriate factor to all filter and timing values given for this function and the other related DI functions.

Hint 2: actDI(), prvDI(), lbpDI() and dctDI() are low level function rarely to be used by user / application software. Therefore filDI() is recommended.

See also:
prvDI
lbpDI
filDI
uint8_t prvDI ( void  )

Previous digital (process) input DI.

This function returns the (8) digital inputs in one byte. The value here will be the previous un-filtered read, done by system software before the actual read. The value will be 1 ms older than actDI(), i.e. 1..2 ms old.

See also:
actDI
lbpDI
filDI
uint8_t lbpDI ( void  )

Last before previous digital (process) input DI.

This function returns the (8) digital inputs in one byte. The value here will be the last before previous un-filtered read. The value will be 2 ms older than actDI().

See also:
actDI
prvDI
filDI
uint8_t filDI ( void  )

The final or filtered digital (process) input DI.

This function returns the (8) digital inputs in one byte. The value here will be the final value reflecting state values stable over the last three milliseconds by appropriate filter algorithm.

A stable input change will be reflected here after 2 .. 3 ms.

It is this (stable) value that is optionally used to enlarge the hysteresis (by slightly shifting the input thresholds),

See also:
actDI
prvDI
dctDI
upDIthresh4hyst
Examples:
main.c.
void setAIchannels ( uint8_t  mask)

Set the usage of channel(s) as AI instead of DI.

For bits set 1 in mask the respective input channels are uses as analogue inputs AI (en lieu de DI).

This DI/AI configuration is only relevant with weAut_01 (weAut_00) where potential AI and DI share the same (rare) protected input clamps. Boards with direct access to (an abundance of) µController pins won't use that feature.

See also:
aiChannels.
Examples:
main.c.

Variable Documentation

uint8_t upDIthreshForce

Shift DI thresholds up mask permanently.

For bits set 1 in this mask the respective DI channels permanently get higher input thresholds compared to those without such settings.

High settings: about 11V on; about 9V off.
Low settings: about 6V on; about 3V off.

This DI level setting works with weAut_01 (weAut_00) only. Boards without "real" digital process input have only CMOS logic inputs.

See also:
upDIthresh4hyst
filDI
Examples:
main.c.
uint8_t upDIthresh4hyst

Shift DI thresholds up mask conditionally / larger hysteresis.

For bits set 1 in this mask byte the respective DI channels permanently get higher input thresholds on the condition of their fiDI() value being 1. This effectively widens this DI channels hysteresis.

Wide setting: about 11V on; about 3V off.

The hysteresis widening will only work if the respective bit in upDIthreshForce is not set.

This DI level / hysteresis settings work with weAut_01 (weAut_00) only. Boards without "real" digital process input have only CMOS logic inputs.

See also:
upDIthreshForce
filDI
Examples:
main.c.
uint8_t aiChannels

Use channel(s) as AI instead of DI.

For bits set 1 in this mask byte the respective input channels are uses as analogue inputs AI (en lieu de DI).

This variable must not be set directly but changed by using setAIchannels.

Examples:
main.c.
uint8_t aiConvd

Analogue input available.

System software will set a bit if an analogue conversion, enabled by aiChannels, is complete. Converting all 8 channels (if told so by aiChannels) will take about 700µs.

uint8_t aiResult[8]

Analogue input results.

This array contains the latest AI conversion results (only for those channels enabled by aiChannels).

The results are restricted to 8 bit resolution which is quite appropriate regarding the use of weAut_01's use of its inputs designed as protected DIs in an analogue mode.

Examples:
main.c.