RF Modules


Closed Thread
Results 1 to 40 of 45

Thread: RF Modules

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    FYI. DEBUG can send serial data at 19200 with a 4MHz oscillator, and you can use most any I/O-pin.
    Code:
    @ DEVICE PIC16F627A, WDT_OFF, MCLR_OFF, LVP_OFF
    
    DEFINE OSC 4
    DEFINE DEBUG_REG PORTB
    DEFINE DEBUG_BIT 2
    DEFINE DEBUG_BAUD 19200 '38400
    DEFINE DEBUG_MODE 0 ' 1 = inverted, 0 = true
    
    Main:
        DEBUG "Testing 19200 bps @ 4MHz",13,10
        PAUSE 1000
        GOTO Main
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  2. #2
    Join Date
    Jul 2006
    Posts
    60


    Did you find this post helpful? Yes | No

    Default

    Hello Bruce

    tonyfelloni said that it must use the hardwareUart from the pic. I not understand why.
    Perhaps a buffer problem why it not function with SoftUart?
    The modul hande up to 64 bytes, is this why must use the hardwareUart

    Regards
    Pedro

  3. #3
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    You need to use a PIC that has a hardware USART such as 16F88 as the RF modules only run at a baud of 19,200 and with picbasic only the Harware USART can achieve this.
    My guess would be he didn't know DEBUG would work at 19200.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  4. #4
    Join Date
    Jan 2008
    Location
    Dublin, Ireland
    Posts
    33


    Did you find this post helpful? Yes | No

    Default

    Correct, I wasnt aware of this....but now I know! :-)

    Cheers

  5. #5


    Did you find this post helpful? Yes | No

    Default

    Hello Tony,

    Could you please post an example on how to send and receive data with these modules?

    Thanks!

    Daniel.

  6. #6
    Join Date
    Jan 2008
    Location
    Dublin, Ireland
    Posts
    33


    Did you find this post helpful? Yes | No

    Default

    Hi Daniel

    Using these modules is the same as communicating between two pics if there was a wire connecting them.

    Below is the code the sending module is attached to, I have removed all unnecessary code and left all the defines etc so you can copy them exactly see if it works.

    Code:
    '****************************************************************
    '*  Name    : Sensirion SHT71.pbp                               *
    '*  Author  : Tony Flynn                                        *
    '*  Notice  : Copyright (c) Tony Flynn                          *
    '*          : All Rights Reserved                               *
    '*  Date    : 30/10/2008                                        *
    '*  Version : 7 - Code transmits TempC, TempF, RH & Time to     *
    '*            PICS on the network and serially to the PC        * 
    '*  Notes   :                                                   *
    '****************************************************************
    
    '-------------------------  Port Assignments --------------------------------
    
        ' PORTA.0   (02) Time flag pin from user interface, make pin input and pull to gnd (26)
        ' PORTA.1   (03) Serin time + all other settable parameters from User Interface (07) 
        ' PORTA.2   (04) Serout to PID Controller (17) 
        ' PORTA.3   (05) 
        ' PORTA.4   (06) 
        ' PORTA.5   (07) Serout to Ethernet - Must select HS OSC on this module &
        '                Ethernet PIC. Also non-inverted both sides. (38)  
        ' PORTB.0   (21) Interrupt Pin Square wave from DS1307 (07) 
        ' PORTB.1   (22) SHT11 SCK Clock Pin (03)  
        ' PORTB.2   (23) SHT11 Serial Data Pin (02) 
        ' PORTB.3   (24) RS232 Serial Out to PC (Obsolete, moved to PID) 
        ' PORTB.4   (25) Power Failure pin (Obsolete, moved to PID) 
        ' PORTB.5   (26) Hatch Status pin (Obsolete, moved to PID) 
        ' PORTB.6   (27) ICSP Pin 5
        ' PORTB.7   (28) ICSP Pin 4 
        ' PORTC.0   (11) 
        ' PORTC.1   (12) 
        ' PORTC.2   (13) 
        ' PORTC.3   (14) I2C Clock Line SCL DS1307 - 4k7 Pull up resistor (06) 
        ' PORTC.4   (15) I2C Data Line SDA DS1307 - 4k7 Pull up resistor (05)
        ' PORTC.5   (16)  
        ' PORTC.6   (17) USART TX Pin to wireless transceiver (03) 
        ' PORTC.7   (18) USART RX Pin
    
    '********************** 16F876A Configuration Fuses ****************************
     
    @ DEVICE HS_OSC
    ' Crystal Selected (High Speed is above 4MHz)
    @ DEVICE WDT_ON
    ' Watch Dog Timer is on - Needed for SLEEP command
    @ DEVICE PWRT_OFF
    ' Power Up Timer off, unit stays in reset for 72ms allowing Vdd to settle
    @ DEVICE BOD_ON
    ' Brown Out Detect on
    @ DEVICE LVP_OFF
    ' Low Voltage Programming off
    @ DEVICE CPD_OFF
    ' Data EEPROM code protection
    @ DEVICE WRT_OFF
    ' Write to Flash protection off
    @ DEVICE DEBUG_OFF
    ' On board Debugger off
    @ DEVICE PROTECT_OFF
    ' Protects code from being read from the chip
    
    
    '*******************************************************************************
    
    '--------------------------- Setup DEFINE's ----------------------------------
    
        include "modedefs.bas"      ' Contains Serout Baud rates
        DEFINE OSC 12               ' Using 12 MHz Oscillator
        DEFINE CHAR_PACING 1000     ' Pacing for serout Chars
        DEFINE HSER_RCSTA 90h       ' enable hardware serial port
        DEFINE HSER_TXSTA 24h       ' enable high speed transmit (Burgh=1)
        DEFINE HSER_BAUD 19200      ' set the baud rate for MIDI communications
        
    '------------------------  Port Initialization -------------------------------
    
        CCP1CON = %00000000         ' Disable CCP Module
        ADCON1 = %10000111          ' Set analog ports to digital mode, right justified
        CMCON = %00000111           ' Turn off comparator
        OPTION_REG.6 = 0            ' Interrupt on falling edge of RB0/INT pin
        OPTION_REG.7 = 0            ' PORTB Pullups enabled
        INTCON = %10010000          ' Global and RB0 Interrupts enabled
        TRISA = %000001
        TRISB = %00000111
        TRISC = %00000000
    
    '----------------------------------USART----------------------------------------
    
    USART:      ' Data sent to the wireless transceiver for remote module 
        pause 5   
        hserout [$55,$55,$55,$55,"TC",TempC.lowbyte,tempc.highbyte,TempF.lowbyte,TempF.highbyte,RHTempComp.lowbyte,RHTempComp.highbyte]
        Return
    Then the code on the receiving module is:

    Code:
    '****************************************************************
    '*  Name    : Monitoring Station - Rev 1                        *
    '*  Author  : Tony Flynn                                        *
    '*  Notice  : Copyright (c) 2008 Tony Flynn                     *
    '*          : All Rights Reserved                               *
    '*  Date    : 29/10/2008                                        *
    '*  Version : Rev 3 - Components removed for low power op       *
    '*  Notes   : Wireless minitoring station using 16F88 and       *
    '*            wireless module Cy2198TR. Data is displayed on    *
    '*            LCD. System operates at 4MHz. Data is beamed to   *
    '*            this module from other transceiver. Line into     *
    '*            other transceiver is non inverted USART from PIC  *
    '*            line into this PIC also non-inverted.  Unit is    *
    '*            Designed to run off 3 AA Alkaline batteries.      *
    '*                                                              *
    '****************************************************************
    
    
    '-------------------------  Port Assignments --------------------------------
    
    ' PORTA.0 (17)   LCD Data Line - Bit 4
    ' PORTA.1 (18)   LCD Data Line - Bit 5
    ' PORTA.2 (01)   LCD Data Line - Bit 6
    ' PORTA.3 (02)   LCD Data Line - Bit 7
    ' PORTA.4 (03)   LCD Data Line - Register Select - 10k pullup resistor to VDD
    ' PORTB.0 (06)   HPWM out to dim LCD light to off after X seconds
    ' PORTB.1 (07)   Button to turn on display for X time
    ' PORTB.2 (08)   Seiral Data in from wireless module. Wireless module voltage
    '                should be no greater than 1.5V less than MCU (5V). Tx from
    '                transceiver links directly to Rx of PIC.
    ' PORTB.3 (09)   LCD Data Line - Enable    
    ' PORTB.4 (10)   Wireless module Enable active low, High = low power mode.
    ' PORTB.5 (11)   Alarm Out pin   
    
    '************************ 16F88 Configuration Fuses ****************************
     
    @ DEVICE PROTECT_OFF
    @ DEVICE CCPMX_OFF
    @ DEVICE DEBUG_OFF
    @ DEVICE WRT_OFF
    @ DEVICE CPD_OFF
    @ DEVICE LVP_OFF
    @ DEVICE BOD_ON
    @ DEVICE MCLR_OFF
    @ DEVICE PWRT_ON
    @ DEVICE WDT_ON
    @ DEVICE XT_OSC
    @ DEVICE2 IESO_OFF 
    @ DEVICE FCMEN_ON
    
     
    ' Code Protection - _CP_OFF, CP_ON
    ' CCP1 Pin Selection - _CCP1_RB0, _CCP1_RB3
    ' In-Circuit Debugger Mode - _DEBUG_OFF, _DEBUG_ON
    ' Flash Program Memory Write Enable - _WRT_PROTECT_OFF, _WRT_PROTECT_256, _WRT_PROTECT_2048, _WRT_PROTECT_ALL
    ' Data EE Memory Code Protection - _CPD_OFF, _CPD_ON
    ' Low-Voltage Programming Enable - _LVP_OFF, _LVP_ON
    ' Brown-Out Reset - _BODEN_OFF, _BODEN_ON
    ' RA5/MCLR/Vpp Pin Function - _MCLR_OFF, _MCLR_ON
    ' Power-Up Timer - _PWRTE_OFF, _PWRTE_ON
    ' Watchdog Timer - _WDT_OFF, _WDT_ON
    ' Oscillator Selection - _EXTRC_CLKOUT, _EXTRC_IO, _INTRC_CLKOUT, _INTRC_IO, _EXTCLK, _HS_OSC, _XT_OSC, _LP_OSC 
    ' Oscillator Switchover - _IESO_OFF, _IESO_ON
    ' Fail-Safe Clock Monitor - _FCMEN_OFF, _FCMEN_ON
    
    '*******************************************************************************
    
    DEFINE OSC 4                    ' tell program we are using a 4mhz oscillator
    DEFINE HSER_RCSTA 90h           ' enable hardware serial port
    DEFINE HSER_TXSTA 24h           ' enable high speed transmit (Burgh=1)
    DEFINE HSER_BAUD 19200          ' set the baud rate for MIDI communications
    define HSER_CLROERR             ' Auto clear overflow buffer error.
    
        
        CCP1CON = %00000000         ' Disable CCP
        SSPCON.5 = 0                ' Disable SSP Module
        ANSEL = %00000000           ' Set analog ports to digital mode
        CMCON = %00000111           ' Turn off comparator    
        TRISA = %100000             ' Port A I/O Selection
        TRISB = %11110110   
    
    Display:
        low lowpower            ' Disable lower power operation
        pause 15                ' Give module time to wake
        Hserin[WAIT("TC"),TempC.lowbyte,tempc.highbyte,TempF.lowbyte,tempf.highbyte,RHTempComp.lowbyte,RHTempComp.highbyte]
        high lowpower           ' Set wireless tranceiver to low power mode

    I used the Hserin command as I could set this to the required baud. At the time I was unaware that the Debug option could be used. I am still using this setup today an it hasn't caused me any trouble at all.

    An initial problem I had was that the voltage on one of the modules was slightly on the low side and wasn't working. It worked fine once this was sorted. I havent used any inverters or the like. Serial data sent from the pin of one pic is fed into pin 3 (RX) of the wireless module through a 1k resistor, then on the other side pin 4 (TX) of the module is fed directly to the pic, no resistor.

    Hope this helps, it took me a while to get them going first!

    Tony

  7. #7


    Did you find this post helpful? Yes | No

    Default

    Thank you very much! I'll order these modules today, test them, and let you know.

    Daniel.

Similar Threads

  1. RF Modules (Zigbee)
    By Chris Barron in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 4th March 2010, 18:28
  2. Low latency Wireless RF transceiver modules?
    By mark155 in forum General
    Replies: 0
    Last Post: - 4th March 2010, 05:20
  3. RF Transceiver modules help
    By davewanna in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 16th May 2008, 14:54
  4. Help with CC1100 RF Modules.
    By charudatt in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 27th November 2006, 20:58
  5. RF Modules at 433.92MHz
    By Ioannis in forum Adverts
    Replies: 2
    Last Post: - 17th October 2006, 12:36

Members who have read this thread : 0

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