Shop OBEX P1 Docs P2 Docs Learn Events
Xbee to Xbee Help — Parallax Forums

Xbee to Xbee Help

chris joneschris jones Posts: 391
edited 2011-05-20 20:42 in Propeller 1
Hello

i have 2 xbees and 2 prop demo boards i have them hooked up and tested but i canyt seem to see why my code i snot working its very simple but its not transmiting.


RX
{
 ************************************************************************************************************
 *                                                                                                          *
 *  AUTO-RECOVER NOTICE: This file was automatically recovered from an earlier Propeller Tool session.      *
 *                                                                                                          *
 *  ORIGINAL FOLDER:                                                                                        *
 *  TIME AUTO-SAVED:     20 hours, 13 minutes ago (5/19/2011 11:24:13 PM)                                   *
 *                                                                                                          *
 *  OPTIONS:             1)  RESTORE THIS FILE by deleting these comments and selecting File -> Save.       *
 *                           The existing file in the original folder will be replaced by this one.         *
 *                                                                                                          *
 *                           -- OR --                                                                       *
 *                                                                                                          *
 *                       2)  IGNORE THIS FILE by closing it without saving.                                 *
 *                           This file will be discarded and the original will be left intact.              *
 *                                                                                                          *
 ************************************************************************************************************
.}
{{
  RFID Tag Side (remote client)
}}
CON
  _clkmode = xtal1 + pll16x
  _xinfreq = 5_000_000
  XBEE_DOUT_PIN = 1
  XBEE_DIN_PIN  = 2
  XBEE_MODE     = %0000
  XBEE_BAUD     = 9_600
  LED_PIN       = 20
  
  LCD_PIN       = 3                                         ' for Parallax 4x20 serial LCD on P0
  LCD_BAUD      = 19_200
  LCD_LINES     = 4 
  
obj
  xb    :       "FullDuplexSerial"  'comms to XBee.
  xbobj :       "XBee_Object_2"
  lcd   :       "debug_lcd"
  pst   :       "Parallax Serial Terminal"                   ' Serial communication object      
var
  long  recv
  byte data[11]  
  
pub go | idx
  xbobj.start(XBEE_DOUT_PIN, XBEE_DIN_PIN, XBEE_MODE, XBEE_BAUD) 'start comms to XBee
  xbobj.Delay(1000)                     ' One second delay
  
    if lcd.init(LCD_PIN, LCD_BAUD, LCD_LINES)             ' start lcd
      lcd.cursor(0)                                       ' cursor off
      lcd.backLight(true)                                 ' backlight on (if available)
      lcd.custom(0, @Bullet)                              ' create custom character 0
      lcd.cls                                             ' clear the lcd
      lcd.str(string("NODE", 13))
      lcd.putc(0)                                         ' display custom bullet character
      lcd.str(string("Recive", 13))
      lcd.putc(0)
      lcd.str(string("Transmit", 13)) 
      lcd.putc(0)
      'main loop
        repeat
          ReciveData
           

pub ReciveData
   ' pst.strinmax(@data, 1)
   ' waitcnt(clkfreq/100 + cnt)
   ' updateLcd(@data) 
   ' pst.str(@data)
      xbobj.rxStr(@data)
      waitcnt(clkfreq/100 + cnt)
      updateLcd(@data)
pub Delay(mS)       ' Delay in milliseconds
 
   waitcnt(clkfreq / 1000 * mS + cnt)
PRI updateLcd(value)
  lcd.gotoxy(12, 1)
  lcd.dec(value)                           
  lcd.gotoxy(12, 2)
  lcd.dec(value)                               

DAT
  Bullet      byte      $00, $04, $0E, $1F, $0E, $04, $00, $00     

TX
{{
  Computer Side (host)
}}
CON
  _clkmode = xtal1 + pll16x
  _xinfreq = 5_000_000
  XBEE_DOUT_PIN = 1
  XBEE_DIN_PIN  = 2
  XBEE_MODE     = %0000
  XBEE_BAUD     = 9_600
  LED_PIN       = 20
   LCD_PIN       = 3                                         ' for Parallax 4x20 serial LCD on P0
  LCD_BAUD      = 19_200
  LCD_LINES     = 4 
  
obj
  xb    :       "FullDuplexSerial"  'comms to XBee
  xbobj :       "XBee_Object_2"
  lcd   :       "debug_lcd"
  pst   :       "Parallax Serial Terminal"                   ' Serial communication object  
var
  long  recv
  byte data[10]
  byte val1
  
pub go | idx
  xbobj.start(XBEE_DOUT_PIN, XBEE_DIN_PIN, XBEE_MODE, XBEE_BAUD) 'start comms to XBee
  xbobj.Delay(1000)                     ' One second delay
  
    if lcd.init(LCD_PIN, LCD_BAUD, LCD_LINES)             ' start lcd
      lcd.cursor(0)                                       ' cursor off
      lcd.backLight(true)                                 ' backlight on (if available)
      lcd.custom(0, @Bullet)                              ' create custom character 0
      lcd.cls                                             ' clear the lcd
      lcd.str(string("NODE", 13))
      lcd.putc(0)                                         ' display custom bullet character
      lcd.str(string("Recive", 13))
      lcd.putc(0)
      lcd.str(string("Transmit", 13)) 
      lcd.putc(0)     
       
      'main loop
      repeat
        SendData
pub SendData
     xbobj.str(string("Hello Xbee"))
     waitcnt(clkfreq + cnt)
     xbobj.str(string("Hello Again!"))
  
pub Delay(mS)       ' Delay in milliseconds
   waitcnt(clkfreq / 1000 * mS + cnt)
PRI updateLcd(value)
  lcd.gotoxy(12, 1)
  lcd.decf(@value, 8)                                    ' print right-justified decimal value
  lcd.gotoxy(11, 2)
  lcd.ihex(@value, 8)                                    ' print indicated (with $) hex
  lcd.gotoxy(7, 3)
  lcd.ibin(@value, 12)                
                
      
DAT
  Bullet      byte      $00, $04, $0E, $1F, $0E, $04, $00, $00
Sign In or Register to comment.