12.13 Process IOThe main drawback in using standard languages for process control compared to PLC “languages” like SIEMENS STEP5 or IEC1131 is the difficult access of process-i/o (i.e. digital and analog inputs and outputs, counters and encoders). EmBasic has overcome this drawback by using i/o variable that are initially
assigned some hardware port and further can be used just like a common
variable, for example
12.14 Using the IO datatype to access process I/O devices emBASIC relies on external support for IO. For standard hardware (TSM,
DinX, EVA900) mCAT comes with “Express-i/o” support - providing
this same functionality to C and emBASIC programmers.
After that, the output can be used like a variable, switching it on simply by assigning it a 1:
On other hand, to read an input, create it for example using input 2 on the digital input module with the switch address set to 0:
12.15 Vector accessExpress-I/O allows vector access of all inputs or outputs of a module at the same time. emBASIC provides a mechanism to use these functions, for example assigning all inputs to a bitmap using the VECTOR keyword on variable declaration:
Note that you cannot declare an array, e. g. use a dimension specifier in vector declaration mode. ### How to access counter vectors then? To be implemented The third argument to the i/o-variable declaration does not make sense and is not used. Vector has the LWORD datatype and could be manipulated using bitwise operations:
12.16 Simulated functionsIn a background process called every few milliseconds; Express-I/O simulates
higher level I/O functionality like counting on standard inputs, waiting
for a level change or, for standard outputs, retarded switching with settable
ON times. These so called Express programs (XP) are made available to
the emBASIC user through the XP datatype declaration. DECL Pulse AS DIGITAL OUTPUT ($CPUBUS, $DOUT, 0) USING “PULSE”
|