View previous topic :: View next topic |
Author |
Message |
bzijlstra
Joined: 30 Dec 2004 Posts: 1179 Location: Tilburg - Netherlands
|
Posted: Thu Feb 18, 2010 2:23 pm Post subject: RFM12BP |
|
|
Begin 2009 Burkhard Kainka published a article about the AVR's and RFM12. Have adapted his code a bit so it would work on a 8051. There are some minor changes to his code. (waitus and sub instead of a function)
The code is a test-transmitter, but if you change the remarks you will have a testreceiver.
I wonder if somebody did some work on the RFM12BP and could tell me the hardware for the antenna when using the full blown 500 mW of this device.
Code: | 'RFM12bp - testtransmitter
'Adapted from the code of Burkhard Kainka for AVR's
'SDI P3.4
'SDO P3.7
'SCK P3.5
'/SEL P3.6
'/RES P3.3
$regfile = "reg51.dat"
$crystal = 11059200
$baud = 9600
Nsel Alias P3.6
Sdi Alias P3.4
Sdo Alias P3.7
Sck Alias P3.5
Nres Alias P3.3
Declare Sub Spi16(dout As Word)
Declare Sub Freq_rfm12
Declare Sub Init_rfm12bp
Declare Sub Wait_rfm12
'rfm12pb
Dim Dout As Word
Dim Nspi As Integer
Dim Dspi As Integer
Dim Dsdo As Integer
Dim Freq As Single
Dim D As Word
Print "RFM12BP - testtranceiver"
Nres = 1 'reset RFM12BP
Call Init_rfm12bp
'(
'Activate this if you want to use the testreceiver
Do
Call Init_rfm12bp
'Sub Ontvang
'start receiver, matched data
Test5:
Call Spi16(&H82c8)
Call Spi16(&Hca83)
For N = 1 To 10
Wait_rfm12
Call Spi16(&Hb000)
Data_in(n) = Dsdo
Print Chr(data_in(n));
Next N
Print
Loop
End
')
Do
Wait 1
Call Spi16(&H8238)
Call Wait_rfm12
Call Spi16(&Hb8aa)
Call Wait_rfm12
Call Spi16(&Hb8aa)
Call Wait_rfm12
Call Spi16(&Hb8aa)
Call Wait_rfm12
Call Spi16(&Hb82d)
Call Wait_rfm12
Call Spi16(&Hb8d4)
Call Wait_rfm12
Call Spi16(&Hb841)
Call Wait_rfm12
Call Spi16(&Hb842)
Call Wait_rfm12
Call Spi16(&Hb843)
Call Wait_rfm12
Call Spi16(&Hb844)
Call Wait_rfm12
Call Spi16(&Hb845)
Call Wait_rfm12
Call Spi16(&Hb846)
Call Wait_rfm12
Call Spi16(&Hb847)
Call Wait_rfm12
Call Spi16(&Hb848)
Call Wait_rfm12
Call Spi16(&Hb849)
Call Wait_rfm12
Call Spi16(&Hb84a)
Call Wait_rfm12
Call Spi16(&Hb8aa)
Call Wait_rfm12
Call Spi16(&Hb8aa)
Call Wait_rfm12
Call Spi16(&H8208)
Loop
End
Sub Spi16(dout As Word)
Nsel = 0
Dsdo = 0
For Nspi = 1 To 16
Dspi = Dout And &H8000
If Dspi = 0 Then
Sdi = 0
Else
Sdi = 1
End If
Dout = Dout * 2
Dsdo = Dsdo * 2
If Sdo = 1 Then
Dsdo = Dsdo + 1
End If
Sck = 1
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
Sck = 0
Next Nspi
Nsel = 1
End Sub
Sub Freq_rfm12
If Freq < 800 Then Freq = Freq * 2
Freq = Freq - 860
D = Freq / 0.0050
If D < 96 Then D = 96
If D > 3903 Then D = 3903
D = D + &HA000
Call Spi16(d)
End Sub
Sub Init_rfm12bp
'Init RFM12PB
Nsel = 1
Sck = 0
Call Spi16(&H80d7)
Call Spi16(&H82d9)
Call Spi16(&Ha67c)
Call Spi16(&Hc647)
Call Spi16(&H94a4)
Call Spi16(&Hc2ac)
Call Spi16(&Hca81)
Call Spi16(&Hc483)
Call Spi16(&H9850)
Call Spi16(&He000)
Call Spi16(&Hc800)
Call Spi16(&Hc000)
Freq = 434.300
Call Freq_rfm12
End Sub
Sub Wait_rfm12
Nsel = 0
Do
Loop Until Sdo = 1
End Sub
|
BTW: a real nice RFM12-calculator can be found at www.technofun.org
Have fun
Ben Zijlstra |
|
Back to top |
|
|
harrydejonge
Joined: 06 Jan 2006 Posts: 19
|
Posted: Fri Jul 16, 2010 9:09 pm Post subject: |
|
|
Hi ben,
Just received the 433 and the 868 Mhz modules.
I will test them next week. (busy weekend).
But if you have problems, i think i will first test my soft-hardware with the rfm12.
What kind of arial you using?
Just a wire or a tuned antenna. ?
Keep you informed of my progress. |
|
Back to top |
|
|
bzijlstra
Joined: 30 Dec 2004 Posts: 1179 Location: Tilburg - Netherlands
|
Posted: Sat Jul 17, 2010 6:15 am Post subject: RFM12BP |
|
|
Here a picture. It is working fine. Two W7100-evaluation boards, one as receiver and one as transmitter. It is a tracking system. The receiver puts the coordinates on the Internet (KML) and can be tracked in Google Earth (later more...).
It is in the 433 Mhz band. If transmitter and receiver can 'see' each other there is no problem, if there are buildings between them then it gets a bit difficult.
Have fun
Ben Zijlstra |
|
Back to top |
|
|
Dave
Joined: 05 Feb 2005 Posts: 314 Location: OR
|
Posted: Wed Jul 21, 2010 4:57 pm Post subject: |
|
|
Ben - Nice looking project. Glad you like my rfm12 calculator. Attached is good info about antenna design from hoperf web site. - Dave |
|
Back to top |
|
|
bzijlstra
Joined: 30 Dec 2004 Posts: 1179 Location: Tilburg - Netherlands
|
Posted: Wed Jul 21, 2010 6:51 pm Post subject: Very usefull information... |
|
|
Dave thanks!!
That is very usefull information.
Have fun
Ben Zijlstra |
|
Back to top |
|
|
|