Xbee interface
Posted: 05 February 2009, 9:24 AM
I am attempting to interface my ZX-328n with my Xbee through com3. I can successfully send the date from the ZX to the Xbee and read it with a remote Xbee. However, I am not so lucky the other way around. When I send data (like the number 5) from the Xbee to the ZX I just a lot of gibberish if the variable I am filling from the queue is a string. If I fill a byte variable from the queue I just get the numbers 128 and 248.
I suspect I have some sort of data conversion error. But here are my connections in the event that is the problem.
Xbee TX (pin 2) to ZX pin 6. The Xbee holds it at 3.25 volts until it is transmitting and then it fluctuates a few tenths of a volt lower (I only have a $20 meter and no scope)
I have no trouble with data in the other direction but I am just outputting the ZX through a divider circuit using two resistors to get it below the 3.3V the Xbee requires.
All of this is occurring with the two devices separated by about 6 inches of wire. Thanks in advance.
I suspect I have some sort of data conversion error. But here are my connections in the event that is the problem.
Xbee TX (pin 2) to ZX pin 6. The Xbee holds it at 3.25 volts until it is transmitting and then it fluctuates a few tenths of a volt lower (I only have a $20 meter and no scope)
I have no trouble with data in the other direction but I am just outputting the ZX through a divider circuit using two resistors to get it below the 3.3V the Xbee requires.
All of this is occurring with the two devices separated by about 6 inches of wire. Thanks in advance.
Code: Select all
Const crlf as String = Chr(&H0d)
Const comPort as Byte = 3
Const rxPin as Byte = 6
Const txPin as Byte = 4
Const qsize as Byte = 40
Dim oq(1 to qsize) as Byte
Dim iq(1 to qsize) as Byte
Sub Main()
dim Data as byte
' prepare the serial channel
Call OpenQueue(iq, SizeOf(iq))
Call OpenQueue(oq, SizeOf(oq))
Call DefineCom(comPort, rxPin, txPin, &H08)
Call OpenCom(3, 4800, iq, oq)
do
Call Delay(0.05)
call getqueue(iq,data,1)
debug.print (data)
loop
End Sub