Skip to main content

Serial_Debug (function reference)

By July 1, 2023July 17th, 2023Online Help, Troi Serial Plug-in
Troi Serial Plug-in for FileMaker Pro

Serial_Debug

Use this function to troubleshoot the serial port and test scripting.

SyntaxFunction badge

Serial_Debug ( switches )

Parameters

switches determines the behaviour of the function

Switches

switches can be one of this:

-BeepWhenDataArrives the plug-in will beep when data arrives at the serial port
-BeepOff the plug-in no longer beeps when data arrives at the serial port
-TestTriggerScript the plug-in will trigger the dispatch script with some test data

You can also add this switch in combination with the -TestTriggerScript switch:

-UseTextAllBytes0To255 sends a string with all bytes from 0-255 as the test data to the trigger script

Returned Result

Data type returned

Error code

Result

If successful it returns 0. If unsuccessful it returns an error code starting with $$ and the error code. Returned error codes can be:

$$-28 notOpenErr make sure you have opened a port and specified a dispatch script
$$-50 paramErr there was an error with the parameter (an unknown switch was given)

Other errors may be returned.

Originated in

Troi Serial Plug-in 3.0

Compatibility

FileMaker Pro 16 to FileMaker Pro 2023

Considerations

To be able to test the trigger script the serial port must be opened and a dispatch script must be specified.

See the Debug.fmp12 example file.

NOTE The wait time to trigger the script is now 5 seconds (was 10 seconds).

Example

Set Field [ gErrorCode ; Serial_Debug ( "-BeepWhenDataArrives" ) ]

The plug-in will now beep when data arrives at the serial port. If data keeps on coming in, the plug-in will beep every 2 seconds.

How to test if data comes in:
– Set the plug-in to beep if data comes in.
– Get the device attached to the serial port to send data to the serial port.
– When you hear beeps you know data is arriving at the serial port and in the plug-in.
– To stop the beeping use this command:

Set Field [ gErrorCode ; Serial_Debug ( "-BeepOff" ) ]

Example 2

Serial_Debug ( "-TestTriggerScript" )

will trigger the dispatch script after 5 seconds.

You can also give this command:

Serial_Debug ( "-TestTriggerScript -UseTextAllBytes0To255" )

This will trigger the dispatch script after 5 seconds, the data received is a string with all the bytes from 0 to 255.

Used in example file

Debug.fmp12

Related script stepsScript step badge

Beep for Serial Data
Trigger Serial Test Script

Related topics

Troi Serial Plug-in online help (overview)


Online Help Page for Troi Serial Plug-in for 16 to 2023 –> Serial_Debug (serip4803) 2023-0717 12:47:42