Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Hope 434MHz Wireless RFM01/RFM02. Anybody used them?

Status
Not open for further replies.
Hey everyone.

I bought some wireless transmitter and recievers from Futurlec some time ago.
Time to try them out.

They are manufactured by HOPE, links below.
**broken link removed**
**broken link removed**

I need some help.. I've looked at nigels wireless pages but find it hard to interpret at the moment. So I wanted to start at the basics.

Has anyone had any experience with these particular modules?
Specifically in Assembly

From what I can gather from HOPE's poor datasheets and pin diagrams, you use SPI to set up the modules and then data is shifted into the FSK to be transmitted.
Am I on the right track?

(With other projects I've had a basic understanding so they have been easier to approach. But when it comes to this, I dont know where. I'm a first timer when it comes to UART/USART too but am keen to persist until I have something working :D)

As with any project I (sucessfully) undertake I will publish everything on my site for all to view
 
I need some help.. I've looked at nigels wireless pages but find it hard to interpret at the moment. So I wanted to start at the basics.

Has anyone had any experience with these particular modules?
Specifically in Assembly

From what I can gather from HOPE's poor datasheets and pin diagrams, you use SPI to set up the modules and then data is shifted into the FSK to be transmitted.
Am I on the right track?

(With other projects I've had a basic understanding so they have been easier to approach. But when it comes to this, I dont know where. I'm a first timer when it comes to UART/USART too but am keen to persist until I have something working :D)

As with any project I (sucessfully) undertake I will publish everything on my site for all to view

I have never seen anyone try the RFM01/02. They are not very popular. The far more versatile RFM12B or RFM22 transceivers have a fairly wide following and you can google a decent amount of tutorials on them. Hope builds these modules using other manufacturers chips, so you might be able to get better datasheets from the original chip manufacturer. The RFM12B's and RFM22's use chips from Silicon Images, so I'm guessing the RFM01/02 does as well.

It should be as simple as just sending the data over SPI to a specific register for transmission. The only problem is the setup. Usually there's a bit of setup, telling it what frequency to use, what power mode to use, etc... If you can't find someone who has successfully used them you'll have to try and get that setup information from the datasheet. I know for the RFM12B's, they have sample code right on the site.

Hi,

Have you seen the Sparkfun equivalents RF Link Transmitter - 434MHz - SparkFun Electronics

They are simple to interface with the pic and mine worked well with Nigels coding - you have to use that Manchester encoding routine.

Found Sparkfun postage very cheap and quick.

Those things are terrible and should be avoided. They are finicky and for a full send/receive setup they are even more expensive than a pair of RFM12B's which are also sold by Sparkfun.
 
I own some RFM01 and RFM02, but I never actually used them. As DL said, they are based on some Si chips that are better documented. I have used the RFM12B with success. In HOPE RF's datasheet the include an examble for setup. It's in C, but if you have just the tiniest knowledge of C (like me), you can see what values they are setting the registers to. Match that in your ASM program. I want to say the RFM12B is equivalent to the Si4421 (not 100% on that) and Microchip's MRF49XA (100% sure on that). I used all three datasheets to clear up confusion that I had.

To be honest, it's pretty hard to write and takes a lot of troubleshooting. The RFM12B is a good choice over the bare chips because it first lets you confrim your software while knowing that your hardware is correct, though I did eventually get my MRF49XA board that I made working.

Tips:

Set up the basic register values in RAM or in a ROM table for each classification of the RFM12B's settings (base band, deviation, power, etc).

XOR them with different values to change the settings without altering your initially stored values because you often need to come back to them depending on what state you want the transciever to be in.

Remember that all commands to the RFM12B are word length, and that a status read is the only command that starts with a 0. Push the two bytes (if using an 8 bit uC) WITHOUT SLAVE DESELECTION.

Push two bytes of 0x00 over SPI to get the status word out of the transciever.

You MUST closely monitor the status word to know what the hell is going on and adjust your program from there.

Use the synchronous word instead of the synchronous byte. I pulled my hair out for hours trying to use just a synchronous byte, but I just kept getting trash. I think default the word is something like 0XD4A4, and it's fine to just leave it at that.

Range is impressive even on the lowest power setting. I probably got 20 yards transmitting from inside my house to outside with the lowest setting, and I didn't even try to see how far I could go with it.

Start with the lower BAUDs and work your way up as you get the bugs out.

-------------------------------------------------------

I think the RFM01 and RFM02 work the same way as far as initialization and commands, but they are just a little easier since they are just RX and TX instead of transcievers.
 
Thanks for the info guys.
As to using a transeiver, I'm going to have a go using the Tx only and Rx only chips.
Reason is I've got them right here ready to go on a breadboard and dont want to wait for more parts.

So I'll start with the Tx setup.
I'll have a look at the programming guide and post back here when I've got some code written.
 
They are more than capable. I was running their bigger brother, the RFM12B transciever, with a 16F818. Those radio devices should be using SPI, not USART.
 
Those radio devices should be using SPI, not USART.
Ok.
So is the SPI only to configure the modules.
How is data sent? Simply by changing the state of the FSK pin? How does the CLK (not the SCK for SPI), the nIRQ and the nSEL pins come into play.

Hope's flow charts in their datasheets really aren't detailed enough.
All I need is a dot point, step by step procedure to how the Tx works.
I don't want to ask for code, just how the thing works haha.

eg.
- Pull nSEL Low
- Use SPI to configure the module
- Release nSEL
- Send data to the FSK
- Wait....
 
Last edited:
If I remember correctly, I just tied FSK high through a pullup resistor on the RFM12B. The FSK pin (if its the same as the rfm12) is just an alternate, faster means to directly address the FIFO buffer versus addressing it over the SPI interface.

SCK is the same as the CLK pin. It's for the SPI clock signal.

nIRQ is an interrupt request that's either active low or hi (I can't remember) that tells the uC "Hey, this is the radio module. I really have something to tell you. Please stop what you are doing and read my status word." nIRQ is also useful because I want to say that it goes active in the middle of transfering bytes to the FIFO to say it's ready for the next byte when using the FSK line, but check me on that one.

Your description is more or less correct as I remember it for using the FSK line. When using just the SPI to send data (and pulling FSK high permanantly) I think the module sends a HIGH on the MISO line in the middle of transmission to say "go ahead and send the next byte." This is once the FIFO has been addressed and you are sending a series of bytes into the FIFO.
 
There's code in the programming guide for this.
**broken link removed**

I also found this arduino sketch which is pretty good. Has all the setup commands and everything for the RFM01 and RFM02.
https://www.contrechoc.com/fablab/RF01-02.zip

You don't use the FSK line at all. For general use, you use the SPI lines and you talk to it over SPI only. The datasheet assumes you have some knowledge of talking to SPI devices. It gives the list of registers that can be read and written to in order to setup the device and read its status.

The nIRQ pin is the only way for the module to signal that something is happening that you need to react to. You can change it's function, but generally you want it to signal whenever a byte has been received in the internal buffer so you can go and get it, or after a byte is sent and the RFM is ready to transmit another byte.

nSEL is the SPI slave select line.

This is not a module that you can just write to and get the data on the other side without actually knowing how it works. If you want something like that, you'll need to get something like an XBee.
 
I understand SPI and I've used it before. But I've done it manually in software. Not using the SCI peripheral feature of the PIC.

This is not a module that you can just write to and get the data on the other side without actually knowing how it works.
And that's what I would really like to do; find out how the modules work.
Thanks DL and other for helping with that, it's a great start and great help.
 
Since I took a look at that datasheet, it looks very similar to the RFM12. You might take a look at the RFM12 tutorials in order to get an idea of what needs doing. There's a bunch of them with schematics for setup if you google 'rfm12b guide' or 'rfm12b tutorial'
 
Here's my code for the RFM12B. This is for the transmitter function only.

The slave constant slave selection and deselection is not necessary. I was doing it for testing and troubleshooting and just left it there to be honest.

Code:
;RFM12B (TRANSMITTER FUNCTION ONLY) CODE BY WANNAB INVENTOR
;need to get rid of slave deselection when sending commands to module

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;  ROUTINES TO TEST SSPBUF FOR RECEIPT AND MOVE INTO RESPECTIVE MRFSTAT REGISTER
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

RDMRFHI	BTFSS	PIR1,3				;TEST TO SEE IF RECEIPT HAS OCCURED
		;BTFSS	SSPSTAT,0
		GOTO	$ - 1				;NO, GO BACK TO TEST SSPBUF INT BIT
		MOVF	SSPBUF,W			;MOVE RECEIVED INFO INTO W
		MOVWF	MRFSTATHI			;MOVE W INTO MRFSTATHI
		BCF		PIR1,3
		RETURN

RDMRFLO BTFSS	PIR1,3				;TEST TO SEE IF RECEIPT HAS OCCURED
		;BTFSS	SSPSTAT,0
		GOTO	$ - 1				;NO, GO BACK TO TEST SSPBUF INT BIT
		MOVF	SSPBUF,W			;MOVE
		MOVWF	MRFSTATLO			;MOVE W INTO MRFSTATLO
		BCF		PIR1,3
		RETURN


MRFSTATRD
		CALL	MS5DLAY
		BCF		PORTA,3
		MOVLW 	0x00
		MOVWF	SSPBUF
		CALL	RDMRFHI
		CALL	MS5DLAY
		MOVLW	0x00
		MOVWF	SSPBUF
		CALL	RDMRFLO

		CALL	CLRDISP
		MOVLW	80H					;THIS CODE BLOCK MOVES THE CURSOR TO
		MOVWF   PORTB				;THE 1ST SPACE ON THE TOP LEFT OF THE DISPLAY
		CALL	CLOCK
		MOVLW	0H
		MOVWF	PORTB
		CALL	CLOCK				;CURSOR SHOULD BE AT TOP, 1ST SPOT NOW
	
		BTFSS	MRFSTATHI,7		;THIS WILL TEST RECEIVED BYTE FOR WHAT TO DISPLAY
		CALL	NUM0
		BTFSC	MRFSTATHI,7
		CALL	NUM1
		BTFSS	MRFSTATHI,6
		CALL	NUM0
		BTFSC	MRFSTATHI,6
		CALL	NUM1
		BTFSS	MRFSTATHI,5
		CALL	NUM0
		BTFSC	MRFSTATHI,5
		CALL	NUM1
		BTFSS	MRFSTATHI,4
		CALL	NUM0
		BTFSC	MRFSTATHI,4
		CALL	NUM1
		BTFSS	MRFSTATHI,3
		CALL	NUM0
		BTFSC	MRFSTATHI,3
		CALL	NUM1
		BTFSS	MRFSTATHI,2
		CALL	NUM0
		BTFSC	MRFSTATHI,2
		CALL	NUM1
		BTFSS	MRFSTATHI,1
		CALL	NUM0
		BTFSC	MRFSTATHI,1
		CALL	NUM1
		BTFSS	MRFSTATHI,0
		CALL	NUM0
		BTFSC	MRFSTATHI,0
		CALL	NUM1

		BCF		PORTA,1		
		BCF		PORTA,4
		MOVLW   0C0H        ;Cursor on second line, C0 
		MOVWF   PORTB           
		CALL    CLOCK          
		MOVLW   0H           
		MOVWF   PORTB           
		CALL    CLOCK

		BTFSS	MRFSTATLO,7		;THIS WILL TEST RECEIVED BYTE FOR WHAT TO DISPLAY
		CALL	NUM0
		BTFSC	MRFSTATLO,7
		CALL	NUM1
		BTFSS	MRFSTATLO,6
		CALL	NUM0
		BTFSC	MRFSTATLO,6
		CALL	NUM1
		BTFSS	MRFSTATLO,5
		CALL	NUM0
		BTFSC	MRFSTATLO,5
		CALL	NUM1
		BTFSS	MRFSTATLO,4
		CALL	NUM0
		BTFSC	MRFSTATLO,4
		CALL	NUM1
		BTFSS	MRFSTATLO,3
		CALL	NUM0
		BTFSC	MRFSTATLO,3
		CALL	NUM1
		BTFSS	MRFSTATLO,2
		CALL	NUM0
		BTFSC	MRFSTATLO,2
		CALL	NUM1
		BTFSS	MRFSTATLO,1
		CALL	NUM0
		BTFSC	MRFSTATLO,1
		CALL	NUM1
		BTFSS	MRFSTATLO,0
		CALL	NUM0
		BTFSC	MRFSTATLO,0
		CALL	NUM1
		RETURN

;Configuration Section

START  	BSF     STATUS,5        	;Turns to Bank1.

		MOVLW	B'11000000'			;SEEMS TO WORK
		MOVWF	SSPSTAT

		MOVLW	B'00000000'
		MOVWF	ADCON0				;ADC IS SHUT OFF

		MOVLW  	B'00000110'     	;PORTA is digital
		MOVWF   ADCON1
          
		MOVLW   B'11100001'			;PORTA SETUP FOR
		MOVWF	TRISA

		MOVLW   B'00000010'                     
		MOVWF	TRISB           	;PORTB setup for SPI master

		MOVLW   B'01100000'                     
		MOVWF	OSCCON           	;oscillator 4MHz

		MOVLW   B'00000111'     	;Prescaler is /256
		MOVWF	OPTION_R        	;TIMER is 1/32 secs.

		MOVLW	B'11111111'			;keep tmr2 from overflowing by maxing PR2
		MOVWF	PR2

		BCF     STATUS,5        	;Return to Bank0

		MOVLW	B'00100000'
		MOVWF	SSPCON				;SPI CONTROL REGISTER ENABLED
		
		MOVLW	B'00000111'			;PRESCALE VALUE OF 1:16, TURN ON TMR2
		MOVWF	T2CON				

		MOVLW	B'00000000'			;INTERRUPTS OFF!
		MOVWF	INTCON		

		CLRF	PORTA
		CLRF	PORTB


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;INITIALIZATION FOR MRF49XA SPECIFIC REGISTERS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
		
;Configuration Command
;el : Enable TX register = 0
;ef : Enable RX FIFO buffer = 0
;Select 915 MHz band
;Select 10 pF crystal load capacitor

		MOVLW 	 0x80	;High Byte
		MOVWF	 GENCREGHI
		MOVLW 	 0x33	;Low Byte
		MOVWF	 GENCREGLO

;Frequency Command
;Set center frequency to 915 MHz

		MOVLW	 0xA7	;High Byte
		MOVWF	 CFSREGHI	
		MOVLW 	 0xD0	;Low Byte
		MOVWF	 CFSREGLO

;AFC automatic mode = Keep offset when VDI=x
;st : Strobe edge = 0
;fi : Fine mode = 1
;oe : Offset register enable = 1
;en : Calculate offset = 1
;Range limit = +3fres to -4fres
;Max. Deviation = +22.5 kHz to -30 kHz

		MOVLW 	 0xC4	;High Byte
		MOVWF	 AFCCREGHI	
		MOVLW 	 0xF7	;Low Byte
		MOVWF	 AFCCREGLO

;TX Configuration Command
;mp = 0
;Delta f (fsk) = 90 kHz
;Output power = 0 dB

		MOVLW 	 0x98	;High Byte
		MOVWF	 TXCREGHI
		MOVLW 	 0x25	;Low Byte -12.5dB TX POWER SETTING
		MOVWF	 TXCREGLO

;Receiver Control Command
;p16 : 0=INTin, 1=VDIout = 1
;VDI response time = Fast
;Receiver bandwidth = 200 kHz
;LNA gain = 0 dB
;RSSI threshold = -97 dBm

		MOVLW 	 0x94	;High Byte
		MOVWF    RXCREGHI
		MOVLW	 0x81	;Low Byte
		MOVWF	 RXCREGLO

;FIFO / Reset Mode Command
;sp : Select single Byte Sync pattern = 0
;al : Disable Sync pattern recognition = 0
;ff : FIFO fill = 1
;dr : Disable highly sensitive Reset = 1
;FIFO IT level = 8

	    MOVLW    0xCA	;High Byte
		MOVWF	 FIFORSTREGHI
		MOVLW    0x89	;Low Byte
		MOVWF	 FIFORSTREGLO

;Datarate Command
;Set datarate to 9.578544 kbps
	
		MOVLW 	 0xC6	;High Byte
		MOVWF	 DRVSREGHI
		MOVLW 	 0x23	;Low Byte
		MOVWF	 DRVSREGLO	

;Power Management Command
;er : Enable receiver chain = 0
;ebb : Enable baseband circuit = 0
;et : Enable PLL,PA, TX = 0
;es : Enable synthesizer = 0
;ex : Enable crystal oscillator = 0
;eb : Enable low battery detector = 0
;ew : Enable wake-up timer = 0
;dc : Disable clock output = 1
		
		MOVLW	 0x82	;High Byte
		MOVWF	 PMCREGHI
		MOVLW	 0x01	;Low Byte
		MOVWF	 PMCREGLO

;TRANSMITTER BYTE WRITE COMMAND

		MOVLW	0xB8   ; HIGH BYTE
		MOVWF	TXBREGHI
		MOVLW	0x00
		MOVWF	TXBREGLO

		MOVLW	0xC2
		MOVWF	BBFCREGHI
		MOVLW	0x2C
		MOVWF	BBFCREGLO
;*********************************************************
;Program starts now.
			
BEGIN	BSF		PORTA,3		;HOLD SLAVE CHIP SELECT HIGH
		CALL	MS5DLAY
		CALL	DELAYP1
		CALL	DELAYP1
		CALL	DELAYP1
INITIAL	

;MOVE FIFORSTREG INTO MRF49XA
		BCF		PORTA,3			;SLAVE SELECT
		CALL	MS5DLAY
		MOVF	FIFORSTREGHI,W
		MOVWF	SSPBUF
		CALL	RDMRFHI
		MOVF	FIFORSTREGLO,W
		MOVWF	SSPBUF	
		CALL	RDMRFLO	
		BSF		PORTA,3			;SLAVE DE-SELECTION
		CALL	MS5DLAY			

;ENABLE THE SYNCHRON LATCH
		BCF		PORTA,3			;SLAVE SELECT
		MOVF	FIFORSTREGHI,W
		MOVWF	SSPBUF
		CALL	RDMRFHI
		MOVLW	0x02
		IORWF	FIFORSTREGLO,W		;MOVE LITERAL 02h into w, and with fiforstreglo
		MOVWF	SSPBUF	
		CALL	RDMRFLO	
		BSF		PORTA,3			;SLAVE DE-SELECTION		

		CALL	MS5DLAY	

;MOVE GENCREG INTO MRF49XA
		BCF		PORTA,3			;SLAVE SELECT
		MOVF	GENCREGHI,W
		MOVWF	SSPBUF
		CALL	RDMRFHI
		MOVF	GENCREGLO,W
		MOVWF	SSPBUF	
		CALL	RDMRFLO	
		BSF		PORTA,3			;SLAVE DE-SELECTION

		CALL	MS5DLAY

;MOVE AFCCREG INTO MRF49XA
		BCF		PORTA,3			;SLAVE SELECT
		MOVF	AFCCREGHI,W
		MOVWF	SSPBUF
		CALL	RDMRFHI
		MOVF	AFCCREGLO,W
		MOVWF	SSPBUF	
		CALL	RDMRFLO	
		BSF		PORTA,3			;SLAVE DE-SELECTION

		CALL	MS5DLAY

;MOVE CFSREG INTO MRF49XA
		BCF		PORTA,3			;SLAVE SELECT
		MOVF	CFSREGHI,W
		MOVWF	SSPBUF
		CALL	RDMRFHI
		MOVF	CFSREGLO,W
		MOVWF	SSPBUF	
		CALL	RDMRFLO	
		BSF		PORTA,3			;SLAVE DE-SELECTION

		CALL	MS5DLAY

;MOVE DRVSREG INTO MRF49XA
		BCF		PORTA,3			;SLAVE SELECT
		MOVF	DRVSREGHI,W
		MOVWF	SSPBUF
		CALL	RDMRFHI
		MOVF	DRVSREGLO,W
		MOVWF	SSPBUF	
		CALL	RDMRFLO	
		BSF		PORTA,3			;SLAVE DE-SELECTION

		CALL	MS5DLAY

;MOVE PMCREG INTO MRF49XA
		BCF		PORTA,3			;SLAVE SELECT
		MOVF	PMCREGHI,W
		MOVWF	SSPBUF
		CALL	RDMRFHI
		MOVF	PMCREGLO,W
		MOVWF	SSPBUF	
		CALL	RDMRFLO	
		BSF		PORTA,3			;SLAVE DE-SELECTION

		CALL	MS5DLAY

;MOVE RXCREG INTO MRF49XA
		BCF		PORTA,3			;SLAVE SELECT
		MOVF	RXCREGHI,W
		MOVWF	SSPBUF
		CALL	RDMRFHI
		MOVF	RXCREGLO,W
		MOVWF	SSPBUF	
		CALL	RDMRFLO	
		BSF		PORTA,3			;SLAVE DE-SELECTION

		CALL	MS5DLAY

;MOVE TXCREG INTO MRF49XA
		BCF		PORTA,3			;SLAVE SELECT
		MOVF	TXCREGHI,W
		MOVWF	SSPBUF
		CALL	RDMRFHI
		MOVF	TXCREGLO,W
		MOVWF	SSPBUF	
		CALL	RDMRFLO	
		BSF		PORTA,3			;SLAVE DE-SELECTION

		CALL	MS5DLAY
		
;TURN ON TRASMITTER TO TUNE IN ANTENNA
;MOVE PMCREG INTO MRF49XA, TURN ON TRANSMITTER
		BCF		PORTA,3			;SLAVE SELECT
		MOVF	PMCREGHI,W
		MOVWF	SSPBUF
		CALL	RDMRFHI
		MOVLW	0x20
		IORWF	PMCREGLO,W      ;AND W WITH 20h, RESULT IN W
		MOVWF	SSPBUF	
		CALL	RDMRFLO
		BSF		PORTA,3			;SLAVE DE-SELECTION

		CALL	MS5DLAY			;CALL 5 MILLISECOND DELAY FOR ANTEANNA TUNING

;TURN ON RECEIVER CHAIN, TRANSMITTER OFF
		BCF		PORTA,3			;SLAVE SELECT
		MOVF	PMCREGHI,W
		MOVWF	SSPBUF
		CALL	RDMRFHI
		MOVLW	0x80
		IORWF	PMCREGLO,W      ;AND W WITH 20h, RESULT IN W
		MOVWF	SSPBUF	
		CALL	RDMRFLO
		BSF		PORTA,3			;SLAVE DE-SELECTION

		CALL	MS5DLAY

;ENABLE THE FIFO
		BCF		PORTA,3			;SLAVE SELECT
		MOVF	GENCREGHI,W
		MOVWF	SSPBUF
		CALL	RDMRFHI
		MOVLW	0x40
		IORWF	GENCREGLO,W
		MOVWF	SSPBUF
		CALL	RDMRFLO
		BSF		PORTA,3			;SLAVE DE-SELECTION

		CALL	MS5DLAY

;MOVE FIFORSTREG INTO MRF49XA		
		BCF		PORTA,3			;SLAVE SELECT
		MOVF	FIFORSTREGHI,W
		MOVWF	SSPBUF
		CALL	RDMRFHI
		MOVF	FIFORSTREGLO,W
		MOVWF	SSPBUF	
		CALL	RDMRFLO		
		BSF		PORTA,3			;SLAVE DE-SELECTION

		CALL	MS5DLAY
		
;ENABLE THE SYNCHRON LATCH
		BCF		PORTA,3			;SLAVE SELECT
		MOVF	FIFORSTREGHI,W
		MOVWF	SSPBUF
		CALL	RDMRFHI
		MOVLW	0x02
		IORWF	FIFORSTREGLO,W	 	;MOVE LITERAL 02h into w, OR with fiforstreglo
		MOVWF	SSPBUF	
		CALL	RDMRFLO
		BSF		PORTA,3			;SLAVE DE-SELECTION		

		CALL	MS5DLAY			;DELAY FOR THE HELL OF IT
		CALL	MS5DLAY			;DELAY FOR THE HELL OF IT
		
		CALL	CLRDISP
		CALL	SECDLAY
		CALL	I
		CALL	N
		CALL	I
		CALL	T
	
		CALL	SECDLAY
		CALL	SECDLAY

		BSF		PORTA,2

		CALL	CLRDISP

;READ STATUS BYTES AND CHECK FOR INTERUPTS
		BCF		PORTA,3			;SLAVE SELECT
		CALL	MS5DLAY			;DELAY FOR THE HELL OF IT
		CALL	MRFSTATRD		;THIS WILL READ MRFSTATUS REG AND DISP ON LCD
		CALL	MS5DLAY
		BSF		PORTA,3			;SLAVE DE-SELECTION

	

;;;THIS CODE WILL HOLD HERE WAITING FOR BUTTON TO BE PRESSED TO TRANSMIT
TXBUT	BTFSC	PORTA,7
		GOTO	TXBUT
		CALL	DELAYP1
TXBUT2	BTFSS	PORTA,7
		GOTO	TXBUT2
		CALL	DELAYP1

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;THIS CODE WILL TRANSMIT A BYTE
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;TRANSMIT A BYTE;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

TRNSMT	BCF		PORTA,3			;SLAVE SELECT
		CALL	MS5DLAY
		MOVF	PMCREGHI,W
		MOVWF	SSPBUF
		CALL	RDMRFHI
		MOVF	PMCREGLO,W
		MOVWF	SSPBUF	
		CALL	RDMRFLO	
		BSF		PORTA,3			 ;SLAVE DE-SELECTION

;;;;ENABLE THE TX REGISTER

		BCF		PORTA,3			;SLAVE SELECT
		CALL	MS5DLAY
		MOVF	GENCREGHI,W
		MOVWF	SSPBUF
		CALL	RDMRFHI
		MOVLW	0x80
		IORWF	GENCREGLO,W      ;OR W WITH 80h, RESULT IN W
		MOVWF	SSPBUF	
		CALL	RDMRFLO
		BSF		PORTA,3			;SLAVE DE-SELECTION

;;;;;;ENABLE TRANSMITTER
		BCF		PORTA,3			;SLAVE SELECT
		CALL	MS5DLAY
		MOVF	PMCREGHI,W
		MOVWF	SSPBUF
		CALL	RDMRFHI
		MOVLW	0x20
		IORWF	PMCREGLO,W      ;AND W WITH 20h, RESULT IN W
		MOVWF	SSPBUF	
		CALL	RDMRFLO			

					
;WRITE TO FILE
		CALL	MS5DLAY			;ALLOW PREAMBLE TO BE FULLY SENT
								;SLAVE NOT DESELECTED
		
		BTFSS	PORTB,1			;TEST MISO LINE FOR "RDY FOR NEXT BYTE" SIGNAL
		GOTO	$ - 1

		MOVF	TXBREGHI,W		;ADDRESS TXBREG
		MOVWF	SSPBUF
		CALL	RDMRFHI
		MOVLW	B'00101101'		;WRITE THE FIRST SYNCRONOUS BYTE -- HEX 2D (MRF49XA SCL1)  --REQUIRED WITH THIS CONFIG
		MOVWF	SSPBUF
		CALL	RDMRFLO

		BTFSS	PORTB,1			;TEST MISO LINE FOR "RDY FOR NEXT BYTE" SIGNAL
		GOTO	$ - 1
		
		MOVLW	B'11010100'      ;WRITE THE SECOND BYTE -- HEX D4 (MRF49XA DEFAULT SCL0) -- REQUIRED WITH THIS CONFIG
		MOVWF	SSPBUF
		CALL	RDMRFLO

		BTFSS	PORTB,1			;TEST MISO LINE FOR "RDY FOR NEXT BYTE" SIGNAL
		GOTO	$ - 1
		
		MOVLW	B'10101010'		;TRANSMIT THE FIRST DATA BYTE
		MOVWF	SSPBUF
		CALL	RDMRFLO

		BTFSS	PORTB,1
		GOTO	$ - 1
		
		MOVLW	B'10011001'
		MOVWF	SSPBUF
		CALL	RDMRFLO

		BTFSS	PORTB,1
		GOTO	$ - 1

		MOVLW	B'10011001'
		MOVWF	SSPBUF
		CALL	RDMRFLO

		BTFSS	PORTB,1
		GOTO	$ - 1

		MOVLW	B'10011001'
		MOVWF	SSPBUF
		CALL	RDMRFLO

		BTFSS	PORTB,1
		GOTO	$ - 1

		MOVLW	B'10011001'
		MOVWF	SSPBUF
		CALL	RDMRFLO

		BTFSS	PORTB,1
		GOTO	$ - 1

		BSF		PORTA,3			;DESELECT THE SLAVE

;;;;;TURN OFF TRANSMITTER, DISABLE THE TX REGISTER
	
		;TURN ON RECEIVER CHAIN, TRANSMITTER OFF
		BCF		PORTA,3			;SLAVE SELECT
		MOVF	PMCREGHI,W
		MOVWF	SSPBUF
		CALL	RDMRFHI
		MOVLW	0x80
		IORWF	PMCREGLO,W      ;AND W WITH 20h, RESULT IN W
		MOVWF	SSPBUF	
		CALL	RDMRFLO
		BSF		PORTA,3			;SLAVE DE-SELECTION

;ENABLE THE FIFO
		BCF		PORTA,3			;SLAVE SELECT
		MOVF	GENCREGHI,W
		MOVWF	SSPBUF
		CALL	RDMRFHI
		MOVLW	0x40
		IORWF	GENCREGLO,W
		MOVWF	SSPBUF
		CALL	RDMRFLO
		BSF		PORTA,3			;SLAVE DE-SELECTION

;ENABLE THE SYNCHRON LATCH
		BCF		PORTA,3			;SLAVE SELECT
		MOVF	FIFORSTREGHI,W
		MOVWF	SSPBUF
		CALL	RDMRFHI
		MOVLW	0x02
		IORWF	FIFORSTREGLO,W		;MOVE LITERAL 02h into w, and with fiforstreglo
		MOVWF	SSPBUF	
		CALL	RDMRFLO
		BSF		PORTA,3			;SLAVE DE-SELECTION		

	
;DISPLAY TO THE LCD
		CALL	CLRDISP
		BCF		PORTA,1
		BCF		PORTA,4

		MOVLW	80H					;THIS CODE BLOCK MOVES THE CURSOR TO
		MOVWF   PORTB				;THE 2ND SPACE ON THE TOP LEFT OF THE DISPLAY
		CALL	CLOCK
		MOVLW	0H
		MOVWF	PORTB
		CALL	CLOCK				;CURSOR SHOULD BE AT TOP, 2ND SPOT NOW
		
		CALL	T
		CALL	X
		CALL	GAP
		CALL	D
		CALL	O
		CALL	N
		CALL	E

		CALL	SECDLAY
		CALL	MRFSTATRD

;BUTTON TO SEE IF A RETRANSMIT SHOULD OCCUR
RETX	BTFSC	PORTA,0
		GOTO	RETX
		CALL	DELAYP1
RETX2	BTFSS	PORTA,0
		GOTO	RETX2
		CALL	DELAYP1
		GOTO	TXBUT
		

END
 
Ok, so I am working on setting up the RFM02 Transmitter.

Working my way through this document, adjusting all registers which will then be clocked into the TX to set it up.
**broken link removed**

First Question about Config 1
Band Select will be 433? (01)

Regarding d2,d1&d0;CLK frequency, do I need to worry about this if my PIC has its own clock/crystal/intosc?
(But if it were used the cystal load capacitor setting (x3-x0) would be set to suit the clock frequency of the PIC????)

But what is the 4th setting? m2-m0;frequency deviation?
Do I need to worry about this if I am not using the CLK out feature?

**broken link removed**
 
First Question about Config 1
Band Select will be 433? (01)
If 433/434Mhz is allowed for low power licence-free RF devices in Australia then that will be fine.

You will also need to set the frequency using the f0:f11 bits in the Frequency Setting Command register.

Regarding d2,d1&d0;CLK frequency, do I need to worry about this if my PIC has its own clock/crystal/intosc?
No you dont need to set those, just disable the CLK out by setting the "dc" bit in the Power Management Command register.

(But if it were used the cystal load capacitor setting (x3-x0) would be set to suit the clock frequency of the PIC????)
No, the X0:X3 bits are a means of fine tuning the internal oscillator in the RF02

But what is the 4th setting? m2-m0;frequency deviation?
Do I need to worry about this if I am not using the CLK out feature?
Nothing to do with the CLK out feature, but you do need to worry about it.
The setting will depend on the receiver you are using and what the radio regulations allow for low power licence-free RF devices in Australia.
I will see if I can find the receiver data sheet and see what that says.

JimB
 
Last edited:
Thanks JimB

I've made a little progress today..

Here is the receiver chip i am using RF01
**broken link removed**
It is built into this module i have from hope RFM01

I will go through and try and put together all the configuration settings and post them here for checking/discussion.

Another thing, is it worth using a PIC with a SPI (SSP - Synchronous Serial Port), or just doing all the communication maually with code. Think they call it bit banging?
 
I've used the rfm 01 / 02 Chips for our telemetry system.
Look at **broken link removed**
Sorry it's in german. The Source Code is in "C" an documenteted.

The Range is about 300m Outside
 
Here is the receiver chip i am using RF01
**broken link removed**
It is built into this module i have from hope RFM01
Yes I found the data on the HOPE website.


I will go through and try and put together all the configuration settings and post them here for checking/discussion.
A good idea.
I did a bit of searching and found that 433.05 to 434.79Mhz is allowed for this type of transmission in Australia.
If I understand the RF02 programming guide correctly it defaults to 435Mhz on power on reset (POR), which is a bit outside the allocation!
My suggestion would be to set the frequency to 434Mhz +/- and make the deviation 60khz.

Another thing, is it worth using a PIC with a SPI (SSP - Synchronous Serial Port), or just doing all the communication maually with code. Think they call it bit banging?
I dont know, I have never done either of them!

JimB
 
Frequency deviation is the amount by which the frequency deviates left or right to symbolize a digital 0 or a 1. The center frequency is 434Mhz for instance, and if m2 ....m0 is b'110 then it will transmit a 434.21 Mhz signal for a 0 (I think that's right) and a 433.79 Mhz signal for a 1.

Just use a PIC with a hardware SPI. It is much easier.
 
Last edited:
Thanks for the info guys...
Ill have a go.

and wkrug, that looks like valuable info but i cant read german lol. thanks anyway. If I have some specific questions its good to know someone who has used these things before.

Ill keep you posted.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top