Appendix C Programming Examples - Omron R88A-MCW151-DRT-E Operation Manual

Mcw151 series motion control option board
Table of Contents

Advertisement

Master Shell Program
Good programming practice requires to have a master shell program. A master shell program can be used for
most applications and will perform the following tasks:
• Set-up the MC Unit and the Servo Driver
• Control the application program tasks
• Continuously monitoring the status of the system.
Please find below an example of such a master shell program. Be sure to modify it to the specific application
and to check proper operation for all possible conditions before relying on its safety operation. This program
should be set to run at power-up at low priority (task 1).
'####################################################################
' Master shell program
' Tasks:
1. Set-up MC Unit and Servo Driver
'
2. Control application program tasks
'
3. Continuous error checking
' Inputs:
IN(6)
'
'
IN(7)
'
'
(IN(5)) resetting (active high)
'
' Main variables used:
' Program status
VR(111)
'
0
'
1
'
2
'
3
' Execution: Run program on priority 1 (lowest priority)
'####################################################################
' Initialisation of variables
'-----------------------------------------------
GOSUB init_vars
' Initialisation of serial ports
'-----------------------------------------------
GOSUB init_serial
' Initialisation axis parameters
'-----------------------------------------------
RUN "STARTUP",3
WA(5)
' Wait until process is stopped
WAIT UNTIL PROC_STATUS PROC(3) = 0
' Set ERRORMASK parameter
'-----------------------------------------------
' Following statuses will result in Motion Error:
' (bit 2) Servo Driver Communication Error
' (bit 3) Servo Driver Alarm
' (bit 8) Following Error Limit
BASE(0)
ERRORMASK = 268
' Initialisation Servo Driver
'-----------------------------------------------
' If no communication error
IF (AXISSTATUS AND 4) = 0 THEN
' Set Servo Driver parameters
RUN "INIT_DRIVER",3
WA(5)
Appendix C
Programming Examples
start_machine (active high)
Start application
e_stop (active low)
Emergency stop
Reset motion error
Initialising system
Motion & programs stopped
Normal running
Error or emergency stop
245

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

R88a-mcw151-e

Table of Contents