Difference between revisions of "Component: RF 2.4GHz (Wireless)"

From Flowcode Help
Jump to navigationJump to search
(XML import)
 
Line 1: Line 1:
 
+
{| width="50%"
 
 
{| width="50%"
 
 
|-
 
|-
| width="20%" style="color: gray;" | Author
+
| width="20%" style="color: gray;" | Author
 
| Matrix Ltd.
 
| Matrix Ltd.
 
|-
 
|-
| width="20%" style="color: gray;" | Version
+
| width="20%" style="color: gray;" | Version
 
| 1.1 (Release)
 
| 1.1 (Release)
 
|-
 
|-
| width="20%" style="color: gray;" | Category
+
| width="20%" style="color: gray;" | Category
 
| Wireless
 
| Wireless
 
|}
 
|}
Line 19: Line 17:
  
 
==Examples==
 
==Examples==
''<span style="color:red;">No additional examples</span>''
+
&apos;&apos;&lt;span style=&quot;color:red;&quot;&gt;No additional examples&lt;/span&gt;&apos;&apos;
  
  
 
==Downloadable macro reference==
 
==Downloadable macro reference==
  
===<span style="font-weight: normal;"><u><tt>StartListening</tt></u></span>===
+
===&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;u&gt;&lt;tt&gt;ReadRxByte&lt;/tt&gt;&lt;/u&gt;&lt;/span&gt;===
Starts listening for incoming data
+
Reads a single byte back from the local Rx buffer.
 +
 
 +
&apos;&apos;&apos;Parameters&apos;&apos;&apos;
 +
 
 +
:[[Variable Types|BYTE]] &apos;&apos;Index&apos;&apos;
 +
::Byte to read, range 0 - 31
 +
 
 +
 
 +
&apos;&apos;&apos;Return value&apos;&apos;&apos;
 +
 
 +
:[[Variable Types|BYTE]]
 +
 
 +
 
 +
===&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;u&gt;&lt;tt&gt;WriteTxByte&lt;/tt&gt;&lt;/u&gt;&lt;/span&gt;===
 +
Reads a single byte to the local Tx buffer.
 +
 
 +
&apos;&apos;&apos;Parameters&apos;&apos;&apos;
 +
 
 +
:[[Variable Types|BYTE]] &apos;&apos;Index&apos;&apos;
 +
::Byte to read, range 0 - 31
 +
 
 +
:[[Variable Types|BYTE]] &apos;&apos;Value&apos;&apos;
 +
 
 +
 
 +
&apos;&apos;&apos;Return value&apos;&apos;&apos;
 +
 
 +
:&apos;&apos;This call does not return a value&apos;&apos;
 +
 
 +
 
 +
===&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;u&gt;&lt;tt&gt;FlushRx&lt;/tt&gt;&lt;/u&gt;&lt;/span&gt;===
 +
Tells the RF module to flush the contents of the receive buffer.
 +
 
 +
Returns the status from sending the command.
 +
 
 +
&apos;&apos;&apos;Parameters&apos;&apos;&apos;
 +
 
 +
:&apos;&apos;This macro has no parameters&apos;&apos;
 +
 
 +
 
 +
&apos;&apos;&apos;Return value&apos;&apos;&apos;
 +
 
 +
:[[Variable Types|BYTE]]
 +
 
  
'''Parameters'''
+
===&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;u&gt;&lt;tt&gt;ReadRxFifo&lt;/tt&gt;&lt;/u&gt;&lt;/span&gt;===
 +
Reads the Rx FIFO buffer into a local buffer.
  
:''This macro has no parameters''
+
Use the ReadBuffer macro to collect the individual data bytes.
  
 +
&apos;&apos;&apos;Parameters&apos;&apos;&apos;
  
'''Return value'''
+
:[[Variable Types|BYTE]] &apos;&apos;NumBytes&apos;&apos;
 +
::Number of bytes to try and read from the FIFO Range 1-32
  
:''This call does not return a value''
 
  
 +
&apos;&apos;&apos;Return value&apos;&apos;&apos;
  
===<span style="font-weight: normal;"><u><tt>OpenReadingPipe</tt></u></span>===
+
:&apos;&apos;This call does not return a value&apos;&apos;
Opens a data pipe for receiving data at the pipe address specified
 
  
'''Parameters'''
 
  
:[[Variable Types|BYTE]] ''child''
+
===&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;u&gt;&lt;tt&gt;WriteTxFifo&lt;/tt&gt;&lt;/u&gt;&lt;/span&gt;===
::Range 0-5
+
Writes the contents of the local Tx buffer to the Transmit FIFO.
  
 +
&apos;&apos;&apos;Parameters&apos;&apos;&apos;
  
'''Return value'''
+
:[[Variable Types|BYTE]] &apos;&apos;NumBytes&apos;&apos;
 +
::Number of bytes to write to the FIFO, Range 1 - 32
  
:''This call does not return a value''
 
  
 +
&apos;&apos;&apos;Return value&apos;&apos;&apos;
  
===<span style="font-weight: normal;"><u><tt>Read</tt></u></span>===
+
:&apos;&apos;This call does not return a value&apos;&apos;
Attempts to read received data from the RF module.
 
  
Returns 0 to indicate that there is still data to follow.
 
  
Returns 1 to indicate this is the last of the incoming data.
+
===&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;u&gt;&lt;tt&gt;FlushTx&lt;/tt&gt;&lt;/u&gt;&lt;/span&gt;===
 +
Tells the RF module to flush the contents of the transmit buffer.
  
'''Parameters'''
+
Returns the status from sending the command.
  
:[[Variable Types|BYTE]] ''buffer''
+
&apos;&apos;&apos;Parameters&apos;&apos;&apos;
  
:[[Variable Types|BYTE]] ''length''
+
:&apos;&apos;This macro has no parameters&apos;&apos;
  
  
'''Return value'''
+
&apos;&apos;&apos;Return value&apos;&apos;&apos;
  
 
:[[Variable Types|BYTE]]
 
:[[Variable Types|BYTE]]
  
  
===<span style="font-weight: normal;"><u><tt>StopListening</tt></u></span>===
+
===&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;u&gt;&lt;tt&gt;CheckRX&lt;/tt&gt;&lt;/u&gt;&lt;/span&gt;===
Stops listening for incoming data
+
Check the Rx FIFO status register for any new data.
  
'''Parameters'''
+
Returns 0 = No data
  
:''This macro has no parameters''
+
Returns 1 = New data available
  
 +
&apos;&apos;&apos;Parameters&apos;&apos;&apos;
  
'''Return value'''
+
:&apos;&apos;This macro has no parameters&apos;&apos;
  
:''This call does not return a value''
 
  
 +
&apos;&apos;&apos;Return value&apos;&apos;&apos;
  
===<span style="font-weight: normal;"><u><tt>SetPipeAddress</tt></u></span>===
+
:[[Variable Types|BYTE]]
Sets the pipe address based on a 5-byte array.
 
  
'''Parameters'''
 
  
:[[Variable Types|BYTE]] ''Pipe''
+
===&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;u&gt;&lt;tt&gt;ReadRegister&lt;/tt&gt;&lt;/u&gt;&lt;/span&gt;===
::Selects the data pipe - range 0-5
+
Reads a single bytes from the selected register.
  
:[[Variable Types|BYTE]] ''PipeAddress''
+
Directly returns the value read back from the register.
  
 +
&apos;&apos;&apos;Parameters&apos;&apos;&apos;
  
'''Return value'''
+
:[[Variable Types|BYTE]] &apos;&apos;Reg&apos;&apos;
 +
::Register address to access
  
:''This call does not return a value''
 
  
 +
&apos;&apos;&apos;Return value&apos;&apos;&apos;
  
===<span style="font-weight: normal;"><u><tt>Write</tt></u></span>===
+
:[[Variable Types|BYTE]]
Writes data to be transmitted by the RF module.
 
  
Returns 0 to indicate a timeout
 
  
Returns 1 to indicate a succesful transmission.
+
===&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;u&gt;&lt;tt&gt;SetTxMode&lt;/tt&gt;&lt;/u&gt;&lt;/span&gt;===
 +
Sets the module up ready to transmit data.
  
'''Parameters'''
+
&apos;&apos;&apos;Parameters&apos;&apos;&apos;
  
:[[Variable Types|BYTE]] ''Data''
+
:[[Variable Types|BYTE]] &apos;&apos;PA0&apos;&apos;
 +
::Pipe Address Bytes
  
:[[Variable Types|BYTE]] ''Length''
+
:[[Variable Types|BYTE]] &apos;&apos;PA1&apos;&apos;
 +
::Pipe Address Bytes
  
 +
:[[Variable Types|BYTE]] &apos;&apos;PA2&apos;&apos;
 +
::Pipe Address Bytes
  
'''Return value'''
+
:[[Variable Types|BYTE]] &apos;&apos;PA3&apos;&apos;
 +
::Pipe Address Bytes
  
:[[Variable Types|BYTE]]
+
:[[Variable Types|BYTE]] &apos;&apos;PA4&apos;&apos;
 +
::Pipe Address Bytes
 +
 
 +
 
 +
&apos;&apos;&apos;Return value&apos;&apos;&apos;
 +
 
 +
:&apos;&apos;This call does not return a value&apos;&apos;
 +
 
 +
 
 +
===&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;u&gt;&lt;tt&gt;SetRxMode&lt;/tt&gt;&lt;/u&gt;&lt;/span&gt;===
 +
Sets the module up ready to receive data.
 +
 
 +
&apos;&apos;&apos;Parameters&apos;&apos;&apos;
 +
 
 +
:[[Variable Types|BYTE]] &apos;&apos;PA0&apos;&apos;
 +
::Pipe Address Bytes
  
 +
:[[Variable Types|BYTE]] &apos;&apos;PA1&apos;&apos;
 +
::Pipe Address Bytes
  
===<span style="font-weight: normal;"><u><tt>Available</tt></u></span>===
+
:[[Variable Types|BYTE]] &apos;&apos;PA2&apos;&apos;
Checks for incoming data.
+
::Pipe Address Bytes
  
Returns 0 if no data available.
+
:[[Variable Types|BYTE]] &apos;&apos;PA3&apos;&apos;
 +
::Pipe Address Bytes
  
Returns 1 for data available.
+
:[[Variable Types|BYTE]] &apos;&apos;PA4&apos;&apos;
 +
::Pipe Address Bytes
  
'''Parameters'''
 
  
:''This macro has no parameters''
+
&apos;&apos;&apos;Return value&apos;&apos;&apos;
  
 +
:&apos;&apos;This call does not return a value&apos;&apos;
  
'''Return value'''
 
  
:[[Variable Types|BYTE]]
+
===&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;u&gt;&lt;tt&gt;WriteRegister&lt;/tt&gt;&lt;/u&gt;&lt;/span&gt;===
 +
Writes a single byte to the selected register.
  
 +
Returns the status of the write command.
  
===<span style="font-weight: normal;"><u><tt>OpenWritingPipe</tt></u></span>===
+
&apos;&apos;&apos;Parameters&apos;&apos;&apos;
Opens a data pipe for transmitting data at the pipe address specified
 
  
'''Parameters'''
+
:[[Variable Types|BYTE]] &apos;&apos;Reg&apos;&apos;
 +
::Register address to access
  
:''This macro has no parameters''
+
:[[Variable Types|BYTE]] &apos;&apos;Value&apos;&apos;
  
  
'''Return value'''
+
&apos;&apos;&apos;Return value&apos;&apos;&apos;
  
:''This call does not return a value''
+
:[[Variable Types|BYTE]]
  
  
===<span style="font-weight: normal;"><u><tt>Initialise</tt></u></span>===
+
===&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;u&gt;&lt;tt&gt;Initialise&lt;/tt&gt;&lt;/u&gt;&lt;/span&gt;===
 
Starts up and configures the RF module ready for use.
 
Starts up and configures the RF module ready for use.
  
 
The macro will return a value greater then 0 if the module has been started correctly, otherwise the macro will return a 0.
 
The macro will return a value greater then 0 if the module has been started correctly, otherwise the macro will return a 0.
  
'''Parameters'''
+
&apos;&apos;&apos;Parameters&apos;&apos;&apos;
  
:''This macro has no parameters''
+
:&apos;&apos;This macro has no parameters&apos;&apos;
  
  
'''Return value'''
+
&apos;&apos;&apos;Return value&apos;&apos;&apos;
  
 
:[[Variable Types|UINT]]
 
:[[Variable Types|UINT]]
Line 166: Line 233:
 
==Simulation macro reference==
 
==Simulation macro reference==
  
''This component does not contain any simulation macros''
+
&apos;&apos;This component does not contain any simulation macros&apos;&apos;
  
  
 
==Property reference==
 
==Property reference==
<span style="font-weight: normal;"><u>Dynamic Payloads</u></span>
+
&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;u&gt;RF Channel&lt;/u&gt;&lt;/span&gt;
  
This property is of type ''True or false'' and can be referenced with the variable name ''DynamicPayloads''.
+
This property is of type &apos;&apos;Unsigned integer&apos;&apos; and can be referenced with the variable name &apos;&apos;RFChannel&apos;&apos;.
  
Configures how the data packets are assembled and transmitted.
+
Sets the RF channel from 0 - 127 = 2.4000GHz - 2.525GHz
  
No = Always send out packets of 32 bytes, pad the number of bytes with the value 0.
+
Both the transmitter and receiver should be on the same channel to receive data.
  
Yes = Allow variable sized data packets, only transmit valid data.
+
&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;u&gt;SPI Channel&lt;/u&gt;&lt;/span&gt;
  
<span style="font-weight: normal;"><u>SPI Channel</u></span>
+
This property is of type &apos;&apos;Fixed list of ints&apos;&apos; and can be referenced with the variable name &apos;&apos;Channel&apos;&apos;.
 
 
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''Channel''.
 
  
 
SPI peripheral used to talk to the RF module.
 
SPI peripheral used to talk to the RF module.
  
<span style="font-weight: normal;"><u>FSEL Pin</u></span>
+
&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;u&gt;MOSI Pin&lt;/u&gt;&lt;/span&gt;
 
 
This property is of type ''Single digital pin'' and can be referenced with the variable name ''fsel_pin''.
 
 
 
RF Mode selection pin
 
 
 
<span style="font-weight: normal;"><u>MOSI Pin</u></span>
 
  
This property is of type ''Single digital pin'' and can be referenced with the variable name ''mosi_pin''.
+
This property is of type &apos;&apos;Single digital pin&apos;&apos; and can be referenced with the variable name &apos;&apos;mosi_pin&apos;&apos;.
  
 
SPI Data Out pin - Master Out Slave In
 
SPI Data Out pin - Master Out Slave In
  
<span style="font-weight: normal;"><u>MISO Pin</u></span>
+
&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;u&gt;MISO Pin&lt;/u&gt;&lt;/span&gt;
  
This property is of type ''Single digital pin'' and can be referenced with the variable name ''miso_pin''.
+
This property is of type &apos;&apos;Single digital pin&apos;&apos; and can be referenced with the variable name &apos;&apos;miso_pin&apos;&apos;.
  
 
SPI Data In pin - Master In Slave Out
 
SPI Data In pin - Master In Slave Out
  
<span style="font-weight: normal;"><u>SCK Pin</u></span>
+
&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;u&gt;SCK Pin&lt;/u&gt;&lt;/span&gt;
  
This property is of type ''Single digital pin'' and can be referenced with the variable name ''sck_pin''.
+
This property is of type &apos;&apos;Single digital pin&apos;&apos; and can be referenced with the variable name &apos;&apos;sck_pin&apos;&apos;.
  
 
Serial clock pin
 
Serial clock pin
  
<span style="font-weight: normal;"><u>CE Pin</u></span>
+
&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;u&gt;CE Pin&lt;/u&gt;&lt;/span&gt;
  
This property is of type ''Single digital pin'' and can be referenced with the variable name ''ce_pin''.
+
This property is of type &apos;&apos;Single digital pin&apos;&apos; and can be referenced with the variable name &apos;&apos;ce_pin&apos;&apos;.
  
 
Chip select pin
 
Chip select pin
  
<span style="font-weight: normal;"><u>CSN Pin</u></span>
+
&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;u&gt;CSN Pin&lt;/u&gt;&lt;/span&gt;
  
This property is of type ''Single digital pin'' and can be referenced with the variable name ''csn_pin''.
+
This property is of type &apos;&apos;Single digital pin&apos;&apos; and can be referenced with the variable name &apos;&apos;csn_pin&apos;&apos;.
  
''<span style="color:red;">No additional information</span>''
+
&apos;&apos;&lt;span style=&quot;color:red;&quot;&gt;No additional information&lt;/span&gt;&apos;&apos;
  
  
  
<span style="font-weight: normal;"><u>Label</u></span>
+
&lt;span style=&quot;font-weight: normal;&quot;&gt;&lt;u&gt;Label&lt;/u&gt;&lt;/span&gt;
  
This property is of type ''Line of text'' and can be referenced with the variable name ''label''.
+
This property is of type &apos;&apos;Line of text&apos;&apos; and can be referenced with the variable name &apos;&apos;label&apos;&apos;.
  
 
Label used to help identify the component on the panel.
 
Label used to help identify the component on the panel.

Revision as of 10:38, 3 August 2016

Author Matrix Ltd.
Version 1.1 (Release)
Category Wireless


Image RF 2.4GHz component

A simple RF communications module based on the 2.4GHz nRF24L01 modules.

Examples

''<span style="color:red;">No additional examples</span>''


Downloadable macro reference

<span style="font-weight: normal;"><u><tt>ReadRxByte</tt></u></span>

Reads a single byte back from the local Rx buffer.

'''Parameters'''

BYTE ''Index''
Byte to read, range 0 - 31


'''Return value'''

BYTE


<span style="font-weight: normal;"><u><tt>WriteTxByte</tt></u></span>

Reads a single byte to the local Tx buffer.

'''Parameters'''

BYTE ''Index''
Byte to read, range 0 - 31
BYTE ''Value''


'''Return value'''

''This call does not return a value''


<span style="font-weight: normal;"><u><tt>FlushRx</tt></u></span>

Tells the RF module to flush the contents of the receive buffer.

Returns the status from sending the command.

'''Parameters'''

''This macro has no parameters''


'''Return value'''

BYTE


<span style="font-weight: normal;"><u><tt>ReadRxFifo</tt></u></span>

Reads the Rx FIFO buffer into a local buffer.

Use the ReadBuffer macro to collect the individual data bytes.

'''Parameters'''

BYTE ''NumBytes''
Number of bytes to try and read from the FIFO Range 1-32


'''Return value'''

''This call does not return a value''


<span style="font-weight: normal;"><u><tt>WriteTxFifo</tt></u></span>

Writes the contents of the local Tx buffer to the Transmit FIFO.

'''Parameters'''

BYTE ''NumBytes''
Number of bytes to write to the FIFO, Range 1 - 32


'''Return value'''

''This call does not return a value''


<span style="font-weight: normal;"><u><tt>FlushTx</tt></u></span>

Tells the RF module to flush the contents of the transmit buffer.

Returns the status from sending the command.

'''Parameters'''

''This macro has no parameters''


'''Return value'''

BYTE


<span style="font-weight: normal;"><u><tt>CheckRX</tt></u></span>

Check the Rx FIFO status register for any new data.

Returns 0 = No data

Returns 1 = New data available

'''Parameters'''

''This macro has no parameters''


'''Return value'''

BYTE


<span style="font-weight: normal;"><u><tt>ReadRegister</tt></u></span>

Reads a single bytes from the selected register.

Directly returns the value read back from the register.

'''Parameters'''

BYTE ''Reg''
Register address to access


'''Return value'''

BYTE


<span style="font-weight: normal;"><u><tt>SetTxMode</tt></u></span>

Sets the module up ready to transmit data.

'''Parameters'''

BYTE ''PA0''
Pipe Address Bytes
BYTE ''PA1''
Pipe Address Bytes
BYTE ''PA2''
Pipe Address Bytes
BYTE ''PA3''
Pipe Address Bytes
BYTE ''PA4''
Pipe Address Bytes


'''Return value'''

''This call does not return a value''


<span style="font-weight: normal;"><u><tt>SetRxMode</tt></u></span>

Sets the module up ready to receive data.

'''Parameters'''

BYTE ''PA0''
Pipe Address Bytes
BYTE ''PA1''
Pipe Address Bytes
BYTE ''PA2''
Pipe Address Bytes
BYTE ''PA3''
Pipe Address Bytes
BYTE ''PA4''
Pipe Address Bytes


'''Return value'''

''This call does not return a value''


<span style="font-weight: normal;"><u><tt>WriteRegister</tt></u></span>

Writes a single byte to the selected register.

Returns the status of the write command.

'''Parameters'''

BYTE ''Reg''
Register address to access
BYTE ''Value''


'''Return value'''

BYTE


<span style="font-weight: normal;"><u><tt>Initialise</tt></u></span>

Starts up and configures the RF module ready for use.

The macro will return a value greater then 0 if the module has been started correctly, otherwise the macro will return a 0.

'''Parameters'''

''This macro has no parameters''


'''Return value'''

UINT


Simulation macro reference

''This component does not contain any simulation macros''


Property reference

<span style="font-weight: normal;"><u>RF Channel</u></span>

This property is of type ''Unsigned integer'' and can be referenced with the variable name ''RFChannel''.

Sets the RF channel from 0 - 127 = 2.4000GHz - 2.525GHz

Both the transmitter and receiver should be on the same channel to receive data.

<span style="font-weight: normal;"><u>SPI Channel</u></span>

This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''Channel''.

SPI peripheral used to talk to the RF module.

<span style="font-weight: normal;"><u>MOSI Pin</u></span>

This property is of type ''Single digital pin'' and can be referenced with the variable name ''mosi_pin''.

SPI Data Out pin - Master Out Slave In

<span style="font-weight: normal;"><u>MISO Pin</u></span>

This property is of type ''Single digital pin'' and can be referenced with the variable name ''miso_pin''.

SPI Data In pin - Master In Slave Out

<span style="font-weight: normal;"><u>SCK Pin</u></span>

This property is of type ''Single digital pin'' and can be referenced with the variable name ''sck_pin''.

Serial clock pin

<span style="font-weight: normal;"><u>CE Pin</u></span>

This property is of type ''Single digital pin'' and can be referenced with the variable name ''ce_pin''.

Chip select pin

<span style="font-weight: normal;"><u>CSN Pin</u></span>

This property is of type ''Single digital pin'' and can be referenced with the variable name ''csn_pin''.

''<span style="color:red;">No additional information</span>''


<span style="font-weight: normal;"><u>Label</u></span>

This property is of type ''Line of text'' and can be referenced with the variable name ''label''.

Label used to help identify the component on the panel.