本文介绍了拼写语言,爱普生产品的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法构建??
你能帮我吗

I can''t build ??
can you help me

Function main 
'Controller #3 Communications 
'Address 192.168.0.13 

'Local Variables 
Integer i                                        'Used for sending test data 

'Initialization 
'Clear Flags 
' 
MemOff TCPIP_1_DR 
MemOff TCPIP_1_DTS 
MemOff TCPIP_1_HOLD 
MemOff TCPIP_2_DR 
MemOff TCPIP_2_DTS 
MemOff TCPIP_2_HOLD 

' 
'Set Up Ethernet Ports 
SetNet #203, "192.168.0.11", 2002, CRLF, NONE, 0        ' Controller #1 RC620 Controller 
SetNet #202, "192.168.0.12", 2003, CRLF, NONE, 0        ' Controller #2 RC180 Controller 
' 

Wait 1                                                                        'Wait to ensure that ports are configured 

Xqt tcpip_Controller_No1, NoEmgAbort        'Start Communication Task for Controller #1 
Xqt tcpip_Controller_No2, NoEmgAbort        'Start Communication Task for Controller #2 
Xqt EStop_Handler, NoEmgAbort                        'Start E-Stop Handler Task for this Controller 


' 
'Communications Test Loop 
Do While True 
For i = -1100 To 1000 
' 
' Communications with Controller #1 
' 
' If Data is Ready, Process It and Clear Data Ready Flag 
If MemSw(TCPIP_1_DR) Then 
      Print " Data from RC620 No 1 ", m_TCPIP_RDAT_1 
      MemOff TCPIP_1_DR 
EndIf 
' Wait Until the Data To Send flag is Clear before sending new data 
If(MemSw(TCPIP_1_DTS) = 0) Then 
      m_TCPIP_SDAT_1 = i 
      MemOn TCPIP_1_DTS 
EndIf 
' 
' 
' Communications with Controller #2 
' 
' If Data is Ready, Process It and Clear Data Ready Flag 
If MemSw(TCPIP_2_DR) Then 
      Print " Data from RC620 No 2 ", m_TCPIP_RDAT_2 
      MemOff TCPIP_2_DR 
EndIf 
' Wait Until the Data To Send flag is Clear before sending new data 
If(MemSw(TCPIP_2_DTS) = 0) Then 
      m_TCPIP_SDAT_2 = i 
      MemOn TCPIP_2_DTS 
EndIf 
' 
' 
Wait 1 

Next 
Loop 

Fend 
' 
' Communication Task for Communication with Controller #1. 
' 
Function tcpip_Controller_No1 
OnErr GoTo errhndler 
OpenNet #203 As Client 
WaitNet #203 
Integer i 
String Reply$ 

Reply$ = "Hello" 

Do While True 
      ' If the Data To Send Flag is Set, Send the Data and Clear the Flag 
      If MemSw(TCPIP_1_DTS) Then 
              Print #203, m_TCPIP_SDAT_1 
              Wait .1 
              MemOff TCPIP_1_DTS 
      EndIf 
      ' 
      ' If the Data Ready Flag Is Clear, Check for New Data and Read it. 
      If MemSw(TCPIP_1_DR) = 0 Then 
              If ChkNet(203) > 0 Then 
                      Wait .1 
                      Input #203, m_TCPIP_RDAT_1 
                      Select m_TCPIP_RDAT_1 
                              Case 911 
                                      Call R_911_Controller_1 
                              Case 101 
                                      ' 
                                      ' Do What Ever 
                              Default 
                                      'Print "No Valid Data" 
                      Send 
                      MemOn TCPIP_1_DR 
              EndIf 
        EndIf 
      Wait .1 
Loop 

errhndler: 
If Err = 2902 Then 
Print " Controller #1 disconnected " 
CloseNet #203 
Wait 2 
OpenNet #203 As Client 
WaitNet #203 
EResume Next 

EndIf 

Fend 
' 
' Communication Task for Communication with Controller #2. 
' 
Function tcpip_Controller_No2 
OnErr GoTo errhndler 
OpenNet #202 As Client 
WaitNet #202 

Do While True 
      ' If the Data To Send Flag is Set, Send the Data and Clear the Flag 
      If MemSw(TCPIP_2_DTS) Then 
              Print #202, m_TCPIP_SDAT_2 
              Wait .1 
              MemOff TCPIP_2_DTS 
      EndIf 
      ' 
      ' If the Data Ready Flag Is Clear, Check for New Data and Read it. 
      If MemSw(TCPIP_2_DR) = 0 Then 
              If ChkNet(202) > 0 Then 
                      Wait .1 
                      Input #202, m_TCPIP_RDAT_2 
                      Select m_TCPIP_RDAT_2 
                              Case 911 
                                      Call R_911_Controller_2 
                              Case 912 
                                      Call R_912_Controller_2 
                              Case 101 
                                      ' 
                                      ' Do What Ever 
                              Default 
                                      'Print "No Valid Data" 
                      Send 
                      MemOn TCPIP_2_DR 
              EndIf 
        EndIf 
      Wait .1 
Loop 
errhndler: 
If Err = 2902 Then 
      Print " Controller #2 DISCONNECTED Will Re Connect in 2 seconds " 
      CloseNet #202 
      Wait 2 
      OpenNet #202 As Client 
      WaitNet #202 
      EResume Next 
EndIf 
Fend 
Function EStop_Handler 
Wait EStopOn = True 
Quit main 
m_TCPIP_SDAT_1 = 911 
MemOn TCPIP_1_DTS 
m_TCPIP_SDAT_2 = 911 
MemOn TCPIP_2_DTS 

Wait 1 
Quit All 
Fend 

Function R_911_Controller_1 
MemOff TCPIP_1_DTS 
MemOn TCPIP_1_HOLD 
'Wait 1 
CloseNet #203 
Print "E-Stop Controller RC620 No 1 ", m_TCPIP_RDAT_1 
Wait 5 
OpenNet #203 As Client 
WaitNet #203 
Wait 1 
MemOff TCPIP_1_HOLD 
Fend 
Function R_911_Controller_2 
MemOff TCPIP_2_DTS 

Wait 1 
CloseNet #202 
Print "E-Stop Controller RC620 No 2 ", m_TCPIP_RDAT_2 
Wait 5 
OpenNet #202 As Client 
WaitNet #202 
Wait 1 

Fend 
Function R_912_Controller_2 
MemOff TCPIP_2_DTS 

Wait 1 
CloseNet #202 
Print "SafeGuard Received form Controller #2", m_TCPIP_RDAT_2 
Wait 2 
OpenNet #202 As Client 
WaitNet #202 
Wait 1 

Fend

推荐答案



这篇关于拼写语言,爱普生产品的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 10:01