PDA

View Full Version : Wireless using debug.



polymer52
- 15th January 2010, 01:19
I got a couple of RF modules from Rentron to experiment with.
I'm using debug on the transmit side to send the data.
The problem is it will send the data to the LCD and display it momentarily then continue sending garbage to the LCD.
I know I need some kind of software filtering but I don't know where to start.
Any examples would be appreciated.
Here is what I'm sending directly to the transmitter:



debug $FE,$1
pause 100
debug $FE,$80+0,"PV volts: ",$FE,$80+13,dec(PV/10),".",dec(PV//10)," "
debug $FE, $C0, "Batt volts: ",$FE,$C0+13,dec(Batt/10),".",dec(Batt//10)," "
debug $FE, $94, "Batt Curr: ",$FE,$94+13,dec(gridcurr/10),".",dec(gridcurr//10)," "
debug $FE, $D4, "Grid Curr: ",$FE,$D4+13,dec(battcurr/10),".",dec(battcurr//10)," "


On the receiving end here is how it is being received then sent to a 4x20 serial LCD:



mainloop:
Serin rcv, mode, char ' Get a char from serial input
Lcdout char ' Send char to display
Goto mainloop
End


Edit/Delete Message

polymer52
- 15th January 2010, 22:44
Still fighting this thing. I've changed it serout2 and serin2 with a synch character but still no luck. It will work with lots of noise with the wait & synch character removed.
I'm pretty sure the problem is on the recieving end.
HELP!!


Transmitting pic



MAIN:
serout2 PORTB.5,16780,[junk,synch,$FE,$1] 'Clear screen and home
serout2 PORTB.5,16780,[junk,synch,$FE,$0F] 'Display on, cursor on
serout2 PORTB.5,16780,[junk,synch,$FE,$80,"LCD Line 1"]
serout2 PORTB.5,16780,[junk,synch,$FE,$C0,"LCD Line 2"]
serout2 PORTB.5,16780,[junk,synch,$FE,$94,"LCD Line 3"]
serout2 PORTB.5,16780,[junk,synch,$FE,$D4,"LCD Line 4"]

for K=1 to 2 'Delay in seconds 65534 max
pause 1000 '1 second delay
next k

GOTO MAIN
end



Recieving pic



MAIN:
Serin2 rcv,mode,[WAIT("A"),char] ' Get a char from serial input
Lcdout char ' Send char to display
Goto MAIN
End

mackrackit
- 15th January 2010, 23:30
This may or may not help
http://www.picbasic.co.uk/forum/showpost.php?p=81459&postcount=26
You may want to read the whole thread....

polymer52
- 17th January 2010, 12:07
This may or may not help
http://www.picbasic.co.uk/forum/showpost.php?p=81459&postcount=26
You may want to read the whole thread....

Yeah...Ummmm.
That thread is really confusing.

mackrackit
- 17th January 2010, 15:28
The thread is a bit confusing, but the post I linked you to has working code.

polymer52
- 18th January 2010, 00:02
The thread is a bit confusing, but the post I linked you to has working code.

Well sort of. It prints the 9 which is supposed to be the sync byte followed by the 3 (93) but only if connected by a wire.
Isn't it supposed to just print the character following the sync byte?
Also it won't do anything if sent wirelessly.
I know my wireless modules work because I can send data followed by trash with the first code above.
Just can't get rid of the trash and I do have a ground plane on both ends.
Bruce said that it was hard to make them work properly but surely someone has a simple code to transmit and recieve string and data.
I wanted to use debug but it isn't as simple as it sounded in my head..

Bruce
- 18th January 2010, 14:53
TIP: If you're sending long strings of data, first receive the whole string, then print it on
the LCD.

Receiving a single byte after the "A", then printing it on the LCD, you're missing a TON of
serial data during LCDOUT. And you only have 1 synch character at the start of each
string.

Also ... give the receiving end time to place everything on the LCD before sending the next
string. Imagine someone handing you ten gallon buckets of water every 2 seconds, with
you having to pour it through a straw into another bucket, and trying to keep up...;o)