plcopen/iec_std.csv
author Andrey Skvortsov <andrej.skvortzov@gmail.com>
Sun, 06 Jan 2019 03:11:39 +0300
changeset 2501 eba2bbb2dd9a
parent 2496 39049d615c0d
permissions -rw-r--r--
Make online debug optional

It could be useful for very small targets like Atmega (Arduino) and
for target bring-up there developer want to have running PLC program,
but has not implemented runtime communication yet.


TARGET_DEBUG_AND_RETAIN_DISABLE - completely disable debug and retain
functionality. Previously named TARGET_DEBUG_DISABLE.

TARGET_ONLINE_DEBUG_DISABLE - can be used to enable retain
functionality (no define TARGET_DEBUG_AND_RETAIN_DISABLE is used), but disable
online debug with corresponding RAM/FLASH overhead.

TARGET_LOGGING_DISABLE - disables logging functionality from runtime and PLC program

TARGET_EXT_SYNC_DISABLE - disables PLC program synchronization with
external events. For example, it could be used to synchronize several
PLCs that control motors for different axes.

By default all these options are off.

To test generate program for Generic target, put following files in
project files directory and run build.sh after generating PLC program.
This is very easy to integrate into makefile (Generic target).

[------------- build.sh --------------------------]
files=$(find $PWD/../build -iname '*.c' | grep -v POUS.c)
arm-none-eabi-gcc \
-DTARGET_DEBUG_AND_RETAIN_DISABLE \
-DTARGET_ONLINE_DEBUG_DISABLE \
-DTARGET_LOGGING_DISABLE \
-DTARGET_EXT_SYNC_DISABLE \
-flto -ffunction-sections -fdata-sections -I../../../../matiec/lib/C \
$files \
main.c \
-Wl,--Map=./program.map,--cref \
-nodefaultlibs --specs=nano.specs -Wl,--static -Wl,--gc-section -Wl,--start-group -lc -lm -lnosys -lgcc -Wl,--end-group
[------------------------------------------------]

[------------- main.c --------------------------]
#ifndef TARGET_DEBUG_AND_RETAIN_DISABLE
void Retain(void){}
void InValidateRetainBuffer(void){}
void ValidateRetainBuffer(void){}
#endif

extern void __run(void);
int main(void)
{
for(;;) {
__run();
// sleep common_ticktime__ ns
// add common_ticktime__ ns to __CURRENT_TIME
}
return 0;
}
[------------------------------------------------]
Standard_functions_variables_types;name;type;comment;;;;
;N;ANY_INT;Number of bits to be shifted;;;;
;L;ANY_INT;Left position within character string;;;;
;P;ANY_INT;Position within character string;;;;
;G;BOOL;Selection out of 2 inputs (gate);;;;
;K;ANY_INT;Selection out of n inputs;;;;
;MN;ANY;Minimum value for limitation;;;;
;MX;ANY;Maximum value for limitation;;;;
;;;;;;;
;;;;;;;
;;;;;;;
;;;;;;;
;;;;;;;
;;;;;;;
Standard_functions_type;name;baseinputnumber;inputs;outputs;comment;extensible;filter
_("Type conversion");*_TO_**;1;(ANY);ANY;_("Data type conversion");no;ANY_TO_ANY
;TRUNC;1;(ANY_REAL);ANY_INT;_("Rounding up/down");no;
;BCD_TO_**;1;(ANY_BIT);ANY_INT;_("Conversion from BCD");no;BCD_TO_ANY
;*_TO_BCD;1;(ANY_INT);ANY_BIT;_("Conversion to BCD");no;ANY_TO_BCD
;DATE_AND_TIME_TO_TIME_OF_DAY;1;(DT);TOD;_("Conversion to time-of-day");no;
;DATE_AND_TIME_TO_DATE;1;(DT);DATE;_("Conversion to date");no;
_("Numerical");ABS;1;(ANY_NUM);ANY_NUM;_("Absolute number");no;
;SQRT;1;(ANY_REAL);ANY_REAL;_("Square root (base 2)");no;
;LN;1;(ANY_REAL);ANY_REAL;_("Natural logarithm");no;
;LOG;1;(ANY_REAL);ANY_REAL;_("Logarithm to base 10");no;
;EXP;1;(ANY_REAL);ANY_REAL;_("Exponentiation");no;
;SIN;1;(ANY_REAL);ANY_REAL;_("Sine");no;
;COS;1;(ANY_REAL);ANY_REAL;_("Cosine");no;
;TAN;1;(ANY_REAL);ANY_REAL;_("Tangent");no;
;ASIN;1;(ANY_REAL);ANY_REAL;_("Arc sine");no;
;ACOS;1;(ANY_REAL);ANY_REAL;_("Arc cosine");no;
;ATAN;1;(ANY_REAL);ANY_REAL;_("Arc tangent");no;
_("Arithmetic");ADD;1;(ANY_NUM, ANY_NUM);ANY_NUM;_("Addition");yes;
;MUL;1;(ANY_NUM, ANY_NUM);ANY_NUM;_("Multiplication");yes;
;SUB;1;(ANY_NUM, ANY_NUM);ANY_NUM;_("Subtraction");no;
;DIV;1;(ANY_NUM, ANY_NUM);ANY_NUM;_("Division");no;
;MOD;1;(ANY_INT, ANY_INT);ANY_INT;_("Remainder (modulo)");no;
;EXPT;1;(ANY_REAL, ANY_NUM);ANY_REAL;_("Exponent");no;
;MOVE;1;(ANY);ANY;_("Assignment");no;
_("Time");ADD;1;(TIME, TIME);TIME;_("Time addition");no;
;ADD_TIME;1;(TIME, TIME);TIME;_("Time addition");no;
;ADD;1;(TOD, TIME);TOD;_("Time-of-day addition")+" "+_("DEPRECATED");no;
;ADD_TOD_TIME;1;(TOD, TIME);TOD;_("Time-of-day addition");no;
;ADD;1;(DT, TIME);DT;_("Date addition")+" "+_("DEPRECATED");no;
;ADD_DT_TIME;1;(DT, TIME);DT;_("Date addition");no;
;MUL;1;(TIME, ANY_NUM);TIME;_("Time multiplication")+" "+_("DEPRECATED");no;
;MULTIME;1;(TIME, ANY_NUM);TIME;_("Time multiplication");no;
;SUB_TIME;1;(TIME, TIME);TIME;_("Time subtraction");no;
;SUB;1;(TIME, TIME);TIME;_("Time subtraction");no;
;SUB;1;(DATE, DATE);TIME;_("Date subtraction")+" "+_("DEPRECATED");no;
;SUB_DATE_DATE;1;(DATE, DATE);TIME;_("Date subtraction");no;
;SUB;1;(TOD, TIME);TOD;_("Time-of-day subtraction")+" "+_("DEPRECATED");no;
;SUB_TOD_TIME;1;(TOD, TIME);TOD;_("Time-of-day subtraction");no;
;SUB;1;(TOD, TOD);TIME;_("Time-of-day subtraction")+" "+_("DEPRECATED");no;
;SUB_TOD_TOD;1;(TOD, TOD);TIME;_("Time-of-day subtraction");no;
;SUB;1;(DT, TIME);DT;_("Date and time subtraction")+" "+_("DEPRECATED");no;
;SUB_DT_TIME;1;(DT, TIME);DT;_("Date and time subtraction");no;
;SUB;1;(DT, DT);TIME;_("Date and time subtraction")+" "+_("DEPRECATED");no;
;SUB_DT_DT;1;(DT, DT);TIME;_("Date and time subtraction");no;
;DIV;1;(TIME, ANY_NUM);TIME;_("Time division")+" "+_("DEPRECATED");no;
;DIVTIME;1;(TIME, ANY_NUM);TIME;_("Time division");no;
_("Bit-shift");SHL;1;(ANY_BIT, N);ANY_BIT;_("Shift left");no;
;SHR;1;(ANY_BIT, N);ANY_BIT;_("Shift right");no;
;ROR;1;(ANY_NBIT, N);ANY_NBIT;_("Rotate right");no;
;ROL;1;(ANY_NBIT, N);ANY_NBIT;_("Rotate left");no;
_("Bitwise");AND;1;(ANY_BIT, ANY_BIT);ANY_BIT;_("Bitwise AND");yes;
;OR;1;(ANY_BIT, ANY_BIT);ANY_BIT;_("Bitwise OR");yes;
;XOR;1;(ANY_BIT, ANY_BIT);ANY_BIT;_("Bitwise XOR");yes;
;NOT;1;(ANY_BIT);ANY_BIT;_("Bitwise inverting");no;
_("Selection");SEL;0;(G, ANY, ANY);ANY;_("Binary selection (1 of 2)");no;
;MAX;1;(ANY, ANY);ANY;_("Maximum");yes;
;MIN;1;(ANY, ANY);ANY;_("Minimum");yes;
;LIMIT;1;(MN, ANY, MX);ANY;_("Limitation");no;
;MUX;0;(K, ANY, ANY);ANY;_("Multiplexer (select 1 of N)");yes;
_("Comparison");GT;1;(ANY, ANY);BOOL;_("Greater than");yes;
;GE;1;(ANY, ANY);BOOL;_("Greater than or equal to");yes;
;EQ;1;(ANY, ANY);BOOL;_("Equal to");yes;
;LT;1;(ANY, ANY);BOOL;_("Less than");yes;
;LE;1;(ANY, ANY);BOOL;_("Less than or equal to");yes;
;NE;1;(ANY, ANY);BOOL;_("Not equal to");no;
_("Character string");LEN;1;(STRING);INT;_("Length of string");no;
;LEFT;1;(STRING, L);STRING;_("string left of");no;
;RIGHT;1;(STRING, L);STRING;_("string right of");no;
;MID;1;(STRING, L, P);STRING;_("string from the middle");no;
;CONCAT;1;(STRING, STRING);STRING;_("Concatenation");yes;
;CONCAT_DATE_TOD;1;(DATE, TOD);DT;_("Time concatenation");no;
;INSERT;1;(STRING, STRING, P);STRING;_("Insertion (into)");no;
;DELETE;1;(STRING, L, P);STRING;_("Deletion (within)");no;
;REPLACE;1;(STRING, STRING, L, P);STRING;_("Replacement (within)");no;
;FIND;1;(STRING, STRING);INT;_("Find position");no;