sunburnt63
New Member
Thanks to a previous thread, I am now trying to connect my picaxe18X with an Xbee module. I had a few questions pertaining to some code that was shown as an example though.
According to the Picaxe manual2 for BASIC commands it says to use the N(inverted signals) for the Baud rate. However, in the picaxe tutorial for connecting to Xbee, they use a T(true) signal. It says to use the N signal when using simple resistor interfaces which I think I am using since I will not be including the MAX232 interface. However, it seems that the interface used in parts of the tutorial are simple resistor interfaces, but they still use the T signal. Is there any reason for the discrepancy, or does it not really matter which you use?
I am also confused about the baud they chose because they use T4800_4, and then setfreq m8. isn't T4800_4 supposed to be used at 4MHz, not 8? wouldn't T4800_8 be correct? I guess this all boils down to me being confused about BAUDMODE for the serin / serout commands. Thanks for the insight!
Code:
start:
symbol BAUD=T4800_4 'baud rate for comms (either set xbee to run at 4.8k or double picaxe speed using setfreq m8)
setfreq m8
symbol XBEEdataoutPIN=4'output 4 is used to send data to the XBee
symbol XBEEdatainPIN=7'input 7 is used to recieve data from the XBee
'power up xbee
high 7'take XBee RESET pin high
high XBEEdataoutPIN'take XBee DATA IN pin high
high 6'take XBee SLEEP pin high
main:
high 5'turn onboard relay on
high portc 1'turn onboard led on
serout XBEEdataoutPIN,BAUD,("Relay and LED on")
pause 1000
low 5'turn on board relay off
low portc 1'turn onboard led off
serout XBEEdataoutPIN,BAUD,("Relay and LED off")
pause 1000
goto main
I am also confused about the baud they chose because they use T4800_4, and then setfreq m8. isn't T4800_4 supposed to be used at 4MHz, not 8? wouldn't T4800_8 be correct? I guess this all boils down to me being confused about BAUDMODE for the serin / serout commands. Thanks for the insight!