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

From Flowcode Help
Jump to navigationJump to search
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

FC6 Icon.png UART_Timer_Example


Downloadable macro reference

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


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


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


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


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


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


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


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


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


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


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-u16-icon.png - UINT Timeout
Max amount of time in ms to wait between bytes 
Fc9-u8-icon.png - BYTE Return


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


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


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


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


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


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


Fc9-comp-macro.png ReceiveByteArray
Receives an array of bytes and returns the number of bytes received. 
Fc9-u8-icon.png - BYTE Data
 
Fc9-u8-icon.png - BYTE 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


Fc9-comp-macro.png ReceiveString
Receives a string of bytes and returns the number of bytes received. 
Fc9-string-icon.png - STRING StringData
 
Fc9-u8-icon.png - BYTE 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


Fc9-comp-macro.png GetList
returns Named property list 
Fc9-string-icon.png - STRING Name
 
Fc9-string-icon.png - STRING Return



Property reference

Fc9-prop-icon.png Properties
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-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-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 Connections
Fc9-conn-icon.png Simulations
Fc9-type-16-icon.png API