wodni.at
Motivation
AWL is the german term for IL, you can read about the basics on wikipedia.
Actually the idea is to have an assembler like language which is thus device independent.
The "original" lanuages look somwhat like this:
LD Input1
AND Input2
ST OUTPUT1which equals the logical and.
So the language is used in a way like "Check conditions, take actions".
Based on this, years of experience with different implementations of AWL i decided to create my own compiler which should provide a more sophisticated aproach to the topic without loosing focus.
Language
AWL (from now on i will call my language that way) has a very simple syntax: it is divided into tokens, tokens are separated by a semicolon ';'
There are several types of tokens:- Configuration: tell the compiler which device is used, how many markers should be created, etc.
- Flow: although AWL has no looping instructions, the languages features some section/flow markers, that enables the possibility to do initialisations.
- Commands: main part of the language.
Configuration
Consists of the item name to configure, a list of parameters enclosed by '{' and '}'.- mcu: information about the controller which is in used, see currently supported mcus
- part: mcu's name
- frequency: crystal / interanal oscillator frequency (used for prescaler settings)
- markers
- format:
- bits: saves space
- bytes: faster because byte-instrucations are used, no need to extract bits
- number: how many markers are to be created
- timers
...
Commands
Each Command consists of 3 parts:
[condition] command [target]
The command is only executed when the condition returns true, if no condition is set, true will be asumed. Depending on the command most of them will have targets, whenever a target is needed it's also possible to write a list of targets enclosed by curly-parentheses like configuation-lists.- Logical Commands:
- set: sets tha target(s) to logical '1' set A1;
- clear: clears the target(s) to logical '0' clear {A1, A2, B3};
- toggle: inverts the target(s) states, '0' becomes '1' and vice versa A1 and A2 toggle B2; #toggles B2 if A1 and A2 are set
- Non-Standard Commands
- wait: waits till all targets are logical '1' wait {A1, A2};
- pause: pauses for the given interval A1 pause 20ms; #pauses for 20ms if A1 is '1'
...