Jump to content

Component: UART Software (Timer) (Comms: Interface): Difference between revisions

From Flowcode Help
No edit summary
No edit summary
Line 14: Line 14:
==UART Software (Timer) component==
==UART Software (Timer) component==
Creates a reliable software UART that can be driven using a timer interrupt setup by the user. The timer interrupt must be interrupting at the required baud rate. e.g 9600Hz.
Creates a reliable software UART that can be driven using a timer interrupt setup by the user. The timer interrupt must be interrupting at the required baud rate. e.g 9600Hz.
==Component Source Code==
Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_UART_Software_Timer.fcfx FC_Comp_Source_UART_Software_Timer.fcfx]
Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_UART_Software_Timer.fcfx FC_Comp_Source_UART_Software_Timer.fcfx]


==Detailed description==
==Detailed description==
Line 127: Line 121:




===ReceiveArray===
===ReceiveBinary16Bit===
{| 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;" | '''ReceiveBinary16Bit'''
|-
| colspan="2" | Receives a binary 16-bit value split across two bytes. 
|-
|-
| width="10%" align="center" | [[File:Fc9-bool-icon.png]] - BOOL
| width="90%" | MSBfirst
|-
| colspan="2" | 0=Least significant byte first, 1=Most significant byte first 
|-
| 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''
|}
 
 
===ReceiveBinary32Bit===
{| 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;" | '''ReceiveBinary32Bit'''
|-
| colspan="2" | Receives a binary 32-bit value split across four bytes. 
|-
|-
| width="10%" align="center" | [[File:Fc9-bool-icon.png]] - BOOL
| width="90%" | MSBfirst
|-
| colspan="2" | 0=Least significant byte first, 1=Most significant byte first 
|-
| 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-u32-icon.png]] - ULONG
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
 
 
===ReceiveBinaryFloat===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReceiveArray'''
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReceiveBinaryFloat'''
|-
| colspan="2" | Receives a binary 32-bit floating point value split across four bytes. 
|-
|-
| width="10%" align="center" | [[File:Fc9-bool-icon.png]] - BOOL
| width="90%" | MSBfirst
|-
| colspan="2" | 0=Least significant byte first, 1=Most significant byte first 
|-
| 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-f32-icon.png]] - FLOAT
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
 
 
===ReceiveBytetArray===
{| 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;" | '''ReceiveBytetArray'''
|-
|-
| colspan="2" | Gets an array of values from the receive buffer. Returns number of values received. 
| colspan="2" | Gets an array of values from the receive buffer. Returns number of values received. 
|-
|-
|-
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Values
| width="90%" | Values
|-
|-
| colspan="2" |  
| colspan="2" |  
|-
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | NumValues
| width="90%" | NumValues
|-
|-
Line 151: Line 217:
| colspan="2" | Time in milliseconds to wait for data 
| colspan="2" | Time in milliseconds to wait for data 
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
| 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''
|}
 
 
===ReceiveChar===
{| 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;" | '''ReceiveChar'''
|-
| colspan="2" | Attempts to receive a single packet from the UART interface. 
|-
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Timeout
|-
| colspan="2" | Time to wait in milliseconds for valid data before returning, 0=Dont wait, 255=Wait forever. 
|-
| 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''
|}
 
 
===ReceiveFloat===
{| 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;" | '''ReceiveFloat'''
|-
| colspan="2" | Attempts to receive a floating point number as ASCII characters and convert back into a numeric value. Note this function will receive until a timeout or a none numeric char is received, the none numeric char will be lost. 
|-
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Timeout
|-
| colspan="2" | Max time in ms to wait in between bytes 
|-
| width="10%" align="center" | [[File:Fc9-bool-icon.png]] - BOOL
| width="90%" | IgnoreData
|-
| colspan="2" | 0=Dont ignore any data, 1=Ignore any initial none numeric data 
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-f32-icon.png]] - FLOAT
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
 
 
===ReceiveHexNumber===
{| 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;" | '''ReceiveHexNumber'''
|-
| colspan="2" | Attempts to receive a hex number as ASCII characters and convert back into a numeric value. Note this function will receive until a timeout or a none hexadecimal char is received, the none numeric char will be lost. 
|-
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Timeout
|-
| colspan="2" | Max time in ms to wait in between bytes 
|-
| width="10%" align="center" | [[File:Fc9-bool-icon.png]] - BOOL
| width="90%" | IgnoreData
|-
| colspan="2" | 0=Dont ignore any data, 1=Ignore any initial none numeric data 
|-
| width="10%" align="center" | [[File:Fc9-bool-icon.png]] - BOOL
| width="90%" | Prefix
|-
| colspan="2" | Look for prefix before receiving, 1=0xFF, 0=FF 
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u32-icon.png]] - ULONG
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
 
 
===ReceiveINTArray===
{| 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;" | '''ReceiveINTArray'''
|-
| colspan="2" | Receives an array of 16-bit INT/UINT values and returns the number of values received. 
|-
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Data
|-
| colspan="2" | Array to store the incoming data 
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | NumValues
|-
| colspan="2" | Maximum number of values to try and receive 
|-
| width="10%" align="center" | [[File:Fc9-bool-icon.png]] - BOOL
| width="90%" | MSBfirst
|-
| colspan="2" | 0=Least significant byte first, 1=Most significant byte first 
|-
| 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''
|}
 
 
===ReceiveNumber===
{| 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;" | '''ReceiveNumber'''
|-
| colspan="2" | Attempts to receive a number as ASCII characters and convert back into a numeric value. Note this function will receive until a timeout or a none numeric char is received, the none numeric char will be lost. 
|-
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Timeout
|-
| colspan="2" | Max time in ms to wait in between bytes 
|-
| width="10%" align="center" | [[File:Fc9-bool-icon.png]] - BOOL
| width="90%" | IgnoreData
|-
| colspan="2" | 0=Dont ignore any data, 1=Ignore any initial none numeric data 
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-s32-icon.png]] - LONG
| width="90%" style="border-top: 2px solid #000;" | ''Return''
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
|}
Line 180: Line 376:




===ReceiveValue===
===SendBinary16Bit===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReceiveValue'''
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendBinary16Bit'''
|-
|-
| colspan="2" | Gets a single value from the receive buffer 
| colspan="2" | Sends out a 16-bit binary value split across two bytes. 
|-
|-
|-
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Timeout
| width="90%" | Value
|-
| colspan="2" |  
|-
| width="10%" align="center" | [[File:Fc9-bool-icon.png]] - BOOL
| width="90%" | MSBfirst
|-
| colspan="2" | 0=Least significant byte first, 1=Most significant byte first 
|-
| 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''
|}
 
 
===SendBinary32Bit===
{| 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;" | '''SendBinary32Bit'''
|-
| colspan="2" | Sends out a 32-bit binary value split across four bytes. 
|-
|-
| width="10%" align="center" | [[File:Fc9-u32-icon.png]] - ULONG
| width="90%" | Value
|-
| colspan="2" |  
|-
| width="10%" align="center" | [[File:Fc9-bool-icon.png]] - BOOL
| width="90%" | MSBfirst
|-
| colspan="2" | 0=Least significant byte first, 1=Most significant byte first 
|-
| 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''
|}
 
 
===SendBinaryFloat===
{| 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;" | '''SendBinaryFloat'''
|-
| colspan="2" | Sends out a 32-bit binary floating point value split across four bytes. 
|-
|-
| width="10%" align="center" | [[File:Fc9-f32-icon.png]] - FLOAT
| width="90%" | Value
|-
| colspan="2" |  
|-
| width="10%" align="center" | [[File:Fc9-bool-icon.png]] - BOOL
| width="90%" | MSBfirst
|-
|-
| colspan="2" | Time in milliseconds to wait for data 
| colspan="2" | 0=Least significant byte first, 1=Most significant byte first 
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
| 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''
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
|}




===SendArray===
===SendByteArray===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendArray'''
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendByteArray'''
|-
|-
| colspan="2" | Sends an array of values to the transmit buffer 
| colspan="2" | Sends an array of bytes to the transmit buffer 
|-
|-
|-
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Values
| width="90%" | Values
|-
|-
| colspan="2" |  
| colspan="2" |  
|-
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | NumValues
| width="90%" | NumValues
|-
|-
Line 223: Line 472:




===SendString===
===SendChar===
{| 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;" | '''SendChar'''
|-
| colspan="2" | Sends out a single packet from the UART interface. 
|-
|-
| width="10%" align="center" | [[File:Fc9-s16-icon.png]] - INT
| width="90%" | Char
|-
| colspan="2" |  
|-
| 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''
|}
 
 
===SendFloat===
{| 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;" | '''SendFloat'''
|-
| colspan="2" | Sends a single float  to the transmit buffer 
|-
|-
| width="10%" align="center" | [[File:Fc9-f32-icon.png]] - FLOAT
| width="90%" | Value
|-
| colspan="2" |  
|-
| 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''
|}
 
 
===SendHexNumber===
{| 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;" | '''SendHexNumber'''
|-
| colspan="2" | Sends out a number as an ASCII hexadecimal String from the UART interface. 
|-
|-
| width="10%" align="center" | [[File:Fc9-u32-icon.png]] - ULONG
| width="90%" | Number
|-
| colspan="2" |  
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | NumChars
|-
| colspan="2" | Number of characters in the string data, 0 for auto, 2 for 0x00, 4 for 0x0000 
|-
| width="10%" align="center" | [[File:Fc9-bool-icon.png]] - BOOL
| width="90%" | Prefix
|-
| colspan="2" | Generate hexadecimal prefix 0x e.g. 1= 0xFF, 0= FF 
|-
| 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''
|}
 
 
===SendIntArray===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendString'''
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendIntArray'''
|-
|-
| colspan="2" | Sends an string to the transmit buffer 
| colspan="2" | Sends an array of ints to the transmit buffer 
|-
|-
|-
|-
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
| width="10%" align="center" | [[File:Fc9-s16-icon.png]] - INT
| width="90%" | Data
| width="90%" | Data
|-
| colspan="2" |  
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | NumValues
|-
| colspan="2" |  
|-
| width="10%" align="center" | [[File:Fc9-bool-icon.png]] - BOOL
| width="90%" | MSBfirst
|-
| colspan="2" | 0=Least significant byte first, 1=Most significant byte first 
|-
| 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''
|}
===SendNumber===
{| 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;" | '''SendNumber'''
|-
| colspan="2" | Sends out a number as an ASCII String to the transmit buffer 
|-
|-
| width="10%" align="center" | [[File:Fc9-s32-icon.png]] - LONG
| width="90%" | Number
|-
|-
| colspan="2" |  
| colspan="2" |  
Line 242: Line 587:




===SendValue===
===SendString===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendValue'''
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendString'''
|-
|-
| colspan="2" | Sends a single value to the transmit buffer 
| colspan="2" | Sends an string to the transmit buffer 
|-
|-
|-
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
| width="90%" | Value
| width="90%" | Data
|-
|-
| colspan="2" |  
| colspan="2" |  
Line 320: Line 665:
|-
|-
| colspan="2" | Number of bytes that can be stored in the outgoing transmit buffer 
| colspan="2" | Number of bytes that can be stored in the outgoing transmit buffer 
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Receive Properties
|-
|-
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
| width="90%" | Receive Pin
|-
| colspan="2" | Pin assigned to receiving data 
|-
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
| width="90%" | Receive Buffer Size
|-
| colspan="2" | Number of bytes that can be stored in the incoming receive buffer 
|-
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
Line 344: Line 675:
| colspan="2" |  
| colspan="2" |  
|}
|}
==Component Source Code==
Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_UART_Software_Timer.fcfx FC_Comp_Source_UART_Software_Timer.fcfx]
Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_UART_Software_Timer.fcfx FC_Comp_Source_UART_Software_Timer.fcfx]

Revision as of 08:59, 9 June 2025

Author MatrixTSL
Version 1.0
Category Comms: Interface


UART Software (Timer) component

Creates a reliable software UART that can be driven using a timer interrupt setup by the user. The timer interrupt must be interrupting at the required baud rate. e.g 9600Hz.

Detailed description

No detailed description exists yet for this component

Examples

Simple example showing how to enable a timer interrupt at the desired baud rate then receive a string. If anything is received then it will be echoed back out and displayed on a LCD

UART_Timer_Example









Macro reference

CheckBuffer

CheckBuffer
Returns the number of values in the transmit or receive buffer 
- BOOL Buffer
0=Transmit / 1=Receive 
- UINT Return


Initialise

Initialise
Initialises the UART component pins ready to send and receive data 
- VOID Return


ReceiveBinary16Bit

ReceiveBinary16Bit
Receives a binary 16-bit value split across two bytes. 
- BOOL MSBfirst
0=Least significant byte first, 1=Most significant byte first 
- UINT Timeout
Max amount of time in ms to wait between bytes 
- UINT Return


ReceiveBinary32Bit

ReceiveBinary32Bit
Receives a binary 32-bit value split across four bytes. 
- BOOL MSBfirst
0=Least significant byte first, 1=Most significant byte first 
- UINT Timeout
Max amount of time in ms to wait between bytes 
- ULONG Return


ReceiveBinaryFloat

ReceiveBinaryFloat
Receives a binary 32-bit floating point value split across four bytes. 
- BOOL MSBfirst
0=Least significant byte first, 1=Most significant byte first 
- UINT Timeout
Max amount of time in ms to wait between bytes 
- FLOAT Return


ReceiveBytetArray

ReceiveBytetArray
Gets an array of values from the receive buffer. Returns number of values received. 
- BYTE Values
 
- BYTE NumValues
 
- UINT Timeout
Time in milliseconds to wait for data 
- BYTE Return


ReceiveChar

ReceiveChar
Attempts to receive a single packet from the UART interface. 
- UINT Timeout
Time to wait in milliseconds for valid data before returning, 0=Dont wait, 255=Wait forever. 
- INT Return


ReceiveFloat

ReceiveFloat
Attempts to receive a floating point number as ASCII characters and convert back into a numeric value. Note this function will receive until a timeout or a none numeric char is received, the none numeric char will be lost. 
- UINT Timeout
Max time in ms to wait in between bytes 
- BOOL IgnoreData
0=Dont ignore any data, 1=Ignore any initial none numeric data 
- FLOAT Return


ReceiveHexNumber

ReceiveHexNumber
Attempts to receive a hex number as ASCII characters and convert back into a numeric value. Note this function will receive until a timeout or a none hexadecimal char is received, the none numeric char will be lost. 
- UINT Timeout
Max time in ms to wait in between bytes 
- BOOL IgnoreData
0=Dont ignore any data, 1=Ignore any initial none numeric data 
- BOOL Prefix
Look for prefix before receiving, 1=0xFF, 0=FF 
- ULONG Return


ReceiveINTArray

ReceiveINTArray
Receives an array of 16-bit INT/UINT values and returns the number of values received. 
- UINT Data
Array to store the incoming data 
- UINT NumValues
Maximum number of values to try and receive 
- BOOL MSBfirst
0=Least significant byte first, 1=Most significant byte first 
- UINT Timeout
Max amount of time in ms to wait between bytes 
- BYTE Return


ReceiveNumber

ReceiveNumber
Attempts to receive a number as ASCII characters and convert back into a numeric value. Note this function will receive until a timeout or a none numeric char is received, the none numeric char will be lost. 
- UINT Timeout
Max time in ms to wait in between bytes 
- BOOL IgnoreData
0=Dont ignore any data, 1=Ignore any initial none numeric data 
- LONG Return


ReceiveString

ReceiveString
Gets a string from the receive buffer 
- UINT MaxChars
 
- UINT Timeout
Time in milliseconds to wait for data 
- STRING Return


SendBinary16Bit

SendBinary16Bit
Sends out a 16-bit binary value split across two bytes. 
- UINT Value
 
- BOOL MSBfirst
0=Least significant byte first, 1=Most significant byte first 
- VOID Return


SendBinary32Bit

SendBinary32Bit
Sends out a 32-bit binary value split across four bytes. 
- ULONG Value
 
- BOOL MSBfirst
0=Least significant byte first, 1=Most significant byte first 
- VOID Return


SendBinaryFloat

SendBinaryFloat
Sends out a 32-bit binary floating point value split across four bytes. 
- FLOAT Value
 
- BOOL MSBfirst
0=Least significant byte first, 1=Most significant byte first 
- VOID Return


SendByteArray

SendByteArray
Sends an array of bytes to the transmit buffer 
- BYTE Values
 
- BYTE NumValues
 
- VOID Return


SendChar

SendChar
Sends out a single packet from the UART interface. 
- INT Char
 
- VOID Return


SendFloat

SendFloat
Sends a single float to the transmit buffer 
- FLOAT Value
 
- VOID Return


SendHexNumber

SendHexNumber
Sends out a number as an ASCII hexadecimal String from the UART interface. 
- ULONG Number
 
- BYTE NumChars
Number of characters in the string data, 0 for auto, 2 for 0x00, 4 for 0x0000 
- BOOL Prefix
Generate hexadecimal prefix 0x e.g. 1= 0xFF, 0= FF 
- VOID Return


SendIntArray

SendIntArray
Sends an array of ints to the transmit buffer 
- INT Data
 
- BYTE NumValues
 
- BOOL MSBfirst
0=Least significant byte first, 1=Most significant byte first 
- VOID Return


SendNumber

SendNumber
Sends out a number as an ASCII String to the transmit buffer 
- LONG Number
 
- VOID Return


SendString

SendString
Sends an string to the transmit buffer 
- STRING Data
 
- VOID Return


UART_Timer_Process

UART_Timer_Process
Called as part of a timer interrupt at the specific UART baud rate. 
- VOID Return


Property reference

Properties
Global Settings
Data Bits
 
Stop Bits
 
Use TX
Allows the Transmit pin to be enabled / disabled 
Use RX
Allows the Receive pin to be enabled / disabled 
Transmit Properties
Transmit Pin
Pin assigned to transmitting data 
Transmit Buffer Size
Number of bytes that can be stored in the outgoing transmit buffer 
Simulation
API
 

Component Source Code

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

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