Component: UART (CAL) (Misc)

From Flowcode Help
Jump to navigationJump to search
Author Matrix TSL
Version 2.2
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.

Detailed description

No detailed description exists yet for this component

Examples

No additional examples









Macro reference

ControlPin

Fc9-comp-macro.png 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.  
Fc9-u8-icon.png - BYTE Pin
0=TX, 1=RX, 2=RTS, 3=CTS 
Fc9-u8-icon.png - BYTE State
 
Fc9-u8-icon.png - BYTE Return


Delay

Fc9-comp-macro.png Delay
Software UART Bit Delay 
Fc9-void-icon.png - VOID Return


GetConsoleHandle

Fc9-comp-macro.png GetConsoleHandle
 
Fc9-h32-icon.png - HANDLE Return


GetList

Fc9-comp-macro.png GetList
Gets Named property List 
Fc9-string-icon.png - STRING Name
 
Fc9-string-icon.png - STRING Return


GetValue

Fc9-comp-macro.png GetValue
Get Value of Named property 
Fc9-string-icon.png - STRING Name
 
Fc9-string-icon.png - STRING Return


Init

Fc9-comp-macro.png Init
Initialize the component with the specified properties 
Fc9-void-icon.png - VOID Return


Receive

Fc9-comp-macro.png Receive
Receive a Character 
Fc9-u8-icon.png - BYTE Timeout
Period to wait for the character to be received 
Fc9-s16-icon.png - INT Return


ReceiveByteArray

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


ReceiveString

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


Send

Fc9-comp-macro.png Send
Send the Character  
Fc9-u16-icon.png - UINT Char
The Character to send 
Fc9-void-icon.png - VOID Return


SendByteArray

Fc9-comp-macro.png SendByteArray
Transmits an array of bytes via the UART peripheral 
Fc9-u8-icon.png - BYTE Data
Data to transmit 
Fc9-u16-icon.png - UINT NumBytes
Number of bytes to send from the array 
Fc9-void-icon.png - VOID Return


SendNumber

Fc9-comp-macro.png SendNumber
Transmits a numeric value as an ASCII string 
Fc9-s32-icon.png - LONG Number
Numeric value to send 
Fc9-void-icon.png - VOID Return


SendString

Fc9-comp-macro.png SendString
Transmits a string of bytes via the UART peripheral 
Fc9-string-icon.png - STRING Data
Data String to transmit 
Fc9-void-icon.png - VOID Return


SetValue

Fc9-comp-macro.png SetValue
set Value of Named property 
Fc9-string-icon.png - STRING Name
 
Fc9-string-icon.png - STRING Value
 
Fc9-void-icon.png - VOID Return


TestProperty

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


Uninit

Fc9-comp-macro.png Uninit
Un-initialize the UART and release the resources 
Fc9-void-icon.png - VOID Return


UpdateBaud

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


Property reference

Fc9-prop-icon.png Properties
Fc9-type-7-icon.png Component Enable
A global flag to enable or disable the UART component from producing code. Useful for generating components with multiple communications options. 
Fc9-conn-icon.png Connections
Fc9-type-16-icon.png 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. 
Fc9-conn-icon.png Transmit
Fc9-type-7-icon.png 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. 
Fc9-type-5-icon.png TX
Pin to be used for Transmit data 
Fc9-conn-icon.png Receive
Fc9-type-7-icon.png 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. 
Fc9-type-5-icon.png RX
Pin to be used for Receive data 
Fc9-conn-icon.png Flow Control
Fc9-type-16-icon.png 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. 
Fc9-conn-icon.png Options
Fc9-type-16-icon.png Baud Options
Baud rate option selector 
Fc9-type-14-icon.png Baud Rate
 
Fc9-type-16-icon.png Data Bits
Number of data bits 
Fc9-type-16-icon.png 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. 
Fc9-type-16-icon.png Echo
Automatically echoes back any received data when enabled by re-transmitting the received byte. 
Fc9-type-16-icon.png 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. 
Fc9-conn-icon.png Simulation
Fc9-type-7-icon.png 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. 
Fc9-type-7-icon.png Console Data
Selects if the console data is automatically generated or not 
Fc9-type-16-icon.png Console Format
Controls if the data is shown as a log with time and date stamps or just as raw data 
Fc9-type-21-icon.png Console Columns
Number of characters that can be displayed on a single line of the console. 
Fc9-type-16-icon.png 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