pic16f88, xbee's & point-2-point comms


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2008
    Posts
    29

    Default pic16f88, xbee's & point-2-point comms

    i have 6 endpoints that have sensor data to send to the xbee coordinator. i'm looking for ideas on how do i ensure that each endpoint/pic sends it's data point-to-point to the coordinator and also have the coordinator "ack" the received data back to the correct sender, and also avoid collisons?

    if the base communicates point-to-point via "serout & serin" will i need to set the destination address in that block of code? i guess the sending endpoint could include it's address so i wouldn't need to hard code that in the code for the base?

    below is the xbee configs for ver and addressing along with some PBP pseudo code hoping this illustrates what i'm trying to accomplish

    any thoughts/advice will help me brainstorm
    tia


    =================================
    Modem = XB24
    Function Set = xbee 802.15.4
    Version = 1084

    [Coordinator]
    CE - Coordinator Enable = 1
    DL - Destination Addr Low = FFFF
    MY - 16-bit Src Addr = 0
    PAN = 3332

    [End Points; 6 total]
    DH = 0
    DL = 0
    MY = 1
    .
    .
    .
    MY = 6
    =================================


    ;--[base]----------------------------------------------------------------

    XB_Base_MYAddr CON $0 ' Node Address Base
    XB_DestDLAddr CON $1 ' Destination address

    SERIN2 RX\RTS, baud, [WAIT("A"), DATAIN]

    'if FirstChar = "A" then 'do something on "A"
    ' SEROUT2 TX, Baud,["B", Dec Z,13] 'send a char to E1 remote
    ' Pause 2000 'pause due to a timing issue with buffers i think
    'else
    'if FirstChar = "C" then 'do someting on "C"
    ' SEROUT2 TX, Baud,["D", Dec Z,13] 'send a char to E2 remote
    ' Pause 2000 'pause due to a timing issue with buffers i think
    'else
    ' etc., up through remote E6 unit
    'endif



    ;--[EP1]--------------------------------------------------------------------

    XB_E1_MYAddr CON $1 ' Node Address E1
    XB_BASE_DestDLAddr CON $0 ' Base Destination address

    SEROUT2 TX, Baud,["A", Dec Z, 13] 'send char "A" + data to xbee base
    SERIN2 RX\RTS, baud, 2500, TimeOut1, [Wait("B"), Dec DataIn]

    ;--[EP2]--------------------------------------------------------------------

    XB_E2_MYAddr CON $2 ' Node Address E2
    XB_BASE_DestDLAddr CON $0 ' Base Destination address

    SEROUT2 TX, Baud,["C", Dec Z,13] 'send char "C" + data to xbee base
    SERIN2 RX\RTS, baud, 2500, TimeOut1, [Wait("D"), Dec DataIn]

    [...]
    E3 .. E6 remotes
    [...]
    ;------------------------------------------------------------------------

  2. #2
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    I will think loud on how I would solve the problem.


    Six XBee sensors are all slave addresses are : S01 S02 .... S06

    XBee coordinator is the master, so no address is needed

    Slave S01 has data to send so, "S01" + Data will be Tx out

    Immediatly after Tx action, Slave S01 go to RX loop count routine and here waits master ACK.

    Code:
    LoopCount:
    
    Count=Count+1
    if Count=XX then 
    Count=0
    Time= Time +1
    goto Tx again
    endif
    
    If Time=YY then error
    
    SERIN2 RX\RTS, baud, 2500, LoopCount, [Wait("S01"),  Data]
    
    If Data=6 then main
    
    goto LoopCount

    This action will be repeated so many time as judged feasible using variable XX while variable YY will trigger an error in case of no response.

    Master receive address + data then answer with received slave address + ACK

    Slave Receive the proper address + ACK then delete data and return to main loop. (This will avoide to disturb the other slaves which will ignore the Tx)

    Collisons are not avoided but ignored since Slaves will continue to Tx address + Data till it receives its address + ACK

    The same will apply for all the other slaves.

    Al.
    Last edited by aratti; - 31st January 2009 at 19:41.
    All progress began with an idea

  3. #3
    Join Date
    Oct 2008
    Posts
    29


    Did you find this post helpful? Yes | No

    Default

    Al, many thanks for the brainstorm.

    Thinking out loud here....

    I see where I was getting hung up, the "ack" and the addressing.

    My xbee's are series-1 so as long as my remote sensors set the xbee [DL] value to the xbee coordinator [MY] value they'll talk point-to-point, which is what i want.

    I can prefix an incoming data packet with an "identifier" so the coordinator knows which remote and thus that data is to follow. And when the coordinator recieves data along with an end of message character I can have it send an "ack" back to the sending remote thus qualifying the data sent.

    I can see where I was stuck in my thinking, thanks for clearing the picture.

    Cheers!

Similar Threads

  1. Single digit 7 Seg LED clock - PIC16F88
    By thirsty in forum Code Examples
    Replies: 4
    Last Post: - 17th July 2009, 08:42
  2. Optimizing DIV
    By skimask in forum mel PIC BASIC Pro
    Replies: 41
    Last Post: - 22nd September 2008, 04:58
  3. Replies: 20
    Last Post: - 13th May 2007, 05:10
  4. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 17:27
  5. Replies: 8
    Last Post: - 7th December 2006, 15:42

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