Jump to content

Component: UART (CAL) (Misc): Difference between revisions

From Flowcode Help
m Text replacement - "style="background-color:#EAE1EA; color:#4B008D;"" to "class="mtx-class-propfolder""
m Text replacement - "style="background-color:#EAE1EA;"" to "class="mtx-class-propfolder""
 
Line 418: Line 418:
| colspan="2" | A global flag to enable or disable the UART component from producing code. Useful for generating components with multiple communications options. 
| 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="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]]
| width="90%" class="mtx-class-propfolder" | Connections
| width="90%" class="mtx-class-propfolder" | Connections
|-
|-
Line 432: Line 432:
| colspan="2" | If set compares to the info section in the FCD to allow for auto connection to the correct channel 
| colspan="2" | If set compares to the info section in the FCD to allow for auto connection to the correct channel 
|-
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]]
| width="90%" class="mtx-class-propfolder" | Transmit
| width="90%" class="mtx-class-propfolder" | Transmit
|-
|-
Line 451: Line 451:
| colspan="2" | Decides what to do if there is more then one byte to send or if the UART is already transmitting data. No: When additional data is transmitted the processor will sit and wait for the data to be sent. Yes: The data to be sent will be placed into a buffer allowing the processor to continue with other things, the buffer will automatically empty itself using a UART TX interrupt. 
| colspan="2" | Decides what to do if there is more then one byte to send or if the UART is already transmitting data. No: When additional data is transmitted the processor will sit and wait for the data to be sent. Yes: The data to be sent will be placed into a buffer allowing the processor to continue with other things, the buffer will automatically empty itself using a UART TX interrupt. 
|-
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]]
| width="90%" class="mtx-class-propfolder" | Receive
| width="90%" class="mtx-class-propfolder" | Receive
|-
|-
Line 470: Line 470:
| colspan="2" | Decides what to do when data is received. No: The UART must be regularily polled or the user must enable their own receive interrupt to catch data as it comes in. Yes: The received data will be placed into a buffer using a UART RX interrupt. 
| colspan="2" | Decides what to do when data is received. No: The UART must be regularily polled or the user must enable their own receive interrupt to catch data as it comes in. Yes: The received data will be placed into a buffer using a UART RX interrupt. 
|-
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]]
| width="90%" class="mtx-class-propfolder" | Flow Control
| width="90%" class="mtx-class-propfolder" | Flow Control
|-
|-
Line 479: Line 479:
| colspan="2" | Flow Control (Handshake) enable or disable.    On: Two I/O pins are used to control the flow of data in and out of the device.    Off: Flow control is disabled. 
| colspan="2" | Flow Control (Handshake) enable or disable.    On: Two I/O pins are used to control the flow of data in and out of the device.    Off: Flow control is disabled. 
|-
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]]
| width="90%" class="mtx-class-propfolder" | Options
| width="90%" class="mtx-class-propfolder" | Options
|-
|-
Line 513: Line 513:
| colspan="2" | Automatic receive interrupt mode enable or disable. Used on components such as the GSM or GPS where data can come in at any time. Software channel is disabled when interrupt is enabled, for interrupt with a software channel use an I/O edge triggered interrupt. 
| colspan="2" | Automatic receive interrupt mode enable or disable. Used on components such as the GSM or GPS where data can come in at any time. Software channel is disabled when interrupt is enabled, for interrupt with a software channel use an I/O edge triggered interrupt. 
|-
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="10%" align="center" class="mtx-class-propfolder" | [[File:Fc9-conn-icon.png]]
| width="90%" class="mtx-class-propfolder" | Simulation
| width="90%" class="mtx-class-propfolder" | Simulation
|-
|-

Latest revision as of 14:37, 13 July 2026

Author Matrix TSL
Version 19.3
Category Misc


UART 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.

Version information

Library Version, Component Version, Date, Author, Info
14, 2.2, 04-11-24, BR, Added pin caption to the remap port pin selection property
15, 2.2, 04-11-24, BR, Cleaned up pin caption from none remap port pin property
16, 2.2, 15-11-24, BR, Minor change to reflect changes to I2C CAL component
17, 2.3, 06-05-25, BR, Added filter to allow for automatic channel setup based on FCD and component
18, 2.3, 15-07-25, BR, Sorted the remap pin properties by port pin
19, 2.3, 11-08-25, MW, Changed fcdhelper properties to invisible as text is appearing on other projects

Detailed description

No detailed description exists yet for this component

Examples

No additional examples









Macro reference

ControlPin

ControlPin
Allows direct control over the TX and RTS pins Also allows for reading of the state of the RX and CTS pins. Only available when the UART is uninitialised.  
- BYTE Pin
0=TX, 1=RX, 2=RTS, 3=CTS 
- BYTE State
 
- BYTE Return


Delay

Delay
Software UART Bit Delay 
- VOID Return


GetConsoleHandle

GetConsoleHandle
 
- HANDLE Return


GetList

GetList
Gets Named property List 
- STRING Name
 
- STRING Return


GetValue

GetValue
Get Value of Named property 
- STRING Name
 
- STRING Return


Init

Init
Initialize the component with the specified properties 
- VOID Return


Receive

Receive
Receive a Character 
- BYTE Timeout
Period to wait for the character to be received 
- INT Return


ReceiveByteArray

ReceiveByteArray
Receives an array of bytes and returns the number of bytes received. 
- BYTE Data
 
- UINT NumBytes
Maximum number of bytes to try and receive 
- BYTE Timeout
Max amount of time in ms to wait between bytes 
- BYTE Return


ReceiveString

ReceiveString
Receives a string of bytes and returns the number of bytes received. 
- STRING StringData
 
- UINT NumBytes
Maximum number of bytes to try and receive 
- BYTE Timeout
Max amount of time in ms to wait between bytes 
- BYTE Return


Send

Send
Send the Character  
- UINT Char
The Character to send 
- VOID Return


SendByteArray

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


SendNumber

SendNumber
Transmits a numeric value as an ASCII string 
- LONG Number
Numeric value to send 
- VOID Return


SendString

SendString
Transmits a string of bytes via the UART peripheral 
- STRING Data
Data String to transmit 
- VOID Return


SetValue

SetValue
set Value of Named property 
- STRING Name
 
- STRING Value
 
- VOID Return


TestProperty

TestProperty
A simple macro to allow us to test the value of a single property during runtime. 
- BYTE Property
0=UseTX, 1=UseRX, 2=UseFlowControl 
- BYTE Return


Uninit

Uninit
Un-initialize the UART and release the resources 
- VOID Return


UpdateBaud

UpdateBaud
Changes the UART Baud rate. 0=1200, 1=2400, 2=4800, 3=9600, 4=19200, 5=38400, 6=57600, 7=115200, 8=250000 
- BYTE new_baud
0=1200, 1=2400, 2=4800, 3=9600, 4=19200, 5=38400, 6=57600, 7=115200, 8=250000 
- VOID Return


Property reference

Properties
Component Enable
A global flag to enable or disable the UART component from producing code. Useful for generating components with multiple communications options. 
Connections
Channel
UART Channel selector Software channels are bit banged using generic I/O pins but are not as reliable as hardware channels. Hardware channels use the selected peripheral on-board the target microcontroller. 
Filter
If set compares to the info section in the FCD to allow for auto connection to the correct channel 
Transmit
Use TX
Selects if the Transmit pin is used by the component. Yes: The TX pin is active and used to transmit data for the UART. No: The TX pin is disabled and free to be used as general I/O. 
TX
Pin to be used for Transmit data 
Use TX Buffer
Decides what to do if there is more then one byte to send or if the UART is already transmitting data. No: When additional data is transmitted the processor will sit and wait for the data to be sent. Yes: The data to be sent will be placed into a buffer allowing the processor to continue with other things, the buffer will automatically empty itself using a UART TX interrupt. 
Receive
Use RX
Selects if the Receive pin is used by the component. Yes: The RX pin is active and used to receive data for the UART. No: The RX pin is disabled and free to be used as general I/O. 
RX
Pin to be used for Receive data 
Use RX Buffer
Decides what to do when data is received. No: The UART must be regularily polled or the user must enable their own receive interrupt to catch data as it comes in. Yes: The received data will be placed into a buffer using a UART RX interrupt. 
Flow Control
Use Flow Control
Flow Control (Handshake) enable or disable. On: Two I/O pins are used to control the flow of data in and out of the device. Off: Flow control is disabled. 
Options
Baud Options
Baud rate option selector 
Baud Rate
 
Data Bits
Number of data bits 
Return
Return data width from Receive macro. 8-bit data mode always returns a byte ranging from 0-255, 255 could mean a timeout or could be a valid data. 16-bit data mode rereturns 0-255 for valid data, 256 for a timeout, return data must be stored into an INT or UINT variable. 
Echo
Automatically echoes back any received data when enabled by re-transmitting the received byte. 
Interrupt
Automatic receive interrupt mode enable or disable. Used on components such as the GSM or GPS where data can come in at any time. Software channel is disabled when interrupt is enabled, for interrupt with a software channel use an I/O edge triggered interrupt. 
Simulation
Scope Traces
Selects if the scope traces are automatically added to the data recorder window or not. Simulation - draws an approximation of the UART data onto the scope trace. ICT - sets up the scope trace for incoming data and adds UART packet decoding at the correct BAUD. 
Console Data
Selects if the console data is automatically generated or not 
Console Format
Controls if the data is shown as a log with time and date stamps or just as raw data 
Console Columns
Number of characters that can be displayed on a single line of the console. 
Data Source
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 API - Routes the communication data via a data injector component on the Panel. 

Component Source Code

Please click here to download the component source project: FC_Comp_Source_UART.fcfx

Please click here to view the component source code (Beta): FC_Comp_Source_UART.fcfx