Hi Al, Dave and Dave
This appear to be an HSEROUT issue!!
When I use HSERIN with a string before the variables like this - check reciver code HSEROUT line
RECEIVER
Code:'variables begin here A0 var byte net var byte led var PORTD.0 SYNK VAR BYTE SYNK = $7E 'end of variables test: hserin [WAIT(SYNK),DEC net] if net = 23 then lcdout "i got 23 " toggle LED 'lcdout $fe,1 endif HSERout ["got this",DEC net,$d,$a] 'net var show in hyperterminal got test end
TRANSMITTER
then the number 23 as well as the number 2 appears !!Code:'RF variables 'A0 var BYTE 'A0=23 'TRAIN VAR BYTE 'TRAIN=$55 TRAIN VAR BYTE train = $B3 SYNK VAR BYTE SYNK = $7E 'Variables end here loopy: high LED ' LED on hserout [TRAIN,SYNK,dec 23] low led 'LED off Goto loopy ' Go back to loop and blink LED forever End
See here:
If I remove the string of letters , in this case "got this " then every single received line shows only the number 23 which is what we are expecting to see!Code:got this23 got this2 got this23 got this2 got this23 got this2 got this23 got this2 got this23 got this2
See here:
PERFECT except for once in a while the occasional number like 2 or 3 shows up!Code:23 23 23 23 23 3 23 23 23 23 23 23
And trying Al's suggestion of removing the DEC modifier (only on receiver side and for both hserin and hserout)
I get this
Now tell me that's not a strange oneCode:got this2 got this2 got this2 got this2 got this2 got this2 got this2 got this2
Now...some really awesome observations from my tests here :
First off this is working like a charm !
It's pretty damn close to near perfect in terms of reliable data transfer! (would love any further suggestions re checksums -- I though of something like catching a few instanced of the byte and then accepting it as correct!
Range is awesome ! Right now, as I am typing this the Transmitter is outside my house at the edge of the property - well over 200m and I have taken it upstairs and downstairs every little nook and cranny and it's still spot on !
Speed is fantastic - its so fast the led hardly blinks and the MCS serial tool window is filled up in less than a second
I have both receiver and transmitter hooked up to a 9V battery and then into a 5V regulator with no caps anywhere. My entire house is flooded with 2,4 and 5,8 GHz wireless and there are electrical appliances plentifold.
If the receiver is left in powered on happily waiting for it's signal , as the transmitter is powered on the receiver has already caught at least 6 bytes :-) ...this is how wireless should be in a perfect world :-)
I would be happy to report that the combination of train and sync byte are a winner! Spot on Mackrackit - thank you!
I am extremely happy with verything so far and just want to thank all of you who have guided me with code snippets, corrections and everything else!
Thank you so much !!
Dave Houston I will still definitely be getting you code working too, come rain hail or snow!
All that remain (for now :-)) is the ability to send more than one byte.
I was thinking 3 bytes. (24 bits total)
So my question is this:
Assuming I am to stick with this method , what is the best method (most relaible) to be adding more bytes to be sent ?
Thanks yet again
Kind regards
Dennis
Dennis, I suggested you to remove the DEC modifier in Transmitter not in the receiver side....And trying Al's suggestion of removing the DEC modifier (only on receiver side and for both hserin and hserout)
The reason is that you Tx a pure ascii code and convert it to decimal at the receiver side, while now you are modifying the byte twice (at Tx & at Rx) and can yield wierd results.
Al.
All progress began with an idea
Thanks Al for pointing out my mistake.
Dennis,
Just for fun, send this straight to the terminal, you might find it interesting.
More bytes?Code:XNUM VAR BYTE[8] XNUM = 225 'CHANGE THIS NUMBER AS NEEDED SEROUT2 GPIO.5,16780,[TRAIN,SYNK,DEC XNUM.7,DEC XNUM.6,DEC XNUM.5,_ DEC XNUM.4,DEC XNUM.3,DEC XNUM.2,DEC XNUM.1,DEC XNUM.0,_ "--",DEC XNUM,$d,$a]
SEND
RECEIVECode:XNUM VAR BYTE YNUM VAR BYTE ZNUM VAR BYTE XNUM = 225 YNUM = 100 ZNUM = 4 START: SEROUT2 GPIO.5,16780,[TRAIN,SYNK,XNUM,YNUM,ZNUM,$d,$a] PAUSE 5000 GOTO START
Code:XNUM VAR BYTE YNUM VAR BYTE ZNUM VAR BYTE START: SERIN2 GPIO.5, 16780,[WAIT(SYNK),XNUM,YNUM,ZNUM] SEROUT2 GPIO.4,16780,["X-",DEC XNUM," Y-",DEC YNUM," Z-",DEC ZNUM,$d,$a] GOTO START
Dave
Always wear safety glasses while programming.
Al thanks a million for the clarity on that one .. will check and feedback !
Dave ... ok just for fun so be it !
And if I get greedy would the Var bytes be num num num ? :-)
Expect Feedback .. results may vary :-0
Kind regards
Dennis
Hi Dave ;-)
That TX RX code you passed on works like a charm too X Y and Z coming through clear as day although I changed it for HSERIN and HSEROUT
Not sure what you want me to try with this code though ??
[code]
XNUM VAR BYTE[8]
XNUM = 225 'CHANGE THIS NUMBER AS NEEDED
SEROUT2 GPIO.5,16780,[TRAIN,SYNK,DEC XNUM.7,DEC XNUM.6,DEC XNUM.5,_
DEC XNUM.4,DEC XNUM.3,DEC XNUM.2,DEC XNUM.1,DEC XNUM.0,_
"--",DEC XNUM,$d,$a]
[code]
Did you want me to TX/RX it ? modify and put on send and receive side ?
Dennis
Hi Al
I applied your suggestion , unfortunately it didn't work , my receiver side has an IF ..THEN statement looking for the number 23, and implementing your suggestion on the TX side only doesn't seem to send the correct DEC 23 to the RX so the IF condition is never met ...check my receiver side code for clarification.
To confirm , I only left the DEC modifier on the receiver side.. (please note though that at the receiver side I have hserin and hserout statements using the DEC modifier.
I placed your code suggestion on the TX of the first PIC only ..so it looks something like this
TX ----------- hyoerterminal
TX ------RF----- RX
PIC1 PIC2
Will bash around with it a little more and see what comes of it :-)
I'll post result back as soon as I have double checked each step too.
kind regards
Dennis
Really??? Well how about that...
Send directly to a terminal.Not sure what you want me to try with this code though ??
[code]
XNUM VAR BYTE[8]
XNUM = 225 'CHANGE THIS NUMBER AS NEEDED
SEROUT2 GPIO.5,16780,[TRAIN,SYNK,DEC XNUM.7,DEC XNUM.6,DEC XNUM.5,_
DEC XNUM.4,DEC XNUM.3,DEC XNUM.2,DEC XNUM.1,DEC XNUM.0,_
"--",DEC XNUM,$d,$a]
[code]
Did you want me to TX/RX it ? modify and put on send and receive side ?
Dennis
You said you wanted three bytes, sometimes 8 bits can be as good. just thought you might see a use... splitting the byte up, multiple outputs on the same port... but if you need 23 then it will not help you this time.
Al was suggesting you only put the DEC on the RX side. That is why I thanked him for pointing out my mistake. I put a DEC on both in a couple of post.
Dave
Always wear safety glasses while programming.
Bookmarks