Component: RF ISM (EB063, MRF49XA) (Wireless)

From Flowcode Help
Jump to navigationJump to search


Author Matrix Ltd.
Version 2.0 (Release)
Category Wireless


Image RF ISM (EB063, MRF49XA) component

A simple RF-ISM communications module based on the Microchip Alpha MRF49XA device. Also available in the form of the EB063 RF E-block.

Examples

The example attempts to send and receive data from a remote board. You will need two RF modules to allow the communications to work.

The example can be used to drive both ends of the RF communications as it will send out data but also print out any data received onto the LCD. Pins RA0 and RA1 can be used for diagnostics on the program. FC6 Icon.png RF Example

Downloadable macro reference

SetSyncPattern

Allows the sync pattern to be modified during runtime to allow for switching between several different RF connections.

Parameters

BYTE Mode
Switches on or off the extended sync functionality
BYTE Pattern
The bit pattern used for the standard sync mode


Return value

This call does not return a value


ReceiveByte

Puts the RF module in data mode and attempts to receive a single byte from the RF connection. Only packets containing a single data byte will be accepted.

Parameters

BYTE Timeout
Specifies how many milliseconds to wait for valid data before returning.


Return value

BYTE


SendString

Puts the RF module in data mode and transmits a packet containing the data string through the RF connection.

A packet consists of Sync information, Data and Checksum.

Parameters

STRING Data


Return value

This call does not return a value


TXTune

Used to specify and adjust the RF transmitter properties during runtime.

Parameters

BYTE Deviation
Specifies the transmit FSK frequency deviation - Range 0 - 15
BYTE Power
Specifies the transmitter power - Range 0 - 7


Return value

This call does not return a value


RXTune

Used to specify and adjust the RF receiver properties during runtime.

Parameters

BYTE Bandwidth
Specifies the Rx bandwidth - Range 1- 6
BYTE Gain
Specifies the Rx gain - Range 0 - 3
BYTE Threshold
Specifies the Rx signal to noise threshold - Range 0 - 5


Return value

This call does not return a value


SetBufferData

Allows a value to be loaded into the transmit buffer,

Parameters

BYTE Index
The current location in the transmit buffer starting from 0
BYTE Data
The data value to pass


Return value

This call does not return a value


UpdateCenterFrequency

Allows the RF center frequency to be adjusted during runtime to allow multiple RF channels to be scanned or multiplexed.

Parameters

UINT Frequency
Specifies the new center frequency value - Range 96 - 3903


Return value

This call does not return a value


FSKWrite

Writes to the FSK (frequency shift key) data pin.

Parameters

BYTE State


Return value

This call does not return a value


GetDataCount

Returns the number of bytes in the received data buffer.

Parameters

This macro has no parameters


Return value

BYTE


SendBuffer

Sends the contents of the transmit buffer.

Parameters

BYTE Count
Specifies how many bytes to transfer from the transmit buffer


Return value

This call does not return a value


SendByte

Puts the RF module in data mode and transmits a packet containing a single data byte through the RF connection.

A packet consists of Sync information, Data and Checksum.

Parameters

BYTE Data


Return value

This call does not return a value


ActivateTXMode

Enables the transmitter interface, allowing data to be sent.

The receiver interface is automatically disabled.

Parameters

This macro has no parameters


Return value

This call does not return a value


SetDataRate

Allows the RF data rate to be adjusted during runtime.

Parameters

BYTE Rate
Specifies the new data rate


Return value

This call does not return a value


ActivateRXMode

Enables the receiver interface, allowing data to be received.

The transmitter interface is automatically disabled.

Parameters

This macro has no parameters


Return value

This call does not return a value


FSKRead

Reads the FSK (frequency shift key) data pin.

Parameters

This macro has no parameters


Return value

BYTE


ReadRXSignalStrength

Returns the current received signal strength.

Parameters

This macro has no parameters


Return value

BYTE


Uninitialise

Powers down the RF module. The module must be re-initialised before it can be used again.

Parameters

This macro has no parameters


Return value

This call does not return a value


CheckBuffer

Checks for incoming data for a specific period of time.

Returns a value greater then 250 to indicate a failure.

Returns the length of the incoming data buffer to indicate success.

Parameters

BYTE Timeout
Time to wait before returning no data available


Return value

BYTE


GetBufferData

Returns a value from the incoming receive data buffer.

Parameters

BYTE Index
Specifies which position in the buffer to read data from


Return value

BYTE


ReceiveString

Puts the RF module in data mode and attempts to receive a string of bytes from the RF connection.

Parameters

BYTE Length
Specifies the maximum number of bytes to try and receive
BYTE Timeout
Specifies how many milliseconds to wait for valid data before returning.


Return value

STRING


Initialise

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

BYTE


Simulation macro reference

This component does not contain any simulation macros


Property reference

Channel

This property is of type Fixed list of ints and can be referenced with the variable name cal_spi::CHANNEL.

SPI Channel selector

MOSI

This property is of type Single digital pin and can be referenced with the variable name cal_spi::MOSI.

SPI Data Out Pin SDO - Also Known as Master Out Slave In (MOSI) when used in Master mode.

MISO

This property is of type Single digital pin and can be referenced with the variable name cal_spi::MISO.

SPI Data In Pin SDI - Also Known as Master In Slave Out (MISO) when used in Master mode.

CLK

This property is of type Single digital pin and can be referenced with the variable name cal_spi::CLK.

SPI Clock Pin CLK - The Clock signal is driven by the SPI master.

CS / SS

This property is of type Single digital pin and can be referenced with the variable name cal_spi::SS.

Chip Select / Slave Select Pin

Master Mode: General purpose output pin used to select the remote SPI device.

Slave Mode: Hardware chip select pin input used to select the SPI device.

FSEL Pin

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

RF Mode selection pin

Module Frequency

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

Module frequency - must be matched with the specific RF transciever being used.

Center Frequency (96-3903)

This property is of type Signed integer and can be referenced with the variable name cent_freq.

Specifies the default RF center frequency

Center Frequency (MHz)

This property is of type Floating point and can be referenced with the variable name cent_freq_cal.

Calculation to work out the approx actual frequency

Data Mode

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

Specifies if the module will send data packets (Byte) or FSK bits (Bit)

Data Buffer Size (Max)

This property is of type Signed integer and can be referenced with the variable name buffer_size.

Maximum number of bytes that can be loaded into a single data packet

Rate Divider 1

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

Data rate prescaler 1 - Coarse control

Rate Divider 2 (0-127)

This property is of type Signed integer and can be referenced with the variable name data_div2.

Data rate prescaler 2 - Fine control

Max Throughput (Kb/s)

This property is of type Floating point and can be referenced with the variable name baud_rate.

Calculated max data throughput if the data is 100% active

Data Rate Value

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

Actual default value passed to the data rate control

Sync Pattern

This property is of type Signed integer and can be referenced with the variable name sync_pattern.

Default sync pattern used by the standard sync in byte data mode.

Extended Sync

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

Selects if an additional fixed sync byte is to be used.

Bandwidth

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

Controls the receiver bandwidth, the higher the value the bigger the datarate that can be acheived but the fewer channels that can co-exist

Gain

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

Controls the receiver gain - the amount to amplify the incoming signal before processing

Threshold

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

The signal to noise threshold used to control the sensitivity

Bandwidth

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

Controls the transmitter bandwidth, i.e. the frequency either side of the center frequency to use for the RF communications

Power

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

The amount of power to use when transmitting

Label

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.

Scope Traces

This property is of type True or false and can be referenced with the variable name cal_spi::ScopeTraces.

Selects if the scope traces are automatically generated or not

Console Data

This property is of type True or false and can be referenced with the variable name cal_spi::ConsoleData.

Selects if the console data is automatically generated or not

Injector

This property is of type Fixed list of ints and can be referenced with the variable name cal_spi::Injector.

No additional information