Jump to content

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

From Flowcode Help
No edit summary
Line 1: Line 1:
 
{| style="width:50%"
 
{| width="50%"
|-
|-
| width="20%" style="color: gray;" | Author
| width="20%" style="color:gray;" | Author
| MatrixTSL
| MatrixTSL
|-
|-
| width="20%" style="color: gray;" | Version
| width="20%" style="color:gray;" | Version
| 1.0 (Release)
| 1.0
|-
|-
| width="20%" style="color: gray;" | Category
| width="20%" style="color:gray;" | Category
| Comms: Interface
| 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==


==[[File:Component Icon 743ea495_34e7_47ee_bd79_3bfdc067b01c.png|Image]] UART Software (Timer) component==
''No detailed description exists yet for this 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.


==Examples==
==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
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
Line 28: Line 30:
==Downloadable macro reference==
==Downloadable macro reference==


===<span style="font-weight: normal;"><u><tt>SendString</tt></u></span>===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
Sends an string to the transmit buffer
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SendString'''
|-
| colspan="2" | Sends an string to the transmit buffer&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
| width="90%" | Data
|-
| colspan="2" | &nbsp;
|-
| 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''
|}


'''Parameters'''


:[[Variable Types|<- STRING]] ''Data''
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
::''This parameter may be returned back to the caller''
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReceiveArray'''
|-
| colspan="2" | Gets an array of values from the receive buffer. Returns number of values received.&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Values
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | NumValues
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Timeout
|-
| colspan="2" | Time in milliseconds to wait for data&nbsp;
|-
| 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''
|}




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


:''This call does not return a value''


{| 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.&nbsp;
|-
|-
| 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''
|}


===<span style="font-weight: normal;"><u><tt>ReceiveArray</tt></u></span>===
Gets an array of values from the receive buffer.


Returns number of values received.
{| 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;" | '''ReceiveValue'''
|-
| colspan="2" | Gets a single value from the receive buffer&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Timeout
|-
| colspan="2" | Time in milliseconds to wait for data&nbsp;
|-
| 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''
|}


'''Parameters'''


:[[Variable Types|UINT]] ''Values''
{| 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;" | '''SendValue'''
|-
| colspan="2" | Sends a single value to the transmit buffer&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Value
|-
| colspan="2" | &nbsp;
|-
| 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''
|}


:[[Variable Types|UINT]] ''NumValues''


:[[Variable Types|UINT]] ''Timeout''
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
::Time in milliseconds to wait for data
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CheckBuffer'''
|-
| colspan="2" | Returns the number of values in the transmit or receive buffer&nbsp;
|-
|-
| width="10%" align="center" | [[File:]] -
| width="90%" | Buffer
|-
| colspan="2" | 0=Transmit / 1=Receive&nbsp;
|-
| 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''
|}




'''Return value'''
{| 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;" | '''ReceiveString'''
|-
| colspan="2" | Gets a string from the receive buffer&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | MaxChars
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Timeout
|-
| colspan="2" | Time in milliseconds to wait for data&nbsp;
|-
| 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''
|}


:[[Variable Types|UINT]]


{| 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'''
|-
| colspan="2" | Initialises the UART component pins ready to send and receive data&nbsp;
|-
|-
| 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''
|}


===<span style="font-weight: normal;"><u><tt>SendArray</tt></u></span>===
Sends an array of values to the transmit buffer


'''Parameters'''
{| 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;" | '''ReceiveByteArray'''
|-
| colspan="2" | Receives an array of bytes and returns the number of bytes received.&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Data
|-
| colspan="2" | A byte array variable to hold the received data&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | NumBytes
|-
| colspan="2" | Maximum number of bytes to try and receive&nbsp;
|-
| 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&nbsp;
|-
| 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''
|}


:[[Variable Types|UINT]] ''Values''


:[[Variable Types|UINT]] ''NumValues''
{| 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;" | '''ReceiveString'''
|-
| colspan="2" | Receives a string of bytes and returns the number of bytes received.&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
| width="90%" | StringData
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | NumBytes
|-
| colspan="2" | Maximum number of bytes to try and receive&nbsp;
|-
| 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&nbsp;
|-
| 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''
|}




'''Return value'''
{| 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;" | '''Uninit'''
|-
| colspan="2" | Un-initialize the UART and release the resources&nbsp;
|-
|-
| 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''
|}


:''This call does not return a value''


{| 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;" | '''GetList'''
|-
| colspan="2" | Gets Named property List&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
| width="90%" | Name
|-
| colspan="2" | &nbsp;
|-
| 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''
|}


===<span style="font-weight: normal;"><u><tt>UART_Timer_Process</tt></u></span>===
Called as part of a timer interrupt at the specific UART baud rate.


'''Parameters'''
{| 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;" | '''Delay'''
|-
| colspan="2" | Software UART Bit Delay&nbsp;
|-
|-
| 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''
|}


:''This macro has no parameters''


{| 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;" | '''SetValue'''
|-
| colspan="2" | set Value of Named property&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
| width="90%" | Name
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
| width="90%" | Value
|-
| colspan="2" | &nbsp;
|-
| 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''
|}


'''Return value'''


:''This call does not return a value''
{| 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;" | '''Uninit'''
|-
| colspan="2" | Un-initialize the UART and release the resources&nbsp;
|-
|-
| 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''
|}




===<span style="font-weight: normal;"><u><tt>ReceiveValue</tt></u></span>===
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
Gets a single value from the receive buffer
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetList'''
|-
| colspan="2" | Gets Named property List&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
| width="90%" | Name
|-
| colspan="2" | &nbsp;
|-
| 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''
|}


'''Parameters'''


:[[Variable Types|UINT]] ''Timeout''
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
::Time in milliseconds to wait for data
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReceiveByteArray'''
|-
| colspan="2" | Receives an array of bytes and returns the number of bytes received.&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Data
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | NumBytes
|-
| colspan="2" | Maximum number of bytes to try and receive&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Timeout
|-
| colspan="2" | Max amount of time in ms to wait between bytes&nbsp;
|-
| 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''
|}




'''Return value'''
{| 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;" | '''ReceiveString'''
|-
| colspan="2" | Receives a string of bytes and returns the number of bytes received.&nbsp;
|-
|-
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
| width="90%" | StringData
|-
| colspan="2" | &nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | NumBytes
|-
| colspan="2" | Maximum number of bytes to try and receive&nbsp;
|-
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" | Timeout
|-
| colspan="2" | Max amount of time in ms to wait between bytes&nbsp;
|-
| 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''
|}


:[[Variable Types|UINT]]


 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
===<span style="font-weight: normal;"><u><tt>SendValue</tt></u></span>===
|-
Sends a single value to the transmit buffer
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetList'''
'''Parameters'''
|-
 
| colspan="2" | returns Named property list&nbsp;
:[[Variable Types|UINT]] ''Value''
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
'''Return value'''
| width="90%" | Name
 
|-
:''This call does not return a value''
| colspan="2" | &nbsp;
 
|-
 
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-string-icon.png]] - STRING
===<span style="font-weight: normal;"><u><tt>CheckBuffer</tt></u></span>===
| width="90%" style="border-top: 2px solid #000;" | ''Return''
Returns the number of values in the transmit or receive buffer
|}
 
'''Parameters'''
 
:[[Variable Types|BOOL]] ''Buffer''
::0=Transmit / 1=Receive
 
 
'''Return value'''
 
:[[Variable Types|UINT]]




===<span style="font-weight: normal;"><u><tt>ReceiveString</tt></u></span>===
Gets a string from the receive buffer
'''Parameters'''
:[[Variable Types|UINT]] ''MaxChars''
:[[Variable Types|UINT]] ''Timeout''
::Time in milliseconds to wait for data
'''Return value'''
:[[Variable Types|STRING]]
===<span style="font-weight: normal;"><u><tt>Initialise</tt></u></span>===
Initialises the UART component pins ready to send and receive data
'''Parameters'''
:''This macro has no parameters''
'''Return value'''
:''This call does not return a value''
==Simulation macro reference==
''This component does not contain any simulation macros''




==Property reference==
==Property reference==
<span style="font-weight: normal;"><u>Data Bits</u></span>


This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''DataBits''.
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
|-
Sets the number of data bits in a single packet, 7-bits provides values 0-127, 8-bits provides values 0-255 and 9-bits provides values 0-511.
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''  
9-bit data is often used for 8-bit plus a parity bit which is used for error detection.
|-
 
|-
<span style="font-weight: normal;"><u>Stop Bits</u></span>
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 
| width="90%" | Data Bits
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''StopBits''.
|-
 
| colspan="2" | &nbsp;
Number of stop bits at the end of each packet. Used to adjust the minimum spacing between packets.
|-
 
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
<span style="font-weight: normal;"><u>Use TX</u></span>
| width="90%" | Stop Bits
 
|-
This property is of type ''True or false'' and can be referenced with the variable name ''UseTx''.
| colspan="2" | &nbsp;
 
|-
Allows the Transmit pin to be enabled / disabled
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 
| width="90%" | Use TX
<span style="font-weight: normal;"><u>Use RX</u></span>
|-
 
| colspan="2" | Allows the Transmit pin to be enabled / disabled&nbsp;
This property is of type ''True or false'' and can be referenced with the variable name ''UseRx''.
|-
 
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
Allows the Receive pin to be enabled / disabled
| width="90%" | Use RX
 
|-
<span style="font-weight: normal;"><u>Transmit Pin</u></span>
| colspan="2" | Allows the Receive pin to be enabled / disabled&nbsp;
 
|-
This property is of type ''Single digital pin'' and can be referenced with the variable name ''TXPin''.
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 
| width="90%" | Transmit Pin
Pin assigned to transmitting data
|-
 
| colspan="2" | Pin assigned to transmitting data&nbsp;
<span style="font-weight: normal;"><u>Transmit Buffer Size</u></span>
|-
 
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
This property is of type ''Unsigned integer'' and can be referenced with the variable name ''TXBufferSize''.
| width="90%" | Transmit Buffer Size
 
|-
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&nbsp;
 
|-
<span style="font-weight: normal;"><u>Receive Pin</u></span>
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 
| width="90%" | Receive Pin
This property is of type ''Single digital pin'' and can be referenced with the variable name ''RXPin''.
|-
 
| colspan="2" | Pin assigned to receiving data&nbsp;
Pin assigned to receiving data
|-
 
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
<span style="font-weight: normal;"><u>Receive Buffer Size</u></span>
| width="90%" | Receive Buffer Size
 
|-
This property is of type ''Unsigned integer'' and can be referenced with the variable name ''RXBufferSize''.
| colspan="2" | Number of bytes that can be stored in the incoming receive buffer&nbsp;
 
|-
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="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Connections'''  
<span style="font-weight: normal;"><u>Injector</u></span>
|-
 
|-
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''Injector''.
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-conn-icon.png]]
 
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Simulations'''  
Points to an Injector component on the panel to provide a means to connect the simulation data to something useful such as another instance of Flowcode or real world hardware.
|-
|-
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| width="90%" | API
|-
| colspan="2" | &nbsp;
|}

Revision as of 16:13, 16 November 2021

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


Downloadable macro reference

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


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


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


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


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


SendValue
Sends a single value to the transmit buffer 
- UINT Value
 
- VOID Return


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


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


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


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


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 
- UINT Timeout
Max amount of time in ms to wait between bytes 
- BYTE Return


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


GetList
Gets Named property List 
- STRING Name
 
- STRING Return


Delay
Software UART Bit Delay 
- VOID Return


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


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


GetList
Gets Named property List 
- STRING Name
 
- STRING Return


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


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


GetList
returns Named property list 
- STRING Name
 
- STRING Return



Property reference

Properties
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 Pin
Pin assigned to transmitting data 
Transmit Buffer Size
Number of bytes that can be stored in the outgoing transmit buffer 
Receive Pin
Pin assigned to receiving data 
Receive Buffer Size
Number of bytes that can be stored in the incoming receive buffer 
Connections
Simulations
API