Name:
rfout
Syntax:

RFOUT pin, (data, data, data, data, data, data, data, data)

Pin - is a variable/constant which specifies the i/o pin to use

Data - is a constant/variable specifying the byte data

Description:

Send 8 bytes of Manchester encoded radio data to a NKM2401 decoder or a PICAXE rfin command over a wireless link. Note that the rfout command always sends 8 bytes of data, so exactly 8 data variables are required within this command syntax.

The rfout command encodes and transmits 8 bytes of data over a radio link to a NKM2401 decoder or another PICAXE chip. This provides much more reliable radio communication than using serout commands with low cost RF modules. This command is equivalent to using an NKM2401 encoder to transmit the data. Therefore if using a PICAXE chip that does not support this command, simply use a NKM2401 encoder instead. The NKM2401 decoder can be used with all PICAXE chips, even those that do not support the rfout command.

For futher details about how to use the NKM2401 decoder please see the AXE213 datasheet. This datasheet also explains in detail how to use low cost RF modules.

Effect of increased clock speed:

This command only functions at 4MHz. M2 and X2 parts automatically use the internal 4MHz resonator for this command.

18M2 Firmware

Please note the 'rfout' command is only supported for 18M2 firmware D.x (PICAXE chips labelled 18M2+) and is not available for use with 18M2 firmware 2.x (PICAXE chips labelled 18M2).

The PICAXE compiler will syntax check code for an 18M2 as correct when using the 'rfout' command but will generate an error when an attempt is made to download into an 18M2 with firmware 2.x.

Applies To:
14M2, 18M2, 20M2, 28X2, 40X2
See Also:
Related Create:
Share:
Print:

Send RF data

Read a DS18B20 temperature sensor on input pin C.1 and send the data via an RF transmitter module connected to output B.0

Code Example:
main:	readtemp C.1, b7		; read temperature into variable b7
	bintoascii b7,b8,b9,b10		; separate into 3 ASCII characters
	high b.1			; switch radio module on (TXEN)
	rfout b.0,(“Temp=”,b8,b9,b10)	; send data (TX)
	low b.1				; switch radio module off (TXEN)
	pause 2000			; wait 2 seconds
	goto main			; loop forever
Copy Code Submit an Example

Submit Your Own Code!

You must be logged in to submit code examples. Login now.