I've made this into a new topic because I am no longer interfacing an ATOM to a parallax stamp. I couldn't figure out how to edit the title of the previous topic.
I've been working on this all day, and have got basic serial communication between two ATOMS with a rudimentary flow control pin. My code is almost identical to Dale's code in his post on January 28th, 2002, in the topic on PIC to PIC serial communication (
http://forums.basicmicro.net/atom-f484/pic-to-pic-serial-problem-t4277.html.) I have also spent hours on this forum looking at any and all other chip to chip serial topics.
Like I said, I have got this working, but sometimes the flow pin will just not reset. With both chips turned on, if I pull the flow control wire and connect it from P4 on the transmitting chip directly to Ground, it will make the chip start sending serout commands again. Is there anything I can do to make this setup more reliable? Different resistors, caps, what? I am not an electrical engineer and could really use the help here.
Transmitting ATOM code:
Code:
temp var byte
high 0
pause 1000
low 0
temp = "1"
input 4
main
high 20
pause 40
low 20
pause 40
if IN4 = 1 then main
pause 50
serout P2,n2400,[temp]
high 21
pause 40
low 21
pause 40
goto main
and receiving chip code:
Code:
temp var byte
high 0
pause 1000
low 0
high 14
main
pause 500
low 14
serin P15,n2400,[temp]
high 14
if (temp = "A") then
high 22
pause 2000
low 22
pause 1000
elseif (temp = "1")
high 23
pause 2000
low 23
pause 1000
elseif (temp = "C")
high 24
pause 2000
low 24
pause 1000
elseif (temp = 1)
high 25
pause 2000
low 25
pause 1000
else
high 0
pause 2000
low 0
pause 1000
endif
pause 1000
goto main
and my circuit diagram:
Attachment:
2atoms12-28-10.jpg [ 163.61 KiB | Viewed 6340 times ]
This is exactly the resistor setup of my actual circuit. I am pulling the flow control wire high, because a low signal triggers the transmit chip, and I am pulling the serial wire low, because I am using normal (non-inverted) serial data.
Any ideas on resistors or caps, or a different setup altogether?
Also, I have run a robo claw with 300 feet of wire between it and the controlling ATOM chip. I want to use the same amount of distance between the two ATOMS. Will this be possible? Do I need TTL/RS232 transceiver chips?
Thanks.