rfOpen (Function)

Top  Previous  Next

Architecture:

X32 / NX32L

Device support:

AX9 pro, CX1 pro/pro-c/warp/warp-c, SX1, AX9 turbo, NX-900, LX5

Firmware version:

2.20 / 1.51.00


This function will open the RF interface. Calling this function is required before the RF interface can be used.

It is necessary to call rfClose after using the interface.

 

The ID must be specified when calling rfOpen and is used for the filtering of packages. Only packages sent with rfSend that have the specified ID as their destination or are sent out as a broadcast will be received (see RF Functions for details).

 

The communication speed set by the "baud" parameter must be equal for peers to communicate. A lower communication speed will yield a longer transmission range.

 

Calling rfOpen will revert the power level set by rfSetPower to the default value.

 

 

Input:

id : INT ( 1..254 )

ID - used for filtering of incoming packages.

 

baud : DINT (1200,2400,4800,9600,38400) (default 4800)

Baud rate. A lower baud rate will increase the communication range.

 

Returns: INT

0


- Ok. Interface is open.

-2


- Already open.

-3


- Failed to power on RF module.

-4


- RF not supported on device or module is used by another interface (see rfbcClose).

-6


- Error in parameter.

 

Declaration:

FUNCTION rfOpen : INT;
VAR_INPUT
  id      : INT  := -1;
  baud    : DINT := 4800;
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
 
PROGRAM example;
BEGIN
rfOpen(id := 1);
 ...
rfClose();
END;
END_PROGRAM;