Basic ERF programming

DougDank

New member
Hi - I'm relatively new to PICAXE and starting a school project involving the use of two wireless ERF chips. I appreciate that the ERF chips have since been discontinued, but its the only wireless chip available to me and I am struggling to understand how to code it. I've read the handbook but it doesn't seem to offer too much help in my mind?

I'm trying to send 1 value from the chip to another using an 18M2 does anyone have an basic code lying about that I could use to make this happen?

Thank you very much in advance,

Doug
 

hippy

Technical Support
Staff member
The RFA020 datasheet should have enough information in to get you going and do what you want -


First thing is to wire the modules to the PICAXE, page 4 -
Code:
01 – DTR –> Connect to LED via 1k resistor for RX/TX activity indicator
02 – RX  <- ERF data in, connect to PICAXE serial output pin
03 – TX  -> ERF data out, connect to PICAXE serial input pin
04 – PWR :  3 to 5V power supply
05 - CTS <- Chip enable, active low, connect to 0V to enable module
06 – GND :  0V power supply
The DTR connection is optional, can be left unconnected.

Once you have two modules connected to their respective PICAXE cips the code on page 12 shows how to send from one PICAXE to another. That could be simplified to send just one byte, on the transmitter, adjusting the pin as required -
Code:
Symbol TX = C.1 ; PICAXE output to ERF RX pin
setfreq m8
low TX
main:
pause 1000
serout TX, n9600_8, ( b0 )
b0 = b0 + 1
goto main
And for the receiver -
Code:
#picaxe 28X2
#terminal 9600
Symbol TX = C.1 ; PICAXE output to ERF RX pin
Symbol RX = C.7 ; PICAXE input to ERF TX pin
setfreq m8
low TX
main:
serin RX, n9600_8, b0
sertxd( #b0, cr, lf )
goto main
 

DougDank

New member
Symbol TX = C.1 ; PICAXE output to ERF RX pin setfreq m8 low TX main: pause 1000 serout TX, n9600_8, ( b0 ) b0 = b0 + 1 goto main
I tried using this programme - yet i reciever this error:

Symbol TX = C.6 ; PICAXE output to ERF RX pin
^
Syntax error on line 1 at/before position 12
Error: Unknown symbol - C.6

What could be the problem?

Kind regards Doug
 

hippy

Technical Support
Staff member
I would guess that you don't have PICAXE Editor 6 configured to compile for an 18M2. Use the Workspace Explorer to select PICAXE-18M2 or add a "#PICAXE 18M2" directive at the top of your code.
 

DougDank

New member
I would guess that you don't have PICAXE Editor 6 configured to compile for an 18M2. Use the Workspace Explorer to select PICAXE-18M2 or add a "#PICAXE 18M2" directive at the top of your code.
Hi - I just managed to get hold of an 28X1 - yet still it fails to recognise the C.1 sign?
I have configured the Picaxe editor for the use of the 28x1
 

hippy

Technical Support
Staff member
The 28X1 does not have the same bidirectional pin capabilities of the M2 and X2 devices. Port B pins are the default output pins, Port C pins are the default input pins, and, correspondingly, SYMBOL defined pins need to be named differently.

Using a 28X1 will only complicate things further. You will be better off sticking with the 18M2 and resolving whatever problems you were having with that.

The syntax error for C.6 when using the 18M2 appears to be a simple configuration error; easily solved as described. Code using C.6 and C.7 on an 18M2 compiles for me without issue when things are properly configured.
 
Top