WWW.NNC.IR
Macro Reference
652
Vision System FH/FZ5 Series
User’s Manual (Z340)
Example
Receives data from an external device in the measurement process of the unit macro.
Useable Modules
Scene Control Macro / Communication Command Macro / Unit Macro
Supported Versions
Version 3.50 or later
Related Items
Rem Prepare a buffer that can receive 12 bytes of data.
Dim BUFFER&(11)
IOMODULE$ = "TcpNormal"
Rem Set the polling state of the communication module to stopped in order to receive the data.
SetPollingState IOMODULE$, False
Rem Executing the initialization of the reception data size.
SIZE& = 0
Repeat the reception process until the data has been received.
Try
Do
Rem Attempting the data reception.
ReceiveData IOMODULE$, BUFFER&(), 12, SIZE&
Rem Once the data has been received, display the data size in the system status console window.
If(SIZE& > 0) Then
Print "Received data size = " + Str$(SIZE&)
Endif
Loop While SIZE& = 0
Rem Data has been received, so set the polling state of the communication module to running.
SetPollingState IOMODULE$, True
Catch
Rem Return the polling state of the stopped communication module to running.
If GetPollingState(IOMODULE$) = False Then
SetPollingState IOMODULE$, True
Endif
End Try
GetPollingState (Reference: X Details (p.540)) SendData (Reference: X Details (p.696))
SendString (Reference: X Details (p.698)) SetPollingState (Reference: X Details (p.711))