PDA

View Full Version : Serial communication problems



amindzo
- 28th August 2006, 18:48
Hi,
i send sensor data from transmitter to reciever via RF modules serialy.
i use PIC16F877A.i send data every 5 minutes.for the first time i have no problem but in next five minutes i recieved wrong data(for example 140% humidity).if i reset transmitter micro it sends data correctly
i asked myself maby the problem is RF modules but they are not.
becouse i send 12 byte to reciver and befor each byte i send a character so the reciver micro take the character and then put each byte in it's appropriate variable so if reciver don't get the character correctly it can't show the data on lcd.
so what's the problem?
i use micro code studio picbasic pro2.41
this is a small part of my program:
transmitter program:
send:
give data from sensor
serout PORTC.7,N1200,["A"]
serput PORTC.7,N1200,[humid1]
serout PORTC.7,N1200,["C"]
serout PORTC.7,N1200,[humid2]
........................
........................
sleep 300
goto send
end

reciever program:
recieve:
serin PORTC.7,N1200,["A"],humid1
serin PORTC.7,N1200,["C"],humid2
...............
..............
lcdout $fe,1,#humid1
pause 4000
lcdout $fe,1,#humid2
pause 4000
goto recive
end