Ficara Emilio Pietro Giovanni Home Zilog Z8 micro projects page
Ultima modifica: 21/06/2023


LINSEM Mini PLC: FREE programmable 4-In / 4-Out device with Windows development environment

First of all, my language is Italian, so I apologize for the errors you can find in this page (I hope my translation will be better than the Google one).


LINSEM is a very simple language; it has a reduced instruction set: this is the list.

Instruction RLON
 Turn ON output; having 4 outputs, you can write:

  RLON 1
   ..  .
  RLON 4
  where 1..4 is the output number.

Instruction RLOF
 Turn OFF output; as for the RLON, you can write:

  RLOF 1
   ..  .
  RLOF 4
  where 1..4 is the output number.

Instruction ASSV
 Assign a value to a variable. Variables can be used as counters or for flags in decision trees.
 The number of available variables is 8; so you can write:

 ASSV 1 xxx
  ..  . ...
 ASSV 8 xxx
 where 1..8 is the variable identifier and xxx is the value to assign to;
 all the variables are one byte size, so the value can be 0..255.

Instruction DECV
 Decrement (-1) the value of a variable. Having 8 variables you can write:

 DECV 1
  ..  .
 DECV 8
 where 1..8 is the variable identifier.

Instruction INCV
 Increment (+1) the value of a variable. Having 8 variables you can write:

 INCV 1
  ..  .
 INCV 8
 where 1..8 is the variable identifier.

Instruction SASW
 Jump to destination label if the selected switch (input) is OPEN:

 SASW 1 dest
  ..  .  ..
 SASW 4 dest
 where 1..4 is the input (switch) selected and dest is the destination label.

Instruction SCSW
 Jump to destination label if the selected switch (input) is CLOSED:

 SCSW 1 dest
  ..  .  ..
 SCSW 4 dest
 where 1..4 is the input (switch) selected and dest is the destination label.

Instruction SAVZ
 Jump to destination label if variable has zero value:

 SAVZ 1 dest
  ..  .  ..
 SAVZ 8 dest
 where 1..8 is the variable identifier and dest is the destination label.

Instruction SAVV
 Jump if the variable 1..4 has the same value of variable 5..8:

 SAVV 1 dest
  ..  .  ..
 SAVV 4 dest
 where 1..4 is the first variable identifier and dest is the destination label.
 The second variable identifier is always at +4 offset (var1 compare with var5,
 var2 compare with var6 etc).

Instruction SASC
 Jump without conditions:

 SASC dest
 where dest is the destination label.

Instruction CSUB
 Call Subroutine. A subroutine can be called anywhere in the program and MUST terminate with RSUB instruction.
 The address of next instruction is saved as return address. Nesting of Subroutines is NOT allowed (you can't
 use CSUB inside a subroutine). The instruction format is: 

 CSUB dest
 where dest is the destination label (start of subroutine). At end of subroutine (RSUB) the program jumps
 to the return address saved at call.

Instruction RSUB
 Return from subroutine. EVERY subroutine MUST terminate with this instruction.
 The instruction format is: 

 RSUB
 there are no parameters.

Instruction RITM
 Delay before next instruction:

 RITM xxx
 where xxx is the number (0..255) of 100mS steps of delay. The 0 value is considered as 256.

Instruction FINE
 End of program. When the program reaches this instruction, it halts and waits for a hardware
 reset or command from PC via serial port. If there are outputs ON, they will be automatically
 turned OFF. If you want to end a program with relays ON, use a jump on the same address (ie:
 ENDL: SASC ENDL). The instruction format is:

 FINE
 there are no parameters.