Wireless modules - help with code not working


Results 1 to 32 of 32

Threaded View

  1. #12


    Did you find this post helpful? Yes | No

    Default Re: Wireless modules - help with code not working

    Rob,
    I now have my two XRF transceivers set up and functioning. However, I'm experiencing the same problem as you have reported ... unable to communicate rf from a PIC and PBP.

    The hardware and wiring checks out good. Using a terminal program (TeraTerm) and a USART to USB Bridge cable (CP210x), the radio loop-back link works perfectly. Also, the AT command mode functions correctly for both devices.

    The comms do not work when driving the radio from a PIC USART. Sample code:
    Code:
    '**************************************************************************
    '*Program to test XRF radio communications via loopback method            *
    '*Uses a pushbutton switch on porta pin 4                                 *
    '*Target processor is PIC 12f1822                                         *
    '*321 program words, revised 05/05/2013                                   *
    '*Program by Dick Ivers                                                   *
    '*All rights reserved                                                     *
    '************************************************************************** 
    'set 12f1822 configurat1on
    #CONFIG
      __config _CONFIG1, _FOSC_INTOSC & _MCLRE_OFF & _CLKOUTEN_OFF & _WDTE_ON
      __config _CONFIG2, _PLLEN_OFF & _LVP_OFF
    #endconfig
    
    'set registers
            OSCCON = %01101000   '4 mhz osc
            OSCTUNE = 0          'factory calibration
            ANSELA = 0           'all digital inputs
            OPTION_REG.7 = 0     'global pullups enabled
            WPUA = %010000       'porta pin 4 weak pullup enabled
            CM1CON0.7 = 0        'comparator disabled
            TRISA  = %011110     'PORTA.0 & porta.5 are outputS, all others input
    
        while OSCSTAT.0 = 0    'wait for stable freq.
        wend
        
        define OSC 4            '4 mhz oscillator
    
    'Define hserout parameters 
        define HSER_RCSTA 90h
        define HSER_TXSTA 20h
        define HSER_BAUD 9600
        define HSER_CLROERR 1           'clear overflow error
        
        APFCON.7 = 1   'rx on ra1 (12f1822)
        APFCON.2 = 1   'tx on pin ra0 (12f822)
        
        i var byte
        char var byte
    
    
        For i = 1 to 3
        porta.5 = 0     'led on
        pause 333
        porta.5 = 1     'led off
        pause 333
        next
        
    
    asleep:
        nap 2   'delay 4 ms
        if porta.4 = 1 then asleep
        
    
    DT:
        hserout [dec 5]
        hserin 100,blink,[dec char]
        if char = 5 then
        porta.5 = 0    'led on
        goto halt
        endif
         
    blink:
        porta.5 = 0     'led
        pause 50
        porta.5 = 1     'led off
        pause 50
        if porta.4 =1 then asleep
        goto DT   
       
    halt:
        stop
    I saw your latest post on the Ciseco forum. You are not getting much help there. Do you have any further test results?

    Dick
    Last edited by Dick Ivers; - 5th May 2013 at 17:01.

Similar Threads

  1. Wireless modules and simple setup, what is required?
    By tasmod in forum mel PIC BASIC Pro
    Replies: 17
    Last Post: - 11th April 2013, 17:57
  2. Low latency Wireless RF transceiver modules?
    By mark155 in forum General
    Replies: 0
    Last Post: - 4th March 2010, 05:20
  3. Wireless modules FCC approved
    By Michael in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 7th September 2008, 02:23
  4. Software RS232 and wireless modules
    By Michael in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 17th August 2008, 05:27
  5. Wireless comms with Linx LR modules
    By telemark in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 2nd July 2006, 01:58

Members who have read this thread : 1

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