Appendix DSample Programs Including Commands for Host Computer
125
Program Example 2: Data Reading from Host Computer (RECV)
In this example, the RECV instruction enables the designated PC data to be read and stored in the DM area.
Ladder Program for PC
When bit 0000 is ON, 6-word data is read from the host computer connected to port 1 of the Host Link Unit of unit
address 10, node 0, network address 0 and stored in and after DM 00100.
(030)
MOV #0006 D00200
0000
00
(030)
MOV #0100 D00201
(O30)
MOV #0010 D00202
(030)
MOV #0000 D00203
(193)
RECV 0000 D00100 D00200
(030)
MOV #0000 D00204
Contents of Control Data
Word Data Meaning
D00200 0006 No. of words transferred: 6
D00201 0100 Port 1 of Host Link Unit Network address: 0
D00202 0010 Node address: 0 Unit address of Host Link Unit: 10
D00203 0000 With response; communications port: 0 No. of re-transmitting operations: 0
D00204 0000 Response monitor time: 0000 (2 s)
BASIC Program for Host Computer
10 ’*************************************************************
20 ’***** CV Host Link Unit (CV500-LK201) *****
30 ’***** Command (RECV instruction) for Host Computer *****
40 ’***** Sample Reception Program *****
50 ’*************************************************************
60 ’*****************************************
70 ’********** Initial setting **********
80 ’*****************************************
90 CLOSE 1
100 ON ERROR GOTO *EROPE
110 DIM CHDATA$(300) :’Array declaration of the data.
120 CHDATA$(0)=”0000”:CHDATA$(1)=”1111”:CHDATA$(2)=”2222”
130 CHDATA$(3)=”3333”:CHDATA$(4)=”4444”:CHDATA$(5)=”5555”
140 OPEN ”COM:E73” AS #1 :’Opens the port.
150 ’*****************************************
160 ’********** Main processing **********
170 ’*****************************************
180 RESPDATA$=””