PDA

View Full Version : rf problem



-Dan-
- 20th November 2007, 14:00
HI

i'm using the

AM-RT4-433 - 433mhz Am transmitter module and the
AM-HRR3-433 - 433mhz am receiver

i am experimenting with sending data wirelessly from one pic to another,
but i do not receive anything on the receive end when using these am modules.





serout2 portb.1,n2400,[$55,$55,$60,transmit_data]

serin2 portb.0,n2400,[wait($60),data_received]



above are extract's from my transmit and receive code, there how i'm transmitting and receiving, this works via a wire link but not with these modules?

am i missing something, do i have to change anything if my data is being sent wirelessly

Thanks.

mister_e
- 20th November 2007, 14:39
If you're using 1 PIC, your example is not going to work as it can't receive at the same time he send. Using the PIC hardware Usart may work with some tricks such as USART interrupt.

As always, your PIC # and schematic would be welcome ;)

Make sure your module are not to close from each other, your supply lines are clean/noise free, and the output signal of your receiver is also noise free in idle mode.

-Dan-
- 20th November 2007, 14:45
sorry if i worded my post wrong, i am using 2 pic's one to transmit, and one to receive.

it works with a direct link between the two mcu's

and i'm using the good old 16f84a just wanted to start off simple


transmitter code



include "modedefs.bas"



'transmitter on portb.1

trisb.1=0

transmit_data var byte
restart_counter var byte

restart_counter=0

init:

pause500
lcdout "Serial"
lcdout $fe,$c0, "Transmitter"
pause 1000
main:

for transmit_data=0 to 100
serout2 portb.1,n2400,[$55,$55,$60,transmit_data]
pause 500
lcdout $fe,1
lcdout "Transmitting"
lcdout $fe,$c0,dec3 transmit_data, " "
if transmit_data=100 then restart_timer
next transmit_data
goto main


restart_timer:
pause 500
lcdout $fe,1 ' clear lcd
for restart_counter=0 to 10
lcdout "Data sent"
lcdout $fe,$c0, "restart in10:",dec2 restart_counter," "
pause 500
if restart_counter=10 then main
next restart_counter
goto restart_timer



receiver code




include "modedefs.bas"

'receiver on portb.0

trisb.0=1

data_received var byte

data_received=0

init:
pause500
lcdout "Serial Data"
lcdout $fe,$c0, "Receiver"
pause 1000

lcdout $fe,1
lcdout "Waiting For"
lcdout $fe,$c0, "Data"


main:
serin2 portb.0,n2400,[wait($60),data_received]
pause 500
lcdout $fe,1 ' clear lcd
lcdout "Receiving Data"
lcdout $fe,$c0,dec3 data_received," "
goto main

mister_e
- 20th November 2007, 14:47
out of curiosity, what happen if you use T2400 instead?

which PIC?

How far away your RF modules are ?

Are they sharing the same psu?

-Dan-
- 20th November 2007, 14:53
out of curiosity, what happen if you use T2400 instead?

which PIC?

How far away your RF modules are ?

Are they sharing the same psu?

its a good old 16f84


i shall try t2400 now

i have my transmit setup - pic on one breadboard/ transmitter module on another connected up to each other

same with receive, the transmit and receive part are not close to each other, tried them close and far still no result

the transmit and receive side are individually powered with a 9v battery using a 5v voltage regulator

Bruce
- 20th November 2007, 15:01
You're using the wrong serial mode numbers for SERIN2/SEROUT2.

Drop the include modedefs.bas and use something like N2400 CON 16780.

-Dan-
- 20th November 2007, 15:14
You're using the wrong serial mode numbers for SERIN2/SEROUT2.

Drop the include modedefs.bas and use something like N2400 CON 16780.

bruce, i cannot thank you enough

this has been annoying me for ages

:D

mister_e
- 20th November 2007, 15:15
oops... missed that...
STRONG AND BLACK COFFEE TIME!

-Dan-
- 20th November 2007, 15:19
just looked up serin2 in the manual

oops
i thought modes were the same as serin when there ermm not..

newbie mistakes..

but at least i learnt from it :)


another thing that it fixed..

i was having strange timing issues to and that simple change fixed it

Bruce
- 20th November 2007, 16:05
Hey! I learn more from my mistakes than anything else. And those lessons are the easiest
ones to remember.

But, like mister-e has pointed out, I am getting old so I jot things down so I don't
forget...;o}