Programming RFM radio modules in Basic


Closed Thread
Results 1 to 40 of 45

Hybrid View

  1. #1
    Join Date
    Jan 2013
    Posts
    64

    Default Programming RFM radio modules in Basic

    Hi,
    I would like to program RFM69W radio modules in BASIC and hope for some help please.
    Eventually the modules will be programmed using a PIC, but to start with I would like to 'talk' to them via FTDI serial to USB adaptors, just to see some results.
    Can anyone help please?
    Cheers, Camerart.

  2. #2
    Join Date
    May 2013
    Location
    australia
    Posts
    2,386


    Did you find this post helpful? Yes | No

    Default Re: Programming RFM radio modules in Basic

    rfm69 and rfm12 modules don't work that way , they retain no settings when powered off so they to be fully configured every power up .
    they communicate via spi bus to the host and are most suited to packet transmissions . they can do ook but why would you
    I use rfm12 and 69's a lot they are very reliable fast and have a good range ,but they are not for the faint hearted
    Warning I'm not a teacher

  3. #3
    Join Date
    Jan 2013
    Posts
    64


    Did you find this post helpful? Yes | No

    Default Re: Programming RFM radio modules in Basic

    Quote Originally Posted by richard View Post
    rfm69 and rfm12 modules don't work that way , they retain no settings when powered off so they to be fully configured every power up .
    they communicate via spi bus to the host and are most suited to packet transmissions . they can do ook but why would you
    I use rfm12 and 69's a lot they are very reliable fast and have a good range ,but they are not for the faint hearted
    Hi Richard,
    I'm picking my way through the clues! And there don't seem many clues

    OK, so I need a circuit with the module plus a PIC for configuring them.

    It's something I want to do so I'll have to find out how faint hearted I am.

    I would appreciate any circuits or minimal programs please. As for programs, I only speak in BASIC, so I bet I also have to translate any

    Cheers, Camerart.
    Last edited by camerart; - 7th October 2016 at 10:07.

  4. #4
    Join Date
    May 2013
    Location
    australia
    Posts
    2,386


    Did you find this post helpful? Yes | No

    Default Re: Programming RFM radio modules in Basic

    here's a pgm I did some years back to let my pic projects talk to the Arduino things its based on and compatible with the Arduino

    rfm12b lowpowerlab library. I would not develop anything new with rfm12b's , rfm69's are much better once you get the knack of it

    I have developed libraries for pic, Arduino and raspberry_pi's [python2.7] to all yak to each other with rfm69 modules [rfm12b also] but
    they are complex ,undocumented and beyond my resources to support for novices








    Code:
    '****************************************************************
    '*  Name    : rfm12b.BAS                                        *
    '*  Author  : richard                                  *
    '*  Notice  : Copyright (c) 2013                                *
    '*          : All Rights Reserved                               *
    '*  Date    : 9/4/2013                                          *
    '*  Version : 1.0    16f1825     @3.3 volts                               *
    '*  Notes   : talk to arduino rfm12b lib with encrypt=null      *
    '*          :  pkt size up to maxl , will  ack also             *
    '****************************************************************
      
    #CONFIG
                 __config        _CONFIG1,    _FOSC_INTOSC & _CP_OFF & _WDTE_ON  &  _PWRTE_ON  &  _MCLRE_ON  & _CLKOUTEN_OFF
                  __config      _CONFIG2, _PLLEN_ON & _LVP_OFF
    #ENDCONFIG
     
     
      include "dt_ints-14.bas"
      Include "REENTERPBP.bas"
    asm
    INT_LIST macro
          
         
         
          INT_HANDLER INT_INT, _RX, PBP ,NO
          endm
           INT_CREATE
           
          
           
    ENDASM   
     
    DEFINE OSC 32
     SSPIF VAR PIR1.3     ' SPI interrupt flag
     ssc var  PORTC.3    ;..... rf12b ss
     RNINT VAR PORTA.2    ;.... rf12b irqn // int int
     ;SDI=  PORTC.1  .... rf12b sdo
     ;SDO PORTC.2    .... rf12b sd1
    ;SCK  PORTC.3    .... rf12b ssk
     net con 99
     node con 2
     MAXL CON 34   ;buffer size    ie 0 to 34
      
      
     RXBUFF VAR BYTE[maxl+1]
     BCNT VAR BYTE
     GRP VAR RXBUFF[0]   ;net sync 
     DEST  VAR RXBUFF[1]
     SOURCE  VAR RXBUFF[2]
     LEN     VAR RXBUFF[3]
     ;data  rxbuff[4] to   rxbuff[maxl-2] 
     FLG VAR BYTE
     RXDONE VAR FLG.7
     CMD VAR WORD
     crc var word
     CRC_IN   var byte
     i VAR BYTE           ' loop counter
     j var byte
     
     
     
       OSCCON=$70
       ANSELA=0
       ANSELC=0
       OPTION_REG.6=0
       
       
       TRISA = %001110
       TRISC = %00000010        ' set PORTC I/O
       SSP1CON1=$21  ;$22 works too
       SSP1CON2=0
       SSP1CON3=0
       SSP1STAT=$40
        
       high ssc      '
       serout2 PORTA.0,84,[ "RFM12",13,10]
       SSPIF = 0
       GOSUB RM12INIT
       BCNT=1
       INTCON=$90
       FLG=0
       grp=net  
              
    mainloop:
    IF   RXDONE  THEN
    CMD=$820D  ;receive    $820D IDLE
     GOSUB SNDCMD 
      INTCON=0
       crc=-1
        
        FOR I= 0 TO LEN+3
        
         CRC_IN = RXBUFF[i]
        gosub crc16
        next
    if  rxbuff[len+4]=crc.lowbyte then   ;only matching the crc lowbyte seems ok
        
         I=RXBUFF[2]
       if    ( i.7 )   then gosub ack     ; acknowlege reception if   asked
        
       ;  should check   here for  node id match
        
        
      serout2 PORTA.0,84, [ HEX2 RXBUFF[1] ,",", HEX2 RXBUFF[2] ,",",HEX2 RXBUFF[3] ,"," ]
     FOR I= 4 TO LEN+2
      serout2 PORTA.0,84, [ RXBUFF[I] ,"," ]
     
      NEXT
     ; serout2 PORTA.0,84, ["XXX", RXBUFF[len+3],"  ", HEX2 RXBUFF[len+5],  HEX2 RXBUFF[len+4],"  ",hex4 crc, 13,10]   ;len+4=lowbyte
      serout2 PORTA.0,84, [RXBUFF[len+3], 13,10] 
     endif
     
      FOR I= 1 TO MAXL
       RXBUFF[I]=0      ;clear buffer
      NEXT
      
     
        CMD=0           ;reset fifo  sequence
        GOSUB SNDCMD   ;  
        CMD=$CA80 
        GOSUB SNDCMD   ;  
        CMD=$CA83           ;reset fifo 
        GOSUB SNDCMD
      FLG=0
      BCNT=1
      
      INTCON=$90 ; enable rx int 
      CMD=$82DD  ;receive on   
      GOSUB SNDCMD 
     ENDIF
     I=0 ; something in main loop for the wdt
           
    GoTo mainloop     ' do it forever
     
       End
       
       
    SNDCMD:     ;word size send  ,note rfm12b dose not drop irq when ready for cmd
      LOW SSC
         SSPIF = 0
       SSPBUF = CMD.HIGHBYTE  
          WHILE   SSPIF =0 ' wait for SPI interupt flag
     WEND  ' wait for send
        SSPIF = 0
       SSPBUF = CMD.LOWBYTE
          WHILE   SSPIF =0 ' wait for SPI interupt flag
     WEND  ' wait for send
       
       
        HIGH SSC
        Return
        
        
     RM12INIT:            ;leaves radio in rxmode
     CMD=0
     GOSUB SNDCMD   
    CMD=$8205   ;SLEEP
     GOSUB SNDCMD   
    PAUSE 1
     CMD=$80D7
     GOSUB SNDCMD   
    CMD=$A640
     GOSUB SNDCMD 
      CMD=$C608
     GOSUB SNDCMD   
    CMD=$94A2
     GOSUB SNDCMD 
     CMD=$C2AC
     GOSUB SNDCMD   
    CMD=$CA83
     GOSUB SNDCMD 
      CMD=$CE63
     GOSUB SNDCMD   
    CMD=$C483
     GOSUB SNDCMD 
     CMD=$9850
     GOSUB SNDCMD   
    CMD=$CC77
     GOSUB SNDCMD 
      CMD=$E000     
     GOSUB SNDCMD   
    CMD=$C800
     GOSUB SNDCMD 
     CMD=$C043
     GOSUB SNDCMD  
     PAUSE 1
     CMD=$82DD  ;receive $82dd '  XMIT $823D 
     GOSUB SNDCMD      
      RETURN  
      
      
     RX:  
       LOW SSC 
      SSPIF = 0  
       SSPBUF = $B0     ' 
     WHILE   SSPIF=0  ' wait for SPI interupt flag
     WEND
       SSPIF = 0   
         SSPBUF = 0      ' write to SSPBUF 
        WHILE   SSPIF =0 ' wait for SPI interupt flag
     WEND  
      RXBUFF[BCNT] = SSPBUF   ' store received character in array
      BCNT=BCNT+1
     
      IF (BCNT > MAXL) OR (BCNT > (LEN+5) )THEN   RXDONE=1  
          HIGH SSC
          INTCON=$90
    @ INT_RETURN  
      
      
       
     
     crc16:
      
      CRC = CRC ^  CRC_IN 
          for j=0to 7
       if crc.0 then
       crc= ((crc>>1) ^$a001 )   ; 
        
      else
        crc= crc>>1
       endif
       next
       return
       
       
    xmit:     ;tx a byte
    WHILE   RNINT =1  ' wait for irq interupt flag  from rfm12b
     WEND
     cmd =cmd |$b800
      GOSUB SNDCMD 
     return 
       
    
     ack:          ;leaves radio idle
     CMD=$823d    ;tx on
     GOSUB SNDCMD 
     pause 3
     crc=-1
      CMD=$aa      ;preamble
     GOSUB xmit  
     CMD=$aa        ;preamble
     GOSUB SNDCMD 
     CMD=$aa      ;preamble
     GOSUB  xmit 
     
       
    CMD=$2d       ;sync 
     GOSUB  xmit 
      CMD=net         ;network 
     CRC_IN=cmd 
     gosub crc16
     GOSUB  xmit 
    CMD=node       ;node id
    cmd.7=1
     CRC_IN=cmd 
     gosub crc16
      GOSUB  xmit 
    CMD=rxbuff[1]    ;ack from 
     CRC_IN=cmd 
     gosub crc16 
     GOSUB  xmit   
    CMD=00           ;nill length
     CRC_IN=cmd 
     gosub crc16
     GOSUB  xmit  
     CMD=crc.lowbyte
       GOSUB  xmit 
      CMD=crc.highbyte
       GOSUB  xmit 
       CMD=$aa          ;postamble
     GOSUB  xmit   
     CMD=$aa            ;postamble
     GOSUB  xmit 
     pause 4
        CMD=$820d
     GOSUB SNDCMD 
     
     
      return  
      
      
     sndbuff:    ;leaves radio idle and rx int off  , to use   load  dest ,data   and   len , len is the data payload size and call this sub
     INTCON=0   ; watch this
      grp=net
      source=node 
     CMD=$823d    ;tx on
     GOSUB SNDCMD 
     pause 3
     crc=-1
      CMD=$aa      ;preamble
     GOSUB xmit  
     CMD=$aa        ;preamble
     GOSUB SNDCMD 
     CMD=$aa      ;preamble
     GOSUB  xmit 
     
       
    CMD=$2d       ;sync 
     GOSUB  xmit 
             
     
    for i=0 to  len + 3
     CMD= rxbuff[i]
     CRC_IN=cmd 
     gosub crc16
     GOSUB  xmit
      next
     
       CMD=crc.lowbyte
       GOSUB  xmit 
      CMD=crc.highbyte
       GOSUB  xmit 
       CMD=$aa          ;postamble
     GOSUB  xmit   
     CMD=$aa            ;postamble
     GOSUB  xmit 
     pause 4
        CMD=$820d
     GOSUB SNDCMD 
     return
    Warning I'm not a teacher

  5. #5
    Join Date
    Jan 2013
    Posts
    64


    Did you find this post helpful? Yes | No

    Default Re: Programming RFM radio modules in Basic

    Hi Richard,
    Next I've got to squeeze your code into my Oshonsoft simulator, should be fun
    I have to choose a future proof PIC. Apart from having an spi bus, are there any other considerations to note? e,g, speed, memory etc.
    I already have modules with RFN22 on them, but I have some RFM69 and some RFM96 on order.
    Thanks very much, C.
    EDIT Hi again. I notice "Copyright (c) 2013 All Rights Reserved Can I have permission to post it on an Oshonsoft assistance forum, please?
    Last edited by camerart; - 7th October 2016 at 16:39.

  6. #6
    Join Date
    May 2013
    Location
    australia
    Posts
    2,386


    Did you find this post helpful? Yes | No

    Default Re: Programming RFM radio modules in Basic

    EDIT Hi again. I notice "Copyright (c) 2013 All Rights Reserved Can I have permission to post it on an Oshonsoft assistance forum, please?
    No problem , but I don't particularly want to support it [ there is a slight bug in the reset fifo sequence too ,should be $ca81 from memory I think]
    you realise of course that rfm69's are quite a different animal
    Warning I'm not a teacher

  7. #7
    Join Date
    Jan 2013
    Posts
    64


    Did you find this post helpful? Yes | No

    Default Re: Programming RFM radio modules in Basic

    Quote Originally Posted by richard View Post
    rfm69 and rfm12 modules don't work that way , they retain no settings when powered off so they to be fully configured every power up .
    Hi R,
    I've now got a circuit, with in circuit programming, and have changed frequency using SPI

    I'm using RFM69 boards with 18F2431 PICs and was told they have SX1276 chips on them, by the supplier.

    You say that they need ALL of the registers loading at power on. Could you clarify please, why does it state default values in the data sheet, or can the SX1276 retain the default settings?

    C.
    Last edited by camerart; - 17th November 2016 at 12:15.

  8. #8
    Join Date
    May 2013
    Location
    australia
    Posts
    2,386


    Did you find this post helpful? Yes | No

    Default Re: Programming RFM radio modules in Basic

    You say that they need ALL of the registers loading at power on. Could you clarify please, why does it state default values in the data sheet, or can the SX1276 retain the default settings?
    exactly , all registers return to their default por values when the chip is reset , the chip has no non volatile registers.
    every register that you assign a non por value to needs that value reloaded at every reset, in my case that's nearly all of them
    Warning I'm not a teacher

  9. #9
    Join Date
    Jan 2013
    Posts
    64


    Did you find this post helpful? Yes | No

    Default Re: Programming RFM radio modules in Basic

    Quote Originally Posted by richard View Post
    exactly , all registers return to their default por values when the chip is reset , the chip has no non volatile registers.
    every register that you assign a non por value to needs that value reloaded at every reset, in my case that's nearly all of them
    Hi R,
    That will save me some time at least initially. As mentioned before I am starting with OOK. You dd ask me why I would, but I'm trying OOK first then FSK, then LoRa, as I gain experience.

    As I can accept most of the default registers, all I need to do is load the ones that are different.

    So far I can see the radio transmitting, but there is no modulation yet, so just a stream, with no breaks.

    C.

  10. #10
    Join Date
    May 2013
    Posts
    12


    Did you find this post helpful? Yes | No

    Default Re: Programming RFM radio modules in Basic

    Hello,

    Someone has code-tested the RFM69 module.

    THX.

  11. #11
    Join Date
    Oct 2010
    Posts
    411


    Did you find this post helpful? Yes | No

    Default Re: Programming RFM radio modules in Basic

    Im trying to figure out for most of the threads why RFM69s and LORA RFM 9x are so difficult to handle.

    Technology goes to plug and play modules, and those shouldnt be an exception. You should use them in order to help you, and not make you feel like you need to know rocket science to program those little modules.

    Richard gave me some directions, in an other similar thread, but i cannot accept that we need to right 2 pages asm code or an other higher level language in order to send a HELLO from one end to the other.

    At the end of the day, i understand that those modules will not sell, or someone that would like to share the fixed library for PIC BASIC Pro, and just let all the other to use the modules in the most easy way, like all the arduino users do.

    Anyway, i'm not a professional, just doing this as a hobby.

    I cannot understand why the people that really know how to program and handle typical application, are not sharing their knowledge. In nowadays all things are plug and play. That should be the way we all think and help.

    I'm a Chief Design engineer well known worldwide, in 3D printing Congenital Heart Defects for surgical planning, and i have shared for free my knowledge to 150 universities and hospitals in EMEA region. I dont want to make money of it. I want to be known and my name to be remembered in the future.

    I know in the other hand that there are people come in here, ask for a code, and then they presented like it is theirs and they also make money out of it. So what? Those people will never do something good in their lives. I do share my knowledge and i have in mind that 10 out of the 100 people in the meeting will take my work and cope paste it as theirs. I really do not care.

    Anyway, i know and respect everyone work, and maybe some of you really make money and live using this knowledge.

    Thanks for listening and understanding.

    Leonardo Bilalis.

    https://www.linkedin.com/feed/?trk=
    Last edited by astanapane; - 25th August 2018 at 12:20.

  12. #12
    Join Date
    May 2013
    Location
    australia
    Posts
    2,386


    Did you find this post helpful? Yes | No

    Default Re: Programming RFM radio modules in Basic

    i can only advise on rfm69 modules here
    the modules come fixed to operate in one only of these bands you need one thats legal in your country
    315MHz Module
    433MHz Module
    868MHz Module
    915MHz Module

    they can do FSK, GFSK, MSK, GMSK and OOK modulation
    they are capable of FSK Bit rates up to 300 kb/s subject to
    the bandwith / deviation selected the power level used

    if you choose to have a packet radio system then the built in
    Packet engine can perform CRC-16, AES-128 encyption and data whitening for you
    if you network them they can also do Incoming Sync Word Recognition
    and make good use of the 66-byte FIFO

    they are capable of backwards compatability with older modules like rfm12b


    for my network system i created a rfm12b compatable mode with a 5 byte preamble 3 byte syncword that incorporates a 1 byte net id and a 7 bit node id with a 1 bit auto acknowledge req flag , the network can transport node to node packets along with broadcast packets
    it operates @434mHZ 50k deviation @17000 bps , with no encryption and a pic generated ccitt_16 crc ,it supports variable length
    packets of
    1-255 bytes [from memory]

    reception can be polled or interrupt driven

    there is no simple . I think I have three pages of possible register settings . have you looked at the data sheet or the sample code from the hoperf site ?
    I got my initial rf12b system running by studying some of the Arduino libraries and adapting it to my needs


    and not make you feel like you need to know rocket science to program those little modules.
    it may not be rocket science but !

    what did you have in mind ?
    Warning I'm not a teacher

  13. #13
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,802


    Did you find this post helpful? Yes | No

    Default Re: Programming RFM radio modules in Basic

    There are other modules capable of plug and play as you request. But they are not as cheap as the HopeRF are. HopeRF does really cheap modules, taking away from you all the burden of the RF circuit. Then it leaves the rest of the settings up to you, making the modules versatile as Richard described.

    Also, every time the module is power cycled, it needs to be setup again, as it has no EEPROM to store the settings permanently.

    If you want to have all the settings ready and just to connect it to power and a data port, then it is not for you.

    These are great and cheap module but you have to do your part of the job. Can't have it all I 'm afraid.

    Ioannis

  14. #14
    Join Date
    Oct 2010
    Posts
    411


    Did you find this post helpful? Yes | No

    Default Re: Programming RFM radio modules in Basic

    i understand. It is not as easy as it looks like. Absolutely it is not for me. I might have to look other solutions to transfer the GPS data from one side to an other.

    I thought that it wouldnt be difficult for someone, in order to help this community, to create a library and a sample program. As i said before, i understand that it takes time, and it is not worth it to make it for free.

  15. #15
    Join Date
    May 2013
    Location
    australia
    Posts
    2,386


    Did you find this post helpful? Yes | No

    Default Re: Programming RFM radio modules in Basic

    Regarding the comments on the program, i leave them there for me. Sorry for disturbing your reading by using those comments. Because of i use them for my children project GPS, i try to keep those to remind me what i have done.
    there is a big difference between comments that impart some information and visual white noise that masks the very few bits of data that are crucially different
    and worthy of notation
    Warning I'm not a teacher

  16. #16
    Join Date
    Oct 2010
    Posts
    411


    Did you find this post helpful? Yes | No

    Default Re: Programming RFM radio modules in Basic

    My knowledge and time not helping my self to quickly develop a simple LED to light from one end of RFM69hcw to the other.

    But i will keep reading and studding all the information needed to achieve my goal.

  17. #17
    Join Date
    Oct 2010
    Posts
    411


    Did you find this post helpful? Yes | No

    Default Re: Programming RFM radio modules in Basic

    Now a small step, in the code is to add the DIO0 pin from RFM69HCW to PIC18F26K22.

    As i read from the net, that pin is the:

    Received data ready interrupt signal from RFM69HCW to microcontroller

    TRIS register must also be configured as input at that pin i guess as the RFM69HCW is the one sending data to PIC.

    That i believe will complete the connections between the PIC and the RFM.

    Code:
    '**********************************************************************
    '*  Name    : 18F26K22.BAS                                            *
    '*  Author  : [Leonardo Bilalis]                                      *
    '*  Notice  : Copyright (c) 2018 [Leonardo Bilalis]                   *
    '*          : All Rights Reserved                                     *
    '*  Date    : 30/Jun/2018                                             *
    '*  Version : 1.0                                                     *
    '*  Notes   : This is a GPS Tracker based on the following components *
    '*          : PIC18F26K22 or PIC18F46K22 @ 64Mhz                      *
    '*          : MKT 3333 or 3339 GPS MODULE                             *
    '*          : 4D Systems ULCD Goldelox or Picasso Graphic Processor   *
    '*          : RFM69HCW the range will be approximatelly 1000 meters   *
    '**********************************************************************     
    
      #CONFIG   ;
         CONFIG FOSC     = HSHP	        ; HS oscillator (high power > 16 MHz)
        CONFIG PLLCFG    = ON	        ;Oscillator multiplied by 4  
        CONFIG PRICLKEN  = ON	        ;Primary clock enabled
        CONFIG FCMEN     = OFF	        ;Fail-Safe Clock Monitor disabled
        CONFIG IESO      = OFF	        ;Oscillator Switchover mode disabled
        CONFIG  BOREN    = SBORDIS      ; Brown-out Reset enabled in hardware only (SBOREN is disabled)
        CONFIG  WDTEN    = ON           ; WDT is always enabled. SWDTEN bit has no effect                     ;|
        CONFIG  WDTPS    = 32768        ; 1:32768 ---> HERE enable the watchdog timer with a 1:32768 postscale;|
        CONFIG  PWRTEN   = ON
        CONFIG  HFOFST   = ON           ; HFINTOSC output and ready status are not delayed by the oscillator stable status
        CONFIG  MCLRE    = EXTMCLR      ; MCLR pin enabled, RE3 input pin disabled
        CONFIG  LVP      = OFF          ; Single-Supply ICSP disabled
        CONFIG  XINST    = OFF          ; Instruction set extension and Indexed Addressing mode disabled (Legacy mode)
        CONFIG  DEBUG    = OFF          ; Disabled  
        CONFIG  CP0 = OFF             ; Block 0 (000800-003FFFh) not code-protected
        CONFIG  CP1 = OFF             ; Block 1 (004000-007FFFh) not code-protected
        CONFIG  CP2 = OFF             ; Block 2 (008000-00BFFFh) not code-protected
        CONFIG  CP3 = OFF             ; Block 3 (00C000-00FFFFh) not code-protected
        CONFIG  CPB = OFF             ; Boot block (000000-0007FFh) not code-protected
        CONFIG  CPD = OFF             ; Data EEPROM not code-protected
        CONFIG  WRT0 = OFF            ; Block 0 (000800-003FFFh) not write-protected
        CONFIG  WRT1 = OFF            ; Block 1 (004000-007FFFh) not write-protected
        CONFIG  WRT2 = OFF            ; Block 2 (008000-00BFFFh) not write-protected
        CONFIG  WRT3 = OFF            ; Block 3 (00C000-00FFFFh) not write-protected
        CONFIG  WRTC = OFF            ; Configuration registers (300000-3000FFh) not write-protected
        CONFIG  WRTB = OFF            ; Boot Block (000000-0007FFh) not write-protected
        CONFIG  WRTD = OFF            ; Data EEPROM not write-protected
        CONFIG  EBTR0 = OFF           ; Block 0 (000800-003FFFh) not protected from table reads executed in other blocks
        CONFIG  EBTR1 = OFF           ; Block 1 (004000-007FFFh) not protected from table reads executed in other blocks
        CONFIG  EBTR2 = OFF           ; Block 2 (008000-00BFFFh) not protected from table reads executed in other blocks
        CONFIG  EBTR3 = OFF           ; Block 3 (00C000-00FFFFh) not protected from table reads executed in other blocks
        CONFIG  EBTRB = OFF           ; Boot Block (000000-0007FFh) not protected from table reads executed in other blocks
      #ENDCONFIG
      
    define  OSC 64
            
    OSCCON    = %01110000   ; 64Mhz
    OSCTUNE.6 = 1           ; Enable 4x PLL
    while ! osccon2.7 :WEND ; to make sure the pll has stabilised before you run any other code
    
    
    initialize:
    CLEAR                   
    
    TRISA = %11011111 
    TRISC = %11010111  
    
    
    
    SSPCON1 = %00100010 ' in here we se the 5th bit of the SSPCON1 register and the last 4 bits for the clock speed at 64Mhz.
    SSP1STAT = %11000000  ' in here i need a help to understand what bits must be configured
    
    
    
    CS1      VAR           LATA.5  ' chip select (SS) from PIC18F26K22 to RFM69HCW
    DIO0     VAR           PORTC.2 ' Received data ready interrupt signal from RFM69HCW to microcontroller
    SCK1     VAR           PORTC.3 ' clock from PIC18F26K22 to RFM69HCW
    SDI1     VAR           PORTC.4 ' data IN , MISO from PIC18F26K22 to RFM69HCW
    SDO1     VAR           PORTC.5 ' data OUT, MOSI from PIC18F26K22 to RFM69HCW
    
    SSPIF   VAR     PIR1.3          ' SPI interrupt flag
    SMP     VAR     SSP1STAT.7      ' Data input sample phase
    CKE     VAR     SSP1STAT.6      ' Clock Edge Select bit
    SSPEN   VAR     SSP1CON1.5      ' SSP Enable bit
    CKP     VAR     SSP1CON1.4      ' Clock Polarity Select
    
    CS1    = 1
    Last edited by astanapane; - 2nd September 2018 at 20:04.

  18. #18
    Join Date
    May 2013
    Location
    australia
    Posts
    2,386


    Did you find this post helpful? Yes | No

    Default Re: Programming RFM radio modules in Basic

    As i read from the net, that pin is the:

    Received data ready interrupt signal from RFM69HCW to microcontroller
    not really, in rx mode its PayloadReady in tx mode its PacketSent



    That i believe will complete the connections between the PIC and the RFM.
    that's 1% of the job done


    cannot see any point to creating these vars , they will never be used
    Code:
    SSPIF   VAR     PIR1.3          ' SPI interrupt flag
    SMP     VAR     SSP1STAT.7      ' Data input sample phase
    CKE     VAR     SSP1STAT.6      ' Clock Edge Select bit
    SSPEN   VAR     SSP1CON1.5      ' SSP Enable bit
    CKP     VAR     SSP1CON1.4      ' Clock Polarity Select
    Warning I'm not a teacher

  19. #19
    Join Date
    Oct 2010
    Posts
    411


    Did you find this post helpful? Yes | No

    Default Re: Programming RFM radio modules in Basic

    that's 1% of the job done
    That is what i meant

Similar Threads

  1. basic pic programming
    By sshanmugapriya in forum mel PIC BASIC
    Replies: 0
    Last Post: - 25th February 2010, 05:02
  2. Car radio (Car radio and electronics support forum)
    By freewillover in forum Forum Requests
    Replies: 1
    Last Post: - 1st July 2009, 19:41
  3. Smart Radio RF620A and RF620RA modules
    By Colin612 in forum Serial
    Replies: 0
    Last Post: - 8th May 2008, 15:47
  4. LPRS/miniature radio modules
    By fowardbias in forum Off Topic
    Replies: 1
    Last Post: - 20th September 2005, 01:03
  5. Help With Easy Radio Modules
    By hughgoodbody in forum General
    Replies: 5
    Last Post: - 25th May 2005, 09:14

Members who have read this thread : 4

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts