J
Hello,
I've dusted off my old Perl-based IL compiler, which turns simple instruction list into C. (The Makefile then compiles it to executable.)
Unless there are any objections, I'll check it into the CVS at lang/il (or should that be logic/il ?)
The intention is to replace it at some stage with a C program.
Quick summary of the instructions (example at end):
==================================================
First, sorry about not using the standard instructions - whoever has 1131-3
handy, can you tell me what they're supposed to be, please?
LD contact = start rung
AND contact = series contact
OR contact = parallel contact
OUT coil = normal relay coil
LDI, ANI, ORI, OUTI - above with inverted (N/C) sense
SET coil = latch coil
RST coil = unlatch coil
There are no brackets at present. Instead, the ANB and ORB instructions
must be used: for example, ANB ands in the previous rung (and forgets it so
the next ANB/ORB gets the one before). It is intended that the C program
will handle both this and brackets.
MCS = use the current rung (so far) as a rung prefix from now on.
MCE = cancel MCS.
JMP label = conditionally jump to the label
LBL label = label marker (no operation)
END = end of program (unconditional - only a JMP gets past it)
NOP = no operation
Comments begin with # or ; and must be alone on a line.
Example:
=======
The following stepladder diagram:
| X001 Y002 Y004 |
|---[ ]---[ ]---+-----------------( )----|
| | |
| X002 Y001 | |
|---[ ]---[/]---+ |
| |
Is written:
LD X001
AND Y002
LD X002
ANI Y001
ORB
OUT Y004
And comes out as per the attached example.c
Jiri
--
Jiri Baum <[email protected]>
Windows is not popular. Windows is *widespread*. Linux is popular.
_______________________________________________
LinuxPLC mailing list
[email protected]
http://linuxplc.org/mailman/listinfo/linuxplc
I've dusted off my old Perl-based IL compiler, which turns simple instruction list into C. (The Makefile then compiles it to executable.)
Unless there are any objections, I'll check it into the CVS at lang/il (or should that be logic/il ?)
The intention is to replace it at some stage with a C program.
Quick summary of the instructions (example at end):
==================================================
First, sorry about not using the standard instructions - whoever has 1131-3
handy, can you tell me what they're supposed to be, please?
LD contact = start rung
AND contact = series contact
OR contact = parallel contact
OUT coil = normal relay coil
LDI, ANI, ORI, OUTI - above with inverted (N/C) sense
SET coil = latch coil
RST coil = unlatch coil
There are no brackets at present. Instead, the ANB and ORB instructions
must be used: for example, ANB ands in the previous rung (and forgets it so
the next ANB/ORB gets the one before). It is intended that the C program
will handle both this and brackets.
MCS = use the current rung (so far) as a rung prefix from now on.
MCE = cancel MCS.
JMP label = conditionally jump to the label
LBL label = label marker (no operation)
END = end of program (unconditional - only a JMP gets past it)
NOP = no operation
Comments begin with # or ; and must be alone on a line.
Example:
=======
The following stepladder diagram:
| X001 Y002 Y004 |
|---[ ]---[ ]---+-----------------( )----|
| | |
| X002 Y001 | |
|---[ ]---[/]---+ |
| |
Is written:
LD X001
AND Y002
LD X002
ANI Y001
ORB
OUT Y004
And comes out as per the attached example.c
Jiri
--
Jiri Baum <[email protected]>
Windows is not popular. Windows is *widespread*. Linux is popular.
_______________________________________________
LinuxPLC mailing list
[email protected]
http://linuxplc.org/mailman/listinfo/linuxplc