![background image](http://html1.mh-extra.com/html/omron/r88a-mcw151-drt-e/r88a-mcw151-drt-e_operation-manual_742243267.webp)
252
Programming Examples
Appendix C
A registration process checks the position of the product on the conveyor and calculates the amount that con-
veyor A must be advanced or retarded in order to align with conveyor B. Input 1 indicates that the registration
process has been completed and the correction amount loaded serially into VR(1).
setup:
BASE(0)
CONNECT(1,1)
ADDAX(2)
BASE(2)
loop:
IF IN(1) = ON THEN WAIT UNTIL IN(1) = OFF
WAIT UNTIL IN(1) = ON
correction = VR(1)
MOVE(correction)
WAIT IDLE
GOSUB do_transfer
GOTO loop
do_transfer:
OP(15,ON)
WA(500)
OP(15,OFF)
RETURN
Example 8: Coordinating Motion with Mark Detection
A cyclic cut-to-length operation requires a rolled product to be cut in relation to a printed mark.
The product is nominally 150 mm long and the printed registration mark appears 30 mm from the end of the
product. The product must be stationary when cut, but the draw motion should be one continuous move.
A high-speed optical sensor is connected to the registration input of the feed axis.
loop:
REGIST(3)
DEFPOS(0)
MOVE(150)
WAIT UNTIL MARK
MOVEMODIFY(30)
WAIT IDLE
GOSUB cut_operation
GOTO loop
cut_operation:
’Omitted from this example.
RETURN
Example 9: Host Link Master Program
The following program shows a possible implementation of the Host Link protocol. The user program should
contain a mechanism of error checking and possibly retries.
' Configure serial port 2:
SETCOM(9600,7,2,2,2,6)
' Set timeout time to 500 servo cycles
HLM_TIMEOUT=500
' Define attempt counter
attempt=1
loop:
' Read data (2 words) from the PC CIO/IR area (address 2)