User`s manual
FX communication
Computer link 7
7-18
7.8 Example Computer Program for Loopback Test
This is an example of a BASIC program for communication of the computer link using a
computer, programmable controller 485PC-IF, and 485ADP. (not used outside Japan.)
Pleas see loopback test command see section 8.11.
1 ) Setting of transmission specification
2 ) Program example
Personal
computer
485
PC-IF
FX series
programmable
controller
4
8
5
A
D
P
Item Description
Communication
method
Half-duplex communication
method
Synchronizing
method
Start-stop synchronization
method
Baud rate 9600 bps
Data format
Start bit 1 bit
Data length 7 bit
Parity bit None
Stop bit 1 bit
Sum check Sum check is used
Station No. Station No.0
Exclusive protocol
format
Format 1
According to the above transmission specification, the transmission specification and
transmission procedure of the programmable controller are set as follows.
D8120 = H6080
D8121 = H0000
D8129 = K0
For setting and details, see chapter 6, and section 7.4.
10 T0 = 3000 :
′
Reception wait counter (adjusted depending on computer speed)
20 STCNT = 14 :
′
Normal data length
30 NACNT = 7 :
′
Data length of error code (NAK statement)
40 ERFLG = 0
50 ENQ$ = CHR$(5)
60 STX$ = CHR$(2)
70 ETX$ = CHR$(3)
80 NAK$ = CHR$(&H15)
90 *DATASEND :
′
Data transmission
100 CLOSE #1
110 OPEN
″
COM1
″
:
″
AS#1
″
120 SENDDATA$ =
″
00FFTT204ABCD34
″
:
′
Transmission data
130 PRINT #1, ENQ$; SENDDATA$;
140 *REC0:
′
Reception of first character
150 RVCNT = 1
160 GOSUB *RECWAIT
170 IF ERFLG = 99 THEN GOTO ERRORFIN1
180 BUF$ = RCV$
0 0 F F T T 2 A B C D 3 4
Station No.
PLC No.
Command
Data wait
Character
0 4
Number of characters
Sum check code
Transmission data