xbee issue please help
synapse
Posts: 19
ok So I am using the Xbee api object XB : "XBee_Object" with my propeller.
All is going great I can transmit all the data I want from the propeller to the pc using the xbee usb adapter and the like. however now I want to send commands to the propeller and do a XB.rx or the like but to no avail. I have spent the last 16 hours racking my brain even submitted a support ticket with parallax but haven't heard back yet. but it is Friday so I will give them that.
Sorry for the poor typing my hands are falling asleep. I have this huge Concept that all hinges on my ability to send data back and forth wirelessly to my propeller. I can use fullduplexserial and it works great but the xbee wont receive. I have to be missing something. they are series 1 pro boards at 63uW.
here is the code I am using now to test around the problem. I even downloaded a few c# libs thinking maybe I am not sending some AT command from the PC I should be. : (btw the getpresure sub doesn't matter it does the same with or without it. )
All is going great I can transmit all the data I want from the propeller to the pc using the xbee usb adapter and the like. however now I want to send commands to the propeller and do a XB.rx or the like but to no avail. I have spent the last 16 hours racking my brain even submitted a support ticket with parallax but haven't heard back yet. but it is Friday so I will give them that.
Sorry for the poor typing my hands are falling asleep. I have this huge Concept that all hinges on my ability to send data back and forth wirelessly to my propeller. I can use fullduplexserial and it works great but the xbee wont receive. I have to be missing something. they are series 1 pro boards at 63uW.
here is the code I am using now to test around the problem. I even downloaded a few c# libs thinking maybe I am not sending some AT command from the PC I should be. : (btw the getpresure sub doesn't matter it does the same with or without it. )
CON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 'Serial SerialComBaud = 9600 CR = 13 LF = 10 XBRX = 17 XBTX = 16 'SCP1000D0 SCP_DRDY =11 ' SHT DRDY pin SCP_CSB =7 ' SHT CSB pin SCP_MISO =8 ' SHT MISO pin SCP_MOSI =9 ' SHT MISI pin SCP_SCK =10 ' SHT SCK pin 'H48C 3axis Accelerometer CS = 13 DIO = 15 CLK = 14 OBJ SerialCom : "FullDuplexSerial" 'Cogs 1 SCP : "SCP1000D0" 'Cogs 0 FloatString : "FloatString" 'Cogs 0 FloatMath : "FloatMath" 'Cogs 0 'This object Cogs 1 'Cogs used: 2 S : "STRINGS2" XB : "XBee_Object" sdfat : "fsrw" H48C : "H48C Tri-Axis Accelerometer" VAR byte tbuf[20] byte bigbuf[8192] long vref,x,y,z,ThetaA,ThetaB,ThetaC long rxchk long a,b,c long stra[1] long frame[400] PUB main Init XB.str(string("Ready:")) XB.CR repeat rxchk:= SerialCom.rxcheck ' this was XB.rxcheck ifnot rxchk==-1 b := SerialCom.Rx ' this was XB.rx if b== "0" XB.str(string("AXON OS version 1.0")) CRLF if b== "1" XB.dec(1) if b== "2" XB.dec(2) if b== "3" GetPresure ELSE CRLF 'GetPresure ' sdfat.pclose writeStringData(string("SDWrite Complete!")) CRLF PRI CRLF XB.CR XB.Tx(10) PRI writeStringData(strd) XB.str(strd) sdfat.SDstr(strd) PRI writeBinData(bind,len) XB.bin(bind,len) sdfat.sdbin(bind,len) PRI writeDecData(decd) XB.dec(decd) sdfat.SDdec(decd) PRI Init |r 'Serial SerialCom.start(31,30,0,SerialComBaud) XB.start(XBRX,XBTX,0,SerialComBaud) XB.AT_Init ' Initialize for fast AT command use - 5 second delay to perform XB.AT_ConfigVal(string("ATMY"),$5) ' Set MY address to 5 'Math ' FloatMath.start ' start floating point object 'SCP1000D0 writeStringData(string("Init Pressure Sensor")) CRLF SCP.start(SCP_DRDY, SCP_CSB, SCP_MISO, SCP_MOSI, SCP_SCK) ' start SCP object writeStringData(string("Pressure Sensor Init Complete")) CRLF 'start and setup Accelerometer writeStringData(string("Init H48C Sensor")) CRLF H48C.start(CS,DIO,CLK) writeStringData(string("H48C Init Complete")) CRLF 'writeStringData(string("Mounting SD Card")) CRLF sdfat.mount(0) writeStringData(string("Mounted SD Card")) r := sdfat.popen(string("telem.txt"), "w") CRLF
Comments
Jim…
Jim...
Every other time I enter a 0, on the USB XBee I get your string, or every other value I see the values (1,2,3) on the USB terminal.
In your code you do change the MY addr of the Prop XBee to 5. Are you setting the USB XBee to send to a DL of 5 so it sends data to the correct address?
-Martin
OK I guess my question then is how on the pc through the terminal do I send text to a specific address? If that is it this will solve so many issues.
Thanks,
Terry Massey
- Easiest thing to do is take the "ATMY" code out of your project. That will keep both on the default address (source and destination) of 0.
- To change your USB XBee to send to an address of 5:
--- To enter Command Mode, in the terminal window, wait 3 seconds
--- type +++
--- wait until it says OK (takes a couple seconds)
--- To set destination address to 5, type ATDL 5 & hit enter
--- it says OK
--- To save this, so that cycling power doesn't change it, type ATWR & hit enter
--- Type ATCN to exit command mode
You should be good to go.
-Martin