OmniTurn   CNC Lathes Made in Oregon
 Fast... Precise... Affordable... Home Contact

The World’s Most Cost-Effective Turning Machines
user files

Writing Custom M-Functions for use with PLC Expanded I/O

When the optional PLC is installed, you can create custom M-Functions to interact with the PLC. A simple programming language sets, resets or pulses outputs, waits for intput states and sets, resets, pulses and examines internal PLC memory bits.

Editing & Writing .usr files to access the additional I/O:

To edit or create a usr file on the OmniTurn:

  1. Drop to DOS (Ctrl-Q from Jog screen).
  2. At K:\CNC> prompt, type C: then press enter.
  3. At C:\RUNFILES> prompt, type edit m??.usr (where m?? is the number of the M-function) then press enter to start OmniTurn editor.
    NOTE: on older OmniTurns, you may have to type ew m??.usr.
Edit the program as usual, save and exit, then restart the OmniTurn.


There are only ten commands in the 'usr language':
(n is the number of the output, input, mark or length of time)

setbn
Turns an output ON: setb10 turns on output Y10
clrbn
Turns an output OFF: clrb10 turns off output Y10
setmn
Turns a mark ON: setm7 turns on M7 in the PLC
clrmn
Turns a mark OFF: flrm7 turns off M7 in the PLC
waitonn
Stops the usr program until an input turns ON: waiton14 waits for X14 to go on
waitoffn
Stops the usr program until an input turns OFF: waiton14 waits for X14 to go off
waitmonn
Stops the usr program until a mark in the PLC turns ON: waitmon8 waits for M8 to go on
waitmoffn
Stops the usr program until a mark in the PLC turns OFF: waitmoff8 waits for M8 to go off
delayn
Stops the usr program for a number of seconds, from .1 sec to 10 sec: delay.3 waits for 3/10 of a second. Used for pulsing an output, or for waiting a while after seeing an input before setting an output.
end
The last command in every usr program must be END.