Example Computer Program For Loopback Test - Mitsubishi Electric MELSEC FX Series User Manual

Programmable logic controllers
Hide thumbs Also See for MELSEC FX Series:
Table of Contents

Advertisement

FX communication
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
Item
Communication
method
Synchronizing
method
Baud rate
Start bit
Data length
Parity bit
Stop bit
Sum check
Station No.
Exclusive protocol
format
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
2 ) Program example
10 T0 = 3000
20 STCNT = 14
30 NACNT = 7
40 ERFLG = 0
50 ENQ$ = CHR$(5)
60 STX$ = CHR$(2)
70 ETX$ = CHR$(3)
80 NAK$ = CHR$(&H15)
90 *DATASEND
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$
Description
Half-duplex communication
method
Start-stop synchronization
method
9600 bps
1 bit
7 bit
None
1 bit
Sum check is used
Station No.0
Format 1
For setting and details, see chapter 6, and section 7.4.
: ' Reception wait counter (adjusted depending on computer speed)
: ' Normal data length
: ' Data length of error code (NAK statement)
Personal
computer
PC-IF
: ' Data transmission
Computer link 7
4
8
FX series
485
5
programmable
A
controller
D
P
Transmission data
0 0 F F T T 2
0 4
A B C D 3 4
7-18

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Rs-232cRs-422Rs-485

Table of Contents