RF and TX pacakges With prop
Andy "A Man With A Plan"
Posts: 45
I have used the RF and TX pagcakge with the bs2 and was able to make a lot of cool projects. I would like to keep this going with the propeller but do not know hot to start. I like using the BS2. Commands but have no knowledge of how to get the highbyte and lowbyte needed to get the message sent and received. Any help is greatly appreciated.
-andy
-andy
Comments
Let's say you have a byte variable called 'b'
To extract the low nibble, use (b&15)
To extract the high nibble, use (b>>4)
That's pretty easy, isn't it?
To set the high nibble of b to the value of 'h':
b := (b & 15) | (h << 4)
To set the low nibble of b to the value of 'h':
b := (b & $f0) | h
Hope this helps,
Bill
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Please use mikronauts _at_ gmail _dot_ com to contact me off-forum, my PM is almost totally full
Morpheus & Mem+dual Prop SBC w/ 512KB kit $119.95, 2MB memory IO board kit $89.95, both kits $189.95
www.mikronauts.com - my site 6.250MHz custom Crystals for running Propellers at 100MHz
Las - Large model assembler for the Propeller Largos - a feature full nano operating system for the Propeller
as you are using the propeller, I would like to invite you learning SPIN.
If you can post an example of the data-traffic like it is send and received
I can post SPIN-code how to do that in SPIN.
Once you know how do this in SPIN I promise you never want to go back to Basic
because in SPIN you have much more possabilities to do more complex things
Basic has a lot of limitations.
best regards
Stefan
Post Edited (StefanL38) : 9/17/2009 2:17:48 PM GMT
I am working on the propeller and get mixed up in all of the new commands. I have attached the TX and Rx code that I would like to use with the propeller [noparse]:)[/noparse] Thanks again for all the help!!
Sincerely,
Andy
in the attachement you will find SPIN-code for send and receive bytes and sending strings
you can test it with the PST.EXE (Parallax Serial Terminal)
So you just need your propeller and nothing else
The code also shows some techniques how to use serial output over the prop-plug for debugging
Play around with this code and come back with new questions
best regards
Stefan
-andy
The files works. I copied the following, from inside it:
Sometimes when you download the extension for the file name changes . It should have .zip on the end. If it changes to something else or it doesn't have an extension just rename or add it.
If you can't unzip it and the extension is ok, just Google for a free unzip program.
Post Edited (Bob Lawrence (VE1RLL)) : 9/21/2009 3:52:01 AM GMT
First [noparse][[/noparse]and forgive if this is really a Noob question] Why is the highbyte multiplied by 256?
Second, To transmit the data from the tilt sensor [noparse][[/noparse]when I move to a Propeller based transmitter] do I just do the same only in reverse? What would that code look like?
Third Parallax sent me the following code. How does this fit into the picture since I have their Wireless Remote for Boe -Bot Kit and want to control my Propeller based robot?
Post Edited (TheGrue) : 9/21/2009 11:43:32 PM GMT
you will be astonished to read this but YOU are GREAT !
Because of my more or less advanced or "expert" state in programming I would have never searched for
a syntax like you received it from parallax.
So forget about my previous code ! Compared to "x.byte[noparse][[/noparse] 0 ] etc." my previous code is "from the back behind through the chest into the eye"
You can use the syntax "x.byte[noparse][[/noparse] 0 ]" etc. for both sending and receiving
to explain the * 256:
One byte is 8 bit. With 8 bit you can count from 0 to 2^8 - 1 = 256 - 1 = 255. (count from 0 to 255)
If you have a word variable which has 16 bit (= 2 bytes)
The upper 8 bits (=HIGHBYTE) contain a part of the value and the lower 8 bites (=LOWBYTE)
this works this way
I took a quick look at wikepedia
In this case my opinion is the explaining on wikipedia isn't very good
Also some of the links at the end of the article are complicated to read
this one seems to be Ok Binary Digits
But you can play araound and learn it with the propeller !
The FullDuplexSerialPlus-object has methods "dec", bin", "hex" which outputs values in decimal, binary, or hexadecimal digits
best regards
Stefan
Post Edited (StefanL38) : 9/21/2009 6:43:55 AM GMT