Hi, der Krampf geht weiter. ich habe mal versucht die Software in Bascom für ein Rfm01 und Rfm02 mit Mega8 zu schreiben. Funktioniert aber leider nicht. Momentan teste ich den Rfm02 (Sender). Mit meiner selbstgeschriebenen Routine kann ich über SPI z.B. die Frequenz am Clk in verschiedene Werte ändern. Aber das Senden will nicht. Hier mein Code: vorallem die Bascom-Experten können mir vielleicht Tipps geben. $regfile = "m8def.dat" $crystal = 8000000 $baud = 9600 Declare Sub My_trans2(byval Mylowbyte2 As Word) Declare Sub Rf02_shiftout(byval Senddata As Byte) Declare Sub My_spi(byval Mylowbyte As Byte) Ddrc = &B11111000 Ddrd = &B00101111 Ddrb = &B11111110 Spi_cs Alias Portb.2 ' SS-Pin Spi_sdi Alias Portb.3 Spi_sdo Alias Pinb.4 Dim Temp As Word Dim Temp_byte As Byte Dim A(8) As Byte Dim L As Byte Dim Test As Byte Dim Lauf As Byte Set Spi_cs Waitms 150 Call My_trans2(&Hc0e0) Call My_trans2(&H8f80) Call My_trans2(&Hc2a0) Call My_trans2(&Ha620) '433,92 MHz Freq Setting Call My_trans2(&Hb400) ' &Hb420 Call My_trans2(&H8f80) ' 10 Mhz Call My_trans2(&Hd2c0) Call My_trans2(&Hc823) 'c823 =9600 c811 =19200 Call My_trans2(&Hc038) 'Call My_trans2(&H8a80) ' 1,8A80 6666 Mhz Call My_trans2(&H8f80) Portc.3 = 0 Test = &HCC Portb.3 = 0 Do Call My_spi(&Hc6) 'Call My_trans2(&H8a80) Loop End Sub My_trans2(byval Mylowbyte2 As Word) Local I As Byte 'Local Mylowbyte2 As Word Reset Spi_cs ' While Pinb.0 = 0 For I = 15 To 0 Step -1 If Mylowbyte2.i = 1 Then Portb.3 = 1 Else Portb.3 = 0 End If Portb.5 = 1 'SCK Waitus 1 Portb.5 = 0 Next I Waitus 40 Set Spi_cs End Sub Sub My_spi(byval Mylowbyte As Byte) Local I As Byte Reset Spi_cs For I = 7 To 0 Step -1 If Mylowbyte.i = 1 Then Portb.3 = 1 'sdi High Else Portb.3 = 0 'sdi low End If Portb.5 = 1 'SCK nächsten Takt erzeugen Waitus 1 ' $asm ' nop ' nop ' nop ' $end Asm Portb.5 = 0 Next I 'sck low 'Portb.5 = 0 Waitus 40 Call Rf02_shiftout(&Haa) Call Rf02_shiftout(&Haa) Call Rf02_shiftout(&Haa) Call Rf02_shiftout(&H2d) Call Rf02_shiftout(&Hd4) Call Rf02_shiftout(&H41) 'paar daten Call Rf02_shiftout(&H42) Call Rf02_shiftout(&H43) Call Rf02_shiftout(&H44) Call Rf02_shiftout(&H45) Call Rf02_shiftout(&H46) Call Rf02_shiftout(&H41) 'paar daten Set Spi_cs While Pinb.0 = 1 Wend Call My_trans2(&Hc464) End Sub Sub Rf02_shiftout(byval Senddata As Byte) Local J As Byte Portc.3 = 1 For J = 7 To 0 Step -1 While Pinb.0 = 1 Wend While Pinb.0 = 0 Wend If Senddata.j = 1 Then Portb.3 = 1 ' Else Portb.3 = 0 ' End If Next J End Sub
Pollin Funkmodule Bascom - Code soll funktionieren !! da sollteste fündig werden. da gibts 3 versionen . http://bascom-forum.de/index.php/topic,25.msg45.html#msg45
@huhu (nixda) kann dir nicht geholfen haben, weil Rfm12 und Rfm01/Rfm02 nicht das gleiche ist und der RFM02 anders zu händeln ist
Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.