Suspend/Resume Serial Port
Suspends or resumes the serial port with the specified name. The port needs to be opened first.
Suspend/Resume Serial Port [ Select ; Result (error) ; Action ; Portname ]
|Select entire contents||replaces the entire contents of a field with the result. If not checked the result replaces the currently selected portion of the field|
|Result (error)||an error code|
|Action||select "Suspend" to suspend reading the incoming stream of data or select "Resume" to resume reading the incoming stream of data|
|Portname||the name of the serial port to control|
Data type returned
The returned result is an error code. An error always starts with 2 dollars, followed by the error code. Returned error codes can be:
|0||no error||the action was performed|
|$$-28||notOpenErr||the port is not open|
|$$-50||paramErr||there was an error with the parameter|
Other errors may be returned.
Troi Serial Plug-in 5.0
FileMaker Pro 16 to 19
The buffer will be emptied when the port is suspended. So when you resume, only the data received after you resume will be available. While suspended you can still send data to the serial port.
This script step is very useful for devices that send out continuous data, like an electronic weighing scale. See the Weigh.fmp12 example file.
The port needs to be opened first (see also the “Open Serial Port” script step).
Suspend/Resume Serial Port [ Select ; $ErrorCode ; Suspend ; "COM1" ]
This will suspend the incoming stream of data of port COM1.
For devices that send out continuous data, like an electronic weighing scale, you open the port and suspend the incoming data. Then when you want a reading you resume the incoming stream. The script will be like this:
Open Serial Port [ Select ; $ErrorCode ; $PortName ; $Settings ; "" ; "" ] Suspend/Resume Serial Port [ Select ; $ErrorCode ; Suspend ; $PortName ] # Do other stuff here, until you need data from the device ... # Now resume the serial port: Suspend/Resume Serial Port [ Select ; $ErrorCode ; Resume ; $PortName ] # Read data until you got the expected data: Receive Serial Data [ $PortName ] # Next line will suspend reception of data from the port in variable $PortName: Suspend/Resume Serial Port [ Select ; $ErrorCode ; Suspend ; $PortName ]
Related script step
|Open Serial Port|