Newbie radio link issue


Closed Thread
Results 1 to 32 of 32

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Location
    New Zealand
    Posts
    171

    Default Newbie radio link issue

    I'm new to serial comms and never tried a radio link before and am having troubles. I have an "easy radio" ER400TS and ER400RS chips, and am trying to link two PIC16F678 together with them. Have tried most things but gotten stuck - it does say in the datasheet for the easy radio chips that it defaults to 19200bps and gives the instruction to set data rate to 2400 as ER_CMD#U1

    Many thanks to anyone who can give me some clue as to what I'm doing

    Here's my receiver code:
    @ DEVICE PIC16F676, INTRC_OSC_NOCLKOUT, MCLR_OFF, PROTECT_OFF, BOD_ON, CPD_OFF


    'Define OSCCAL_1K 1
    DEFINE OSC 4

    TRISA = %001000
    TRISC = %000000


    ANSEL = 0 'disable analog
    T1CON = %00000100
    VRCON = 0 ' A/D Voltage reference disabled
    CMCON = 7 'Disable comparitor

    timesw var PortA.5
    gosw var PortA.3
    stopsw var PortA.4
    timeset var byte
    display var byte
    time var word
    b0 var byte
    b1 var bit

    clear
    timeset = 1
    PortA = 0
    PortC = 0
    serout PORTA.4,0,["ER_CMD#U1"] 'change receiver to 2400bps

    Begin:

    display = (1 << b0) - 1
    PORTC = display
    pause 100
    if b0 < 7 then
    b0 = b0 + 1
    goto begin
    Else
    Pause 1000
    b0 = 0
    portC = b0
    Endif

    Start:

    serin PORTA.0,0,["A"],timeset,b1 'Read receiver

    disply:

    display = (1 << timeset) - 1 'Set display to be bar type
    PORTC = display 'output LEDs
    goto Start


    AND HERE'S MY TRANSMITTER CODE:

    @ DEVICE PIC16F676, INTRC_OSC_NOCLKOUT, MCLR_OFF, PROTECT_OFF, BOD_ON, CPD_OFF

    'DEFINE ADC_BITS 10
    'DEFINE ADC_CLOCK 3
    'DEFINE ADC_SAMPLEUS 50
    'Define OSCCAL_1K 1
    DEFINE OSC 4

    TRISA = %111000
    TRISC = %000000

    'ADCON0 = %10000000
    'ADCON1 = %000
    ANSEL = 0 'disable analog
    T1CON = %00000100
    VRCON = 0 ' A/D Voltage reference disabled
    CMCON = 7 'Disable comparitor

    timesw var PortA.5
    gosw var PortA.3
    stopsw var PortA.4
    timeset var byte
    display var byte
    time var word
    b0 var byte
    b1 var word

    clear
    timeset = 1
    PortA = 0
    PortC = 0

    Begin:

    display = (1 << b1) - 1
    PORTC = display
    pause 100
    if b1 < 7 then
    b1 = b1 + 1
    goto Begin
    Else
    Pause 1000
    b1 = 0
    portC = b1
    Endif

    Start:

    if timesw = 1 then settime 'jump to setime if triggered
    if gosw = 1 then go
    if stopsw = 1 then trnsstop
    gosub disply
    goto start

    settime:

    if timeset > 6 then timeset = 0 'if greater than max then reset
    time = 0
    pause 100
    if timesw = 1 then settime 'wait till switch open
    timeset = timeset + 1

    goto start

    disply:

    display = (1 << timeset)' - 1
    PORTC = display

    return

    go:

    PORTC = 0
    PORTC.5 = 1
    pause 1000
    for b0 = 0 to 5
    toggle PORTC.5
    SEROUT PortA.0,0,["A",timeset,1]
    pause 100
    next b0

    goto start

    trnsstop:

    PORTC = 0
    PORTC.0 = 1
    Pause 1000
    for b1 = 0 to 5
    toggle PORTC.0
    serout PortA.0,0,["A",timeset,0]
    pause 50
    next b1

    goto start

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by George View Post
    I'm new to serial comms and never tried a radio link before and am having troubles. I have an "easy radio" ER400TS and ER400RS chips, and am trying to link two PIC16F678 together with them. Have tried most things but gotten stuck - it does say in the datasheet for the easy radio chips that it defaults to 19200bps and gives the instruction to set data rate to 2400 as ER_CMD#U1

    Many thanks to anyone who can give me some clue as to what I'm doing
    PBP manual, page 130 and page 137.
    There's something on each of those pages that you've forgotten. Hopefully after you add that certain thing, all should be well. The rest of the code, at first glance, looks like it should be ok.

    Another thing...make sure the whole thing works without the RF modules first, direct connect between the two PICs. That seems to be a common theme in most RF projects. People don't build up to the RF link, they just expect it to work on the first try (or the 100th ), and come to find out that the basic code was flawed in the first place.
    Last edited by skimask; - 20th February 2007 at 00:00.

  3. #3
    Join Date
    Oct 2005
    Location
    New Zealand
    Posts
    171


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    PBP manual, page 130 and page 137.
    There's something on each of those pages that you've forgotten. Hopefully after you add that certain thing, all should be well. The rest of the code, at first glance, looks like it should be ok.
    I presume you are meaning the mode names? If so i used the code instead - ie. 0 = T2400

    I'll try the direct connection now - I was thinking about it, but put it off

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by George View Post
    I presume you are meaning the mode names? If so i used the code instead - ie. 0 = T2400

    I'll try the direct connection now - I was thinking about it, but put it off
    I just looked at the PBP manual again. If you're using numbers, you don't need to include the file. My bad...
    Also, the datasheet says to use inverted data, i.e. N2400 instead of T2400.
    I'm just having a quick look at the datasheet now...so bear with me...

  5. #5
    Join Date
    Oct 2005
    Location
    New Zealand
    Posts
    171


    Did you find this post helpful? Yes | No

    Default

    I pulled the radio modules off and did a direct connect - and it didn't work! All it was was making sure the internal oscillators were calibrated. Then it worked so my hopes were high for connecting the radio modules again - but alas, it was not to be. just doesn't work for some reason - I think it has something to do with the internal setup of the radio chips - for some reason (maybe their brand name) I thought it would be easy! And would just transmit data as it came into it's pin - but apparently u have to set baud into the receiver and there r a few other options which make it a bit complicated for a beginner.

  6. #6
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,132


    Did you find this post helpful? Yes | No

    Default

    If direct connection works and RF link does not (considering that the radios are communicating) then I would suggest to try sending only the bytes AAh repeatedly and see if the receiver gets the data.

    If you have success then consider to use bi-phase or manchester encoding of the bytes to be transmited (forum has solution for this).

    Ioannis

Similar Threads

  1. Car radio (Car radio and electronics support forum)
    By freewillover in forum Forum Requests
    Replies: 1
    Last Post: - 1st July 2009, 19:41
  2. pic to pic ir link versus wired link : help please anyone
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 30th May 2008, 21:01
  3. Replies: 5
    Last Post: - 6th September 2007, 04:59
  4. quickBlue™ Link
    By lester in forum Bluetooth
    Replies: 4
    Last Post: - 20th March 2007, 13:23
  5. 18F1320 ... Strange Memory
    By Acetronics2 in forum mel PIC BASIC Pro
    Replies: 43
    Last Post: - 9th April 2006, 09:55

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