Can anyone look at the code see if what’s wrong with this? I am sending AT command to xbee to change the PANID to 11
Delay10KTCYx(0); //213 ms per delay
Delay10KTCYx(0); //need 1 second
Delay10KTCYx(0);
Delay10KTCYx(0);
Delay10KTCYx(0);
TXREG = 0x2B; //“+++”
TXREG = 0x2B;
TXREG = 0x2B;
Delay10KTCYx(0);
Delay10KTCYx(0);
Delay10KTCYx(0);
Delay10KTCYx(0);
Delay10KTCYx(0);
TXREG = 0x41; //A
TXREG = 0x54; //T
TXREG = 0x49; //I
TXREG = 0x44; //D
TXREG = 0x31; //1
TXREG = 0x31; //1
TXREG = 0x0D; //CR
TXREG = 0x41; //A
TXREG = 0x54; //T
TXREG = 0x43; //C
TXREG = 0x4E; //N
TXREG = 0x0D; //CR
The PANID is not getting changed. Also, is it true that when you power off the xbee, the parameter will return to the previous value?
in this code
TXREG = 0x2B; //“+++”
TXREG = 0x2B;
TXREG = 0x2B;
Don’t you need to call a function to send a char to the UART, where that function loops until the UART’s TX buffer has room for another char?
and the same for all like code.
I’ve done what you are doing, in C, on an AVR. Worked well.
I use more structured code though, e.g., with a delay(msec) function I call.
Not telling us what microcontroller this is for, seems like a pretty glaring omission.
I would agree, though. You can’t just dump characters into a transmit register. Your microcontroller will have some way of telling you that it has finished transmitting the last character and is ready to send the next.
This is all assuming that you have setup the USART properly in the first place.
I see this is pretty much just an extension of this thread you created earlier:
viewtopic.php?t=14675