:? Hey anybody…I’m kinda new at the whole uC programing thing and only know a little Basic. I was just wondering how (if possible) I could use a PICAXE controler (8/18 pin, whatever) to transmit/recieve data from the RF links SFE sells under their “General Wireless” category… :oops: and if it’s not too much to ask, if somebody could send me transmitter/receiver codes…thanks - I appreciate it.
For simple data transmission, it is really easy to do with the PICAXE. Here is some sample code that works on the 08M…
TX
' Transmit a byte of data using Pin 4 at 300 baud
' Send four preamble bytes to allow receiver to stabilize
' then send a sync sequence ("XYZ" in this case) followed by the data
serout 4,n300,(85,85,85,85,"XYZ",data)
RX
' Receive a byte of data using Pin 3 at 300 baud
' Wait for sync sequence ("XYZ") and then receive the data
serin 3,n300,("XYZ",data),data
All of the discussions on this forum regarding data bit balancing (one way is to send the data byte followed by its complement) is relevant as well. However, the PICAXE is using a software UART and is less picky about the input. This code should get you started.
Thanks for your speedy reply, and that code really helps me a lot. You’ve saved me a lot of trouble.
I think I get it…mostly. But what about the “data” tag in the code(s)? Am I supposed to use the “data” command (it dosn’t seem to be working) or are you saying that that’s where I should put the data I want to send (like a variable “b1” or something)? ```
serout 4, n300, (85, 85, 85, 85, “xyz”, data)
or can I use ```
serout 4, n300, (85, 85, 85, 85, "xyz", b1)
with a similar setup for the RX.
Can you/anybody clarify please? Thanks a lot.
Oh, and also…I assume the “xyz” sync can be any string I really want, right? And what about the "85"s - is that of any significance, or can I use any 4 bits?
Much obliged!
‘data’ is supposed to represent the information being sent. It is just a name of a variable (byte), and can be whatever you wish it to be. The identifier tag (“xyz”) can also be whatever you want it to be. 85 decimal is 55 hex, and was chosen for the alternating 0 and 1 bit pattern, which gives the receiver time to adjust its sensitivity.
Awesome - thanks again. You’ve been a big help…