·642·
Installation manual
CNC 8055
CNC 8055i
17.
PLC PROGRAMMING EXAMPLE
SOFT: V02.2X
Main module.
= MOV ENTER KEYCODE = SET SENDKEY
...and the code for the "ENTER" key is sent out.
M124 AND ENVIOK = RES M124 = RES ENVIOK = SET M125
If the previous key was sent out successfully (SENTOK), flags M124 and SENTOK will be turned
off, the flag for the next stage (M125) is activated ....
= MOV THEOPATH KEYCODE = SET SENDKEY
...and the code for the "THEORETICAL PATH" (F1) is sent out.
M125 AND ENVIOK = RES M125 = RES ENVIOK = SET M126
If the previous key was sent out successfully (SENTOK), flags M125 and SENTOK will be turned
off, the flag for the next stage (M126) is activated ....
= MOV START KEYCODE = SET SENDKEY
...and the code for the START key is sent out.
M126 AND ENVIOK = RES M126 = RES ENVIOK
If the last key was sent out successfully (SENTOK), flags M126 and SENTOK will be turned off....
= MOV TECLACNC TECLADO = CNCWR (TECLADO, KEYSRC, M100)
...and the CNC is "told" that from now on the keys will be coming from CNC keyboard (CNCKEY),
not from the PLC.
--- Subroutine used to send a key ---
ENVIATEC =SET M100 =SET M101 =SET M102 =RES ENVIATEC
To send a key (SENDKEY), set to "1" internal marks M100 through M102 and reset the SENDKEY
flag to "0".
M100 = CNCWR (CODTECLA, KEY, M100)
Sends to the CNC the code of the key to be simulated (KEYCODE). If this command is not executed
correctly (M100=1), the PLC will try again on the next cycle scan.
M101 AND NOT M100 = CNCRD (KEY, ULTECLA, M101)
If the previous command was executed correctly, (M100=0), it reads the last key accepted by the
CNC (LASTKEY).
M102 AND NOT M101 AND CPS ULTECLA EQ CODTECLA
If the previous command was executed correctly (M101=0) and the CNC accepted the key sent to
it (LASTKEY = KEYCODE), .....
= RES M102 = SET ENVIOK
...the flag is turned off (M102=0) and the key is considered to be sent out successfully
(SENTOK=1)...
= NOT M101
...But if the CNC did not accept the key sent to it, it waits until it does (M101=1).
End of subroutine.
END
End of the program.