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

From Flowcode Help
Jump to navigationJump to search
Line 16: Line 16:
  
 
==Detailed description==
 
==Detailed description==
 +
 +
  
  
Line 22: Line 24:
  
 
==Examples==
 
==Examples==
 +
 +
  
  
Line 199: Line 203:
 
|-
 
|-
 
| colspan="2" | Initialises the UART component pins ready to send and receive data 
 
| colspan="2" | Initialises the UART component pins ready to send and receive data 
|-
 
|-
 
| 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''
 
|}
 
 
 
{| 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. 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
 
| width="90%" | StringData
 
|-
 
| colspan="2" |  
 
|-
 
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
 
| width="90%" | NumBytes
 
|-
 
| colspan="2" | Maximum number of bytes to try and receive 
 
|-
 
| 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 
 
|-
 
| 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''
 
|}
 
 
 
{| 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;" | '''Start'''
 
|-
 
| colspan="2" | Startup routine required by the hardware device. Automatically clears the display after initialising. 
 
|-
 
|-
 
| 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''
 
|}
 
 
 
{| 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;" | '''SetLEDState'''
 
|-
 
| colspan="2" | Sets the state of a single LED 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Port
 
|-
 
| colspan="2" | 0 = PortA, 1 = PortB 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | LED
 
|-
 
| colspan="2" | 0 = LED0, 7 = LED7 
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | State
 
|-
 
| colspan="2" |  
 
|-
 
| 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''
 
|}
 
 
 
{| 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;" | '''GetRxIdent'''
 
|-
 
| colspan="2" | Gets the Rx ID as a Integer Standard and Extended IDs. 
 
|-
 
|-
 
| width="10%" align="center" | [[File:Fc9-u8-icon.png]] - BYTE
 
| width="90%" | Buffer
 
|-
 
| colspan="2" |  
 
|-
 
| 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''
 
|}
 
 
 
{| 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" | Must be called before any other CAN component macros to enable and initialise the CAN peripheral.  
 
 
|-
 
|-
 
|-
 
|-

Revision as of 11:03, 17 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



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