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

From Flowcode Help
Jump to navigationJump to search
(XML import)
 
 
(21 intermediate revisions by 2 users not shown)
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.
  
==[[File:Component Icon 743ea495_34e7_47ee_bd79_3bfdc067b01c.png|Image]] UART Software (Timer) component==
+
==Detailed description==
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==
 
''<span style="color:red;">No additional examples</span>''
 
  
  
==Downloadable macro reference==
 
  
===<span style="font-weight: normal;"><u><tt>SendString</tt></u></span>===
 
Sends an string to the transmit buffer
 
  
'''Parameters'''
 
  
:[[Variable Types|<- STRING]] ''Data''
 
::''This parameter may be returned back to the caller''
 
  
  
'''Return value'''
 
  
:''This call does not return a value''
 
  
  
===<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.
 
  
'''Parameters'''
 
  
:[[Variable Types|UINT]] ''Values''
 
  
:[[Variable Types|UINT]] ''NumValues''
 
  
:[[Variable Types|UINT]] ''Timeout''
 
::Time in milliseconds to wait for data
 
  
  
'''Return value'''
 
  
:[[Variable Types|UINT]]
 
  
  
===<span style="font-weight: normal;"><u><tt>SendArray</tt></u></span>===
 
Sends an array of values to the transmit buffer
 
  
'''Parameters'''
 
  
:[[Variable Types|UINT]] ''Values''
+
''No detailed description exists yet for this component''
  
:[[Variable Types|UINT]] ''NumValues''
+
==Examples==
  
  
'''Return value'''
 
  
:''This call does not return a value''
 
  
  
===<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'''
 
  
:''This macro has no parameters''
 
  
  
'''Return value'''
 
  
:''This call does not return a value''
 
  
  
===<span style="font-weight: normal;"><u><tt>ReceiveValue</tt></u></span>===
 
Gets a single value from the receive buffer
 
  
'''Parameters'''
 
  
:[[Variable Types|UINT]] ''Timeout''
 
::Time in milliseconds to wait for data
 
  
  
'''Return value'''
 
  
:[[Variable Types|UINT]]
 
  
  
===<span style="font-weight: normal;"><u><tt>SendValue</tt></u></span>===
 
Sends a single value to the transmit buffer
 
  
'''Parameters'''
 
  
:[[Variable Types|UINT]] ''Value''
 
  
  
'''Return value'''
 
  
:''This call does not return a value''
 
  
 +
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
  
===<span style="font-weight: normal;"><u><tt>CheckBuffer</tt></u></span>===
+
{{Fcfile|UART_Timer_Example.fcfx|UART_Timer_Example}}
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'''
+
==Macro reference==
  
:''This macro has no parameters''
+
===CheckBuffer===
 +
{| 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;" | '''CheckBuffer'''
 +
|-
 +
| colspan="2" | Returns the number of values in the transmit or receive buffer&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-bool-icon.png]] - BOOL
 +
| 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'''
+
===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'''
 +
|-
 +
| 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''
 +
|}
  
:''This call does not return a value''
 
  
 +
===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.&nbsp;
 +
|-
 +
|-
 +
| 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&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''
 +
|}
  
  
==Simulation macro reference==
+
===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.&nbsp;
 +
|-
 +
|-
 +
| 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&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-u32-icon.png]] - ULONG
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
''This component does not contain any simulation macros''
 
  
 +
===ReceiveBinaryFloat===
 +
{| 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;" | '''ReceiveBinaryFloat'''
 +
|-
 +
| colspan="2" | Receives a binary 32-bit floating point value split across four bytes.&nbsp;
 +
|-
 +
|-
 +
| 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&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-f32-icon.png]] - FLOAT
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
==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''.
+
===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.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Values
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| 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-u8-icon.png]] - BYTE
 +
| width="90%" style="border-top: 2px solid #000;" | ''Return''
 +
|}
  
''<span style="color:red;">No additional information</span>''
 
  
 +
===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.&nbsp;
 +
|-
 +
|-
 +
| 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.&nbsp;
 +
|-
 +
| 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''
 +
|}
  
  
<span style="font-weight: normal;"><u>Stop Bits</u></span>
+
===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.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 +
| width="90%" | Timeout
 +
|-
 +
| colspan="2" | Max time in ms to wait in between bytes&nbsp;
 +
|-
 +
| 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&nbsp;
 +
|-
 +
| 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''
 +
|}
  
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''StopBits''.
 
  
''<span style="color:red;">No additional information</span>''
+
===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.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 +
| width="90%" | Timeout
 +
|-
 +
| colspan="2" | Max time in ms to wait in between bytes&nbsp;
 +
|-
 +
| 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&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-bool-icon.png]] - BOOL
 +
| width="90%" | Prefix
 +
|-
 +
| colspan="2" | Look for prefix before receiving, 1=0xFF, 0=FF&nbsp;
 +
|-
 +
| 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.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 +
| width="90%" | Data
 +
|-
 +
| colspan="2" | Array to store the incoming data&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 +
| width="90%" | NumValues
 +
|-
 +
| colspan="2" | Maximum number of values to try and receive&nbsp;
 +
|-
 +
| 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&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''
 +
|}
  
<span style="font-weight: normal;"><u>Use TX</u></span>
 
  
This property is of type ''True or false'' and can be referenced with the variable name ''UseTx''.
+
===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.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 +
| width="90%" | Timeout
 +
|-
 +
| colspan="2" | Max time in ms to wait in between bytes&nbsp;
 +
|-
 +
| 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&nbsp;
 +
|-
 +
| 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''
 +
|}
  
Allows the Transmit pin to be enabled / disabled
 
  
<span style="font-weight: normal;"><u>Use RX</u></span>
+
===ReceiveString===
 +
{| 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''
 +
|}
  
This property is of type ''True or false'' and can be referenced with the variable name ''UseRx''.
 
  
Allows the Receive pin to be enabled / disabled
+
===SendBinary16Bit===
 +
{| 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;" | '''SendBinary16Bit'''
 +
|-
 +
| colspan="2" | Sends out a 16-bit binary value split across two bytes.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 +
| width="90%" | Value
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| 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&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>Transmit Pin</u></span>
 
  
This property is of type ''Single digital pin'' and can be referenced with the variable name ''TXPin''.
+
===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.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u32-icon.png]] - ULONG
 +
| width="90%" | Value
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| 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&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''
 +
|}
 +
 
 +
 
 +
===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.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-f32-icon.png]] - FLOAT
 +
| width="90%" | Value
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| 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&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''
 +
|}
  
Pin assigned to transmitting data
 
  
<span style="font-weight: normal;"><u>Transmit Buffer Size</u></span>
+
===SendByteArray===
 +
{| 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;" | '''SendByteArray'''
 +
|-
 +
| colspan="2" | Sends an array of bytes to the transmit buffer&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | Values
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| 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 property is of type ''Unsigned integer'' and can be referenced with the variable name ''TXBufferSize''.
 
  
Number of bytes that can be stored in the outgoing transmit buffer
+
===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.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-s16-icon.png]] - INT
 +
| width="90%" | Char
 +
|-
 +
| 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''
 +
|}
  
<span style="font-weight: normal;"><u>Receive Pin</u></span>
 
  
This property is of type ''Single digital pin'' and can be referenced with the variable name ''RXPin''.
+
===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&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-f32-icon.png]] - FLOAT
 +
| 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''
 +
|}
  
Pin assigned to receiving data
 
  
<span style="font-weight: normal;"><u>Receive Buffer Size</u></span>
+
===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.&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u32-icon.png]] - ULONG
 +
| width="90%" | Number
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| 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&nbsp;
 +
|-
 +
| 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&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 property is of type ''Unsigned integer'' and can be referenced with the variable name ''RXBufferSize''.
 
  
Number of bytes that can be stored in the incoming receive buffer
+
===SendIntArray===
 +
{| 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;" | '''SendIntArray'''
 +
|-
 +
| colspan="2" | Sends an array of ints to the transmit buffer&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-s16-icon.png]] - INT
 +
| width="90%" | Data
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 +
| width="90%" | NumValues
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| 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&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''
 +
|}
 +
 
 +
 
 +
===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&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-s32-icon.png]] - LONG
 +
| width="90%" | Number
 +
|-
 +
| 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''
 +
|}
 +
 
 +
 
 +
===SendString===
 +
{| 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;" | '''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''
 +
|}
 +
 
 +
 
 +
===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.&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''
 +
|}
 +
 
 +
 
 +
==Property reference==
 +
 
 +
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 +
|-
 +
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
 +
| 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
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 +
| width="90%" | Data Bits
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 +
| width="90%" | Stop Bits
 +
|-
 +
| colspan="2" | &nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 +
| width="90%" | Use TX
 +
|-
 +
| colspan="2" | Allows the Transmit pin to be enabled / disabled&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-type-7-icon.png]]
 +
| width="90%" | Use RX
 +
|-
 +
| colspan="2" | Allows the Receive pin to be enabled / disabled&nbsp;
 +
|-
 +
| 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="90%" | Transmit Pin
 +
|-
 +
| colspan="2" | Pin assigned to transmitting data&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 +
| width="90%" | Transmit Buffer Size
 +
|-
 +
| colspan="2" | Number of bytes that can be stored in the outgoing transmit buffer&nbsp;
 +
|-
 +
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
 +
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Simulation
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
 +
| width="90%" | API
 +
|-
 +
| colspan="2" | &nbsp;
 +
|}
  
<span style="font-weight: normal;"><u>Injector</u></span>
+
==Component Source Code==
  
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''Injector''.
+
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]
  
''<span style="color:red;">No additional information</span>''
+
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]

Latest 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

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


ReceiveBinary16Bit

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


ReceiveBinary32Bit

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


ReceiveBinaryFloat

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


ReceiveBytetArray

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


ReceiveChar

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


ReceiveFloat

Fc9-comp-macro.png 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. 
Fc9-u16-icon.png - UINT Timeout
Max time in ms to wait in between bytes 
Fc9-bool-icon.png - BOOL IgnoreData
0=Dont ignore any data, 1=Ignore any initial none numeric data 
Fc9-f32-icon.png - FLOAT Return


ReceiveHexNumber

Fc9-comp-macro.png 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. 
Fc9-u16-icon.png - UINT Timeout
Max time in ms to wait in between bytes 
Fc9-bool-icon.png - BOOL IgnoreData
0=Dont ignore any data, 1=Ignore any initial none numeric data 
Fc9-bool-icon.png - BOOL Prefix
Look for prefix before receiving, 1=0xFF, 0=FF 
Fc9-u32-icon.png - ULONG Return


ReceiveINTArray

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


ReceiveNumber

Fc9-comp-macro.png 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. 
Fc9-u16-icon.png - UINT Timeout
Max time in ms to wait in between bytes 
Fc9-bool-icon.png - BOOL IgnoreData
0=Dont ignore any data, 1=Ignore any initial none numeric data 
Fc9-s32-icon.png - LONG 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


SendBinary16Bit

Fc9-comp-macro.png SendBinary16Bit
Sends out a 16-bit binary value split across two bytes. 
Fc9-u16-icon.png - UINT Value
 
Fc9-bool-icon.png - BOOL MSBfirst
0=Least significant byte first, 1=Most significant byte first 
Fc9-void-icon.png - VOID Return


SendBinary32Bit

Fc9-comp-macro.png SendBinary32Bit
Sends out a 32-bit binary value split across four bytes. 
Fc9-u32-icon.png - ULONG Value
 
Fc9-bool-icon.png - BOOL MSBfirst
0=Least significant byte first, 1=Most significant byte first 
Fc9-void-icon.png - VOID Return


SendBinaryFloat

Fc9-comp-macro.png SendBinaryFloat
Sends out a 32-bit binary floating point value split across four bytes. 
Fc9-f32-icon.png - FLOAT Value
 
Fc9-bool-icon.png - BOOL MSBfirst
0=Least significant byte first, 1=Most significant byte first 
Fc9-void-icon.png - VOID Return


SendByteArray

Fc9-comp-macro.png SendByteArray
Sends an array of bytes to the transmit buffer 
Fc9-u8-icon.png - BYTE Values
 
Fc9-u8-icon.png - BYTE NumValues
 
Fc9-void-icon.png - VOID Return


SendChar

Fc9-comp-macro.png SendChar
Sends out a single packet from the UART interface. 
Fc9-s16-icon.png - INT Char
 
Fc9-void-icon.png - VOID Return


SendFloat

Fc9-comp-macro.png SendFloat
Sends a single float to the transmit buffer 
Fc9-f32-icon.png - FLOAT Value
 
Fc9-void-icon.png - VOID Return


SendHexNumber

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


SendIntArray

Fc9-comp-macro.png SendIntArray
Sends an array of ints to the transmit buffer 
Fc9-s16-icon.png - INT Data
 
Fc9-u8-icon.png - BYTE NumValues
 
Fc9-bool-icon.png - BOOL MSBfirst
0=Least significant byte first, 1=Most significant byte first 
Fc9-void-icon.png - VOID Return


SendNumber

Fc9-comp-macro.png SendNumber
Sends out a number as an ASCII String to the transmit buffer 
Fc9-s32-icon.png - LONG Number
 
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


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 Simulation
Fc9-type-16-icon.png 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