Difference between revisions of "Component: UART SCADA (CAL) (Misc)"
From Flowcode Help
Jump to navigationJump to searchLine 16: | Line 16: | ||
==Component Source Code== | ==Component Source Code== | ||
+ | |||
+ | Please click here to download the component source project: [https://www.flowcode.co.uk/wikicopy/componentsource/FC_Comp_Source_UART_SCADA.fcfx FC_Comp_Source_UART_SCADA.fcfx] | ||
Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_UART_SCADA.fcfx FC_Comp_Source_UART_SCADA.fcfx] | Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_UART_SCADA.fcfx FC_Comp_Source_UART_SCADA.fcfx] | ||
==Detailed description== | ==Detailed description== | ||
+ | |||
+ | |||
Line 40: | Line 44: | ||
==Examples== | ==Examples== | ||
+ | |||
+ | |||
Line 62: | Line 68: | ||
==Macro reference== | ==Macro reference== | ||
+ | |||
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendString''' | ||
+ | |- | ||
+ | | colspan="2" | Transmits a string of bytes via the UART peripheral | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING | ||
+ | | width="90%" | Data | ||
+ | |- | ||
+ | | colspan="2" | Data String to transmit | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
+ | |||
+ | |||
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Receive''' | ||
+ | |- | ||
+ | | colspan="2" | Receive a Character | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | ||
+ | | width="90%" | Timeout | ||
+ | |- | ||
+ | | colspan="2" | Period to wait for the character to be received | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-s16-icon.png]] - INT | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
+ | |||
+ | |||
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ScanForDeviceID''' | ||
+ | |- | ||
+ | | colspan="2" | Checks to see if a device VID/PID string is present and returns the COM port number. Returns 0 if device not found. | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING | ||
+ | | width="90%" | HWID | ||
+ | |- | ||
+ | | colspan="2" | Example: "VID_12BF&PID_0101" | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
+ | |||
+ | |||
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Send''' | ||
+ | |- | ||
+ | | colspan="2" | Send the Character | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | ||
+ | | width="90%" | Char | ||
+ | |- | ||
+ | | colspan="2" | The Character to send | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
+ | |||
+ | |||
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetConsoleHandle''' | ||
+ | |- | ||
+ | | colspan="2" | | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-h32-icon.png]] - HANDLE | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
+ | |||
+ | |||
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendByteArray''' | ||
+ | |- | ||
+ | | colspan="2" | Transmits an array of bytes via the UART peripheral | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | Data | ||
+ | |- | ||
+ | | colspan="2" | Data to transmit | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | ||
+ | | width="90%" | NumBytes | ||
+ | |- | ||
+ | | colspan="2" | Number of bytes to send from the array | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
+ | |||
+ | |||
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Init''' | ||
+ | |- | ||
+ | | colspan="2" | Initialize the component with the specified properties | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
+ | |||
+ | |||
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Uninit''' | ||
+ | |- | ||
+ | | colspan="2" | Un-initialize the UART and release the resources | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
+ | |||
+ | |||
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReceiveByteArray''' | ||
+ | |- | ||
+ | | colspan="2" | Receives an array of bytes and returns the number of bytes received. | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" | Data | ||
+ | |- | ||
+ | | colspan="2" | A byte array variable to hold the received data | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | ||
+ | | width="90%" | NumBytes | ||
+ | |- | ||
+ | | colspan="2" | Maximum number of bytes to try and receive | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | ||
+ | | width="90%" | Timeout | ||
+ | |- | ||
+ | | colspan="2" | Max amount of time in ms to wait between bytes | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
+ | |||
+ | |||
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReceiveString''' | ||
+ | |- | ||
+ | | colspan="2" | Receives a string of bytes and returns the number of bytes received. | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING | ||
+ | | width="90%" | StringData | ||
+ | |- | ||
+ | | colspan="2" | | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | ||
+ | | width="90%" | NumBytes | ||
+ | |- | ||
+ | | colspan="2" | Maximum number of bytes to try and receive | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT | ||
+ | | width="90%" | Timeout | ||
+ | |- | ||
+ | | colspan="2" | Max amount of time in ms to wait between bytes | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ==Property reference== | ||
+ | |||
+ | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties''' | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-7-icon.png]] | ||
+ | | width="90%" | Component Enable | ||
+ | |- | ||
+ | | colspan="2" | A global flag to enable or disable the UART component from producing code. Useful for generating components with multiple communications options. | ||
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]] | ||
+ | | width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Runtime | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-7-icon.png]] | ||
+ | | width="90%" | Console Data | ||
+ | |- | ||
+ | | colspan="2" | Selects if the console data is automatically generated or not | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-21-icon.png]] | ||
+ | | width="90%" | Console Columns | ||
+ | |- | ||
+ | | colspan="2" | Number of characters that can be displayed on a single line of the console. | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-7-icon.png]] | ||
+ | | width="90%" | Auto Close | ||
+ | |- | ||
+ | | colspan="2" | Auto close the port on Sim stop event | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | ||
+ | | width="90%" | Data Source | ||
+ | |- | ||
+ | | colspan="2" | Simulation data source used to allow the component to connect to various remote devices Nothing - Simulation data is ignored COM port - Routes the communication data to and from a physical or virtual COM port Injector - Routes the communication data via a data injector component on the Panel. | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | ||
+ | | width="90%" | COM Port | ||
+ | |- | ||
+ | | colspan="2" | Lists all the current available COM port hardware on your PC. | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-7-icon.png]] | ||
+ | | width="90%" | Refresh Ports | ||
+ | |- | ||
+ | | colspan="2" | | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-type-21-icon.png]] | ||
+ | | width="90%" | Baud Rate | ||
+ | |- | ||
+ | | colspan="2" | COM port data rate in bits per second | ||
+ | |}==Macro reference== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" |
Revision as of 15:25, 20 January 2023
Author | Matrix TSL |
Version | 2.1 |
Category | Misc |
Contents
UART SCADA component
CAL = Code Abstraction Layer - Allows one code base to run on a wide range of chips. A low level implementation giving direct access to the UART peripheral. Includes simulation functionality to commmunicate via a COM port or an Injector component. Also includes timestamped logging via the console and Data Recorder trace monitoring support.
Component Source Code
Please click here to download the component source project: FC_Comp_Source_UART_SCADA.fcfx
Please click here to view the component source code (Beta): FC_Comp_Source_UART_SCADA.fcfx
Detailed description
No detailed description exists yet for this component
Examples
No additional examples
Macro reference
SendString | |
Transmits a string of bytes via the UART peripheral | |
- STRING | Data |
Data String to transmit | |
- VOID | Return |
Receive | |
Receive a Character | |
- UINT | Timeout |
Period to wait for the character to be received | |
- INT | Return |
ScanForDeviceID | |
Checks to see if a device VID/PID string is present and returns the COM port number. Returns 0 if device not found. | |
- STRING | HWID |
Example: "VID_12BF&PID_0101" | |
- BYTE | Return |
Send | |
Send the Character | |
- UINT | Char |
The Character to send | |
- VOID | Return |
GetConsoleHandle | |
- HANDLE | Return |
SendByteArray | |
Transmits an array of bytes via the UART peripheral | |
- BYTE | Data |
Data to transmit | |
- UINT | NumBytes |
Number of bytes to send from the array | |
- VOID | Return |
Init | |
Initialize the component with the specified properties | |
- VOID | Return |
Uninit | |
Un-initialize the UART and release the resources | |
- VOID | Return |
Property reference
==Macro reference==
SendString | |
Transmits a string of bytes via the UART peripheral | |
- STRING | Data |
Data String to transmit | |
- VOID | Return |
Receive | |
Receive a Character | |
- UINT | Timeout |
Period to wait for the character to be received | |
- INT | Return |
ScanForDeviceID | |
Checks to see if a device VID/PID string is present and returns the COM port number. Returns 0 if device not found. | |
- STRING | HWID |
Example: "VID_12BF&PID_0101" | |
- BYTE | Return |
Send | |
Send the Character | |
- UINT | Char |
The Character to send | |
- VOID | Return |
GetConsoleHandle | |
- HANDLE | Return |
SendByteArray | |
Transmits an array of bytes via the UART peripheral | |
- BYTE | Data |
Data to transmit | |
- UINT | NumBytes |
Number of bytes to send from the array | |
- VOID | Return |
Init | |
Initialize the component with the specified properties | |
- VOID | Return |
Uninit | |
Un-initialize the UART and release the resources | |
- VOID | Return |
Property reference
==Macro reference==
SendString | |
Transmits a string of bytes via the UART peripheral | |
- STRING | Data |
Data String to transmit | |
- VOID | Return |
Receive | |
Receive a Character | |
- UINT | Timeout |
Period to wait for the character to be received | |
- INT | Return |
ScanForDeviceID | |
Checks to see if a device VID/PID string is present and returns the COM port number. Returns 0 if device not found. | |
- STRING | HWID |
Example: "VID_12BF&PID_0101" | |
- BYTE | Return |
Send | |
Send the Character | |
- UINT | Char |
The Character to send | |
- VOID | Return |
GetConsoleHandle | |
- HANDLE | Return |
SendByteArray | |
Transmits an array of bytes via the UART peripheral | |
- BYTE | Data |
Data to transmit | |
- UINT | NumBytes |
Number of bytes to send from the array | |
- VOID | Return |
Init | |
Initialize the component with the specified properties | |
- VOID | Return |
Uninit | |
Un-initialize the UART and release the resources | |
- VOID | Return |