![Mitsubishi Electric CR750 Series Instruction Manual Download Page 370](http://html.mh-extra.com/html/mitsubishi-electric/cr750-series/cr750-series_instruction-manual_238840370.webp)
4-350
Detailed explanation of Robot Status Variable
M_Open
[Function]
Returns the status indicating whether or not a file or communication line is opened.
[Format]
[Terminology]
<Numerical variable>
Specify the numerical variable to substitute.
<File number>
Specify the file number 1-8 by constant value of communication line opened by
Open command. The default value is 1. If 9 or more are specified, the error will
occur when executing.
[Reference Program]
1 Open "COM2:" AS #1
' Open the communication line COM2 as the file number 1.
2 *LBL:If M_Open(1)<>1 Then GoTo *LBL
' Wait until the file number 1 opens.
<Using the ethernet I/F>
1 ' Client Program ----------------
2 M1=0
3 M_Timer(1)=0
’Resets the timer to 0.
4 *O1
5 Open "COM2:" As #1
’Opens the line.
6 If M_Timer(1)>10000.0 Then *E1
’Jumps when 10 seconds elapses.
7 If M_Open(1)<>1 Then Goto *O1
’Loops if no connection is made.
8 Def Act 1,M_Open(1)=0 GoSub *E2 ’Monitors the down state of the server using an interrupt.
9 Act 1=1
’Starts monitoring.
10 *M1
11 M1=M1+1
12 If M1<10 Then C1$="MELFA" Else C1$="END" ’Sends END after sending the "MELFA" string nine
times.
13 Print #1,C1$
’Sends a character string.
14 Input #1,C2$
’Receives a character string.
15 If C1$="END" Then *C1
’Jumps to CLOSE after sending "END."
16 GoTo *M1
’Loops.
17 *C1
18 Close #1
’Closes the line.
19 Hlt
’Halts the program.
20 End
’Ends.
21 *E1
22 Error 9100
’Generates error 9100 if no connection can be made to the server.
23 Close #1
24 Hlt
25 End
26 *E2
27 Error 9101
’Generates error 9101 if the server is down during processing.
28 Close #1
29 Hlt
30 End
Example)<Numerical variable>=M_Open [<File number>]