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

From Flowcode Help
Jump to navigationJump to search
 
(14 intermediate revisions by the same user not shown)
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 24: Line 48:
  
 
==Examples==
 
==Examples==
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
  
  
Line 36: Line 78:
  
  
==Downloadable macro reference==
 
  
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
 +
==Macro reference==
 +
 +
===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 56: Line 127:
  
  
 +
===ReceiveArray===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 84: Line 156:
  
  
 +
===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''
 
|}
 
 
 
 
 
{| 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''
 
|}
 
|}
  
  
 +
===ReceiveValue===
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
 
|-
Line 138: Line 199:
  
  
 +
===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 156: Line 223:
  
  
 +
===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:]] -  
+
| 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''
 
|}
 
|}
  
  
 +
===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''
 
|}
 
|}
  
  
 +
===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. 
 
|-
 
|-
 
|-
 
|-
Line 208: Line 273:
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 
|}
 
|}
 
 
  
  
Line 218: Line 281:
 
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
 
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''  
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''  
 +
|-
 +
|-
 +
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
 +
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Global Settings
 
|-
 
|-
 
|-
 
|-
Line 239: Line 306:
 
|-
 
|-
 
| colspan="2" | Allows the Receive pin to be enabled / disabled 
 
| colspan="2" | Allows the Receive pin to be enabled / disabled 
 +
|-
 +
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
 +
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Transmit Properties
 +
|-
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
Line 249: Line 320:
 
|-
 
|-
 
| 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="10%" align="center" | [[File:Fc9-type-5-icon.png]]
Line 260: Line 335:
 
| colspan="2" | Number of bytes that can be stored in the incoming receive buffer 
 
| colspan="2" | Number of bytes that can be stored in the incoming receive buffer 
 
|-
 
|-
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-conn-icon.png]]
+
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Connections'''
+
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Simulation
|-
 
|-
 
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-conn-icon.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Simulations'''
 
 
|-
 
|-
 
|-
 
|-

Latest revision as of 10:24, 24 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_UART_Software_Timer.fcfx

Please click here to view the component source code (Beta): FC_Comp_Source_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

FC6 Icon.png UART_Timer_Example









Macro reference

CheckBuffer

Fc9-comp-macro.png CheckBuffer
Returns the number of values in the transmit or receive buffer 
Fc9-bool-icon.png - BOOL Buffer
0=Transmit / 1=Receive 
Fc9-u16-icon.png - UINT Return


Initialise

Fc9-comp-macro.png Initialise
Initialises the UART component pins ready to send and receive data 
Fc9-void-icon.png - VOID Return


ReceiveArray

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


ReceiveString

Fc9-comp-macro.png ReceiveString
Gets a string from the receive buffer 
Fc9-u16-icon.png - UINT MaxChars
 
Fc9-u16-icon.png - UINT Timeout
Time in milliseconds to wait for data 
Fc9-string-icon.png - STRING Return


ReceiveValue

Fc9-comp-macro.png ReceiveValue
Gets a single value from the receive buffer 
Fc9-u16-icon.png - UINT Timeout
Time in milliseconds to wait for data 
Fc9-u16-icon.png - UINT Return


SendArray

Fc9-comp-macro.png SendArray
Sends an array of values to the transmit buffer 
Fc9-u16-icon.png - UINT Values
 
Fc9-u16-icon.png - UINT NumValues
 
Fc9-void-icon.png - VOID Return


SendString

Fc9-comp-macro.png SendString
Sends an string to the transmit buffer 
Fc9-string-icon.png - STRING Data
 
Fc9-void-icon.png - VOID Return


SendValue

Fc9-comp-macro.png SendValue
Sends a single value to the transmit buffer 
Fc9-u16-icon.png - UINT Value
 
Fc9-void-icon.png - VOID Return


UART_Timer_Process

Fc9-comp-macro.png UART_Timer_Process
Called as part of a timer interrupt at the specific UART baud rate. 
Fc9-void-icon.png - VOID Return


Property reference

Fc9-prop-icon.png Properties
Fc9-conn-icon.png Global Settings
Fc9-type-16-icon.png Data Bits
 
Fc9-type-16-icon.png Stop Bits
 
Fc9-type-7-icon.png Use TX
Allows the Transmit pin to be enabled / disabled 
Fc9-type-7-icon.png Use RX
Allows the Receive pin to be enabled / disabled 
Fc9-conn-icon.png Transmit Properties
Fc9-type-5-icon.png Transmit Pin
Pin assigned to transmitting data 
Fc9-type-21-icon.png Transmit Buffer Size
Number of bytes that can be stored in the outgoing transmit buffer 
Fc9-conn-icon.png Receive Properties
Fc9-type-5-icon.png Receive Pin
Pin assigned to receiving data 
Fc9-type-21-icon.png Receive Buffer Size
Number of bytes that can be stored in the incoming receive buffer 
Fc9-conn-icon.png Simulation
Fc9-type-16-icon.png API