Jump to content

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

From Flowcode Help
No edit summary
No edit summary
Line 17: Line 17:
==Component Source Code==
==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 download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_temp/UART_Software_Timer.fcfx FC_Comp_Source_temp/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]
Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_temp/UART_Software_Timer.fcfx FC_Comp_Source_temp/UART_Software_Timer.fcfx]


==Detailed description==
==Detailed description==
Line 76: Line 76:


{{Fcfile|UART_Timer_Example.fcfx|UART_Timer_Example}}
{{Fcfile|UART_Timer_Example.fcfx|UART_Timer_Example}}




Line 84: Line 86:
==Macro reference==
==Macro reference==


===SendString===
===CheckBuffer===
{| 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;" | '''CheckBuffer'''
|-
| colspan="2" | Returns the number of values in the transmit or receive buffer 
|-
|-
| width="10%" align="center" | [[File:Fc9-bool-icon.png]] - BOOL
| width="90%" | Buffer
|-
| colspan="2" | 0=Transmit / 1=Receive 
|-
|-
| colspan="2" | Sends an string to the transmit buffer 
| 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''
|}
 
 
===Initialise===
{| 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;" | '''Initialise'''
|-
|-
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
| colspan="2" | Initialises the UART component pins ready to send and receive data 
| width="90%" | Data
|-
|-
| colspan="2" |  
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
Line 132: Line 148:




===SendArray===
===ReceiveString===
{| 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;" | '''ReceiveString'''
|-
|-
| colspan="2" | Sends an array of values to the transmit buffer 
| colspan="2" | Gets a string from the receive buffer 
|-
|-
|-
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Values
| width="90%" | MaxChars
|-
|-
| colspan="2" |  
| colspan="2" |  
|-
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | NumValues
| width="90%" | Timeout
|-
|-
| colspan="2" |  
| colspan="2" | Time in milliseconds to wait for data 
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-string-icon.png]] - STRING
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
 
 
===UART_Timer_Process===
{| 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;" | '''UART_Timer_Process'''
|-
| colspan="2" | Called as part of a timer interrupt at the specific UART baud rate. 
|-
|-
| 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''
|}
|}
Line 189: Line 191:




===SendValue===
===SendArray===
{| 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;" | '''SendArray'''
|-
| colspan="2" | Sends an array of values to the transmit buffer 
|-
|-
|-
| colspan="2" | Sends a single value to the transmit buffer 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Values
|-
|-
| colspan="2" |  
|-
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Value
| width="90%" | NumValues
|-
|-
| colspan="2" |  
| colspan="2" |  
Line 208: Line 215:




===CheckBuffer===
===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;" | '''CheckBuffer'''
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendString'''
|-
|-
| colspan="2" | Returns the number of values in the transmit or receive buffer 
| colspan="2" | Sends an string to the transmit buffer 
|-
|-
|-
|-
| width="10%" align="center" | [[File:Fc9-bool-icon.png]] - BOOL
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
| width="90%" | Buffer
| width="90%" | Data
|-
|-
| colspan="2" | 0=Transmit / 1=Receive 
| colspan="2" |  
|-
|-
| 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''
|}
|}




===ReceiveString===
===SendValue===
{| 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;" | '''ReceiveString'''
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendValue'''
|-
|-
| colspan="2" | Gets a string from the receive buffer 
| colspan="2" | Sends a single value to the transmit buffer 
|-
|-
|-
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | MaxChars
| width="90%" | Value
|-
|-
| colspan="2" |  
| colspan="2" |  
|-
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" | Timeout
|-
| colspan="2" | Time in milliseconds to wait for data 
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-string-icon.png]] - STRING
| width="90%" style="border-top: 2px solid #000;" | ''Return''
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
|}




===Initialise===
===UART_Timer_Process===
{| 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;" | '''Initialise'''
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''UART_Timer_Process'''
|-
|-
| colspan="2" | Initialises the UART component pins ready to send and receive data 
| colspan="2" | Called as part of a timer interrupt at the specific UART baud rate. 
|-
|-
|-
|-

Revision as of 12:03, 3 February 2023

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.

Component Source Code

Please click here to download the component source project: FC_Comp_Source_temp/UART_Software_Timer.fcfx

Please click here to view the component source code (Beta): FC_Comp_Source_temp/UART_Software_Timer.fcfx

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


ReceiveArray

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


ReceiveString

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


ReceiveValue

ReceiveValue
Gets a single value from the receive buffer 
- UINT Timeout
Time in milliseconds to wait for data 
- UINT Return


SendArray

SendArray
Sends an array of values to the transmit buffer 
- UINT Values
 
- UINT NumValues
 
- VOID Return


SendString

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


SendValue

SendValue
Sends a single value to the transmit buffer 
- UINT Value
 
- 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 
Receive Properties
Receive Pin
Pin assigned to receiving data 
Receive Buffer Size
Number of bytes that can be stored in the incoming receive buffer 
Simulation
API