need help for wireless transmition

Robtom8

New Member
im having a bit of a problem at the moment with sending information wirelessly to the reciver. i am just in the testing phase and i am trying to send a program from one breadbord to another, to see if it works. the program is:

main:

if pinc.2 = 1 then flash
goto main

flash:
high b.2
wait 2
low b.2
wait 2
high b.2
wait 2
low b.2
goto main

im not sure what to write for the reciver PIC program as i am using the AXE213 chip (http://www.picaxe.com/docs/axe213.pdf)
would i be able to have some help with sorting this out
 

hippy

Ex-Staff (retired)
Welcome to the PICAXE Forum.

The AXE213 / NKM2401 chips use a serial protocol and the AXE213 datasheets include example send and receive code.

A little better detail on what you are using and how you have things wired will help a lot.
 

Robtom8

New Member
i am trying to get an LED to flash or buzzer to make a noise at the reciever end when i press a push to make on the transmitter end, via the PIC and AXE123
 

SAborn

Senior Member
Not sure of what it is you are doing as the code makes no indication of sending or receiving serial data.

You need 1 lot of code for the transmitting picaxe and a second lot of code for the receiving picaxe.
Here is a very basic example of the 2 lots of code, you would need to load the top part of the code to the TX picaxe and bottom part to the RX picaxe. (also set the pin number in serout and serin)

Code:
'**********************************
'Transmitter code

b0 = 20

main:

if pinc.2 = 1 then TX
goto main

TX:

	serout PIN, N4800_4, ($aa, $aa, #b0)
	pause 500
	goto main


'**********************************
'Receiver code

Main:


RX:

	serin PIN, N4800_4, #b1
	
	if b1 = 20 then flash
	
	goto main
	
	
flash:
high b.2
wait 2
low b.2
wait 2
high b.2
wait 2
low b.2
goto main

'**********************************
Edit .. i dont know the AXE213 board so follow Hippys advice.
 
Last edited:

hippy

Ex-Staff (retired)
Note that the AXE213 / NKM2401 only sends data packets of 8 bytes, so shorter packets must be padded to 8 bytes, longer must be sent as multiple packets.

The principle of "start simple" applies to communications and particularly wireless communications where it can be difficult to tell what is wrong as everything must work to get the expected result.

Page 14 of the AXE213 datasheets shows the simplest transmission example to start with -

Code:
main:
  pause 500                         ; ensure ready to send
  serout B.7, N2400, ( "12345678" ) ; send eight bytes of data
  goto main                         ; repeat
Page 18, the simplest receive program -

Code:
main:
  serin C.7, n2400, b0,b1,b2,b3,b4,b5,b6,b7 ; read eight bytes of data into b0 to b7
  debug                                     ; show the data received in b0 to b7
  goto main                                 ; repeat
Get that working ( receiver debug screen showing "1" to "8" in b0 to b7 variables ) before moving onto anything more complicated.

Added : The AXE213 datasheet also has a section on "Quickstart Configuration and Testing" on pages 22 through 24. Following that guide should get things working.
 
Last edited:

Robtom8

New Member
ive sorted it out now that the LED does as told, however this is just testing for my project which is enabling my laptop to controll an RC boat and camera's onboard wirelessly:
heres the working code for the lights though:

transmitter
main:
if pinc.2 = 1 then send
goto main

send:
pause 500
serout b.1, n2400, ("12345678")
high b.2
wait 2
low b.2
wait 2
high b.2
wait 2
low b.2
goto main

reciever
main:
pause 500
serin c.7, n2400, b0,b1,b2,b3,b4,b5,b6,b7
debug
if b0 = 49 then flash
goto main

flash:
high b.3
wait 1
low b.3
wait 1
high b.3
wait 1
low b.3
wait 1
high b.3
wait 1
low b.3
wait 1
high b.3
wait 1
low b.3
wait 1
goto main

what sort of principle's/ ideas would you go about it with a motor
thanks for the advice in advance
 

hippy

Ex-Staff (retired)
Instead of sending "12345678" you can send variables, and if you put motor commands in one of those variables the other side will get the command sent and can then act on it.

Replace ...

serout b.1, n2400, ("12345678")

with

let b1="1"
serout b.1, n2400, ( b1, "2345678")

Then try with b1="2" ( include the double quotes ) and see how that works. Then get the receiver working when b1="2" is used. Hint, "1" is 49, and some quick aside research into ASCII character encoding may help.
 
Top