Korawy
Member level 3
- Joined
- Sep 8, 2011
- Messages
- 61
- Helped
- 1
- Reputation
- 2
- Reaction score
- 1
- Trophy points
- 1,288
- Activity points
- 1,776
Hi all,,
im intending to control DC Motors with a wireless communication.
i bought KST_TX01 & KST_RX806 kit which is RF Module working with ~ 433 MHz, I have used two PICs for this, P16F628A recceiver and P18F452A Transmitter.
I tried to make a simple transmitter - receiver program to switch on a LED, But i get NOTHING.
I used Manchester Code library in mikroC as it is easier than calling a Timer.
This is the Transmitter Code:
void main(){
char ADD;
PCON.OSCF = 1;
TRISB.F0=0;
TRISB.F1=1;
TRISB.F2=0;
cmcon=7;
PORTB=0;
Man_Send_Config(&PORTB, 0);
Man_Send_Init(&PORTB);
ADD=0b10101010;
for(;{
if(PORTB.F1==0){
Man_Send(ADD);
delay_ms(17);
while(PORTB.F1==0){
Delay_ms(200);}}
}}
and This is the Receiver Code:
char Signal, error;
char x;
void main(){
TRISB.F6=1;
TRISB.F1=0;
TRISB.F2=0;
PORTB=0;
x=0;
Man_Receive_Config(&PORTB, 6);
loop1:
Man_Receive_Init(&PORTB);
for(;{
Signal = Man_receive(error);
if(error != 255){
if(Signal==0b10101010){PORTB.F1=1;}}
if(error==255){x++;}
if(x==200){
x=0;
PORTB.F2=1;
goto loop1;}}}
Just a simple Code to send one Byte, and when the receiver (P18F452) gets it , it powers on a LED.
Is there anything wrong with my Code?
Thanks in advance,,,
im intending to control DC Motors with a wireless communication.
i bought KST_TX01 & KST_RX806 kit which is RF Module working with ~ 433 MHz, I have used two PICs for this, P16F628A recceiver and P18F452A Transmitter.
I tried to make a simple transmitter - receiver program to switch on a LED, But i get NOTHING.
I used Manchester Code library in mikroC as it is easier than calling a Timer.
This is the Transmitter Code:
void main(){
char ADD;
PCON.OSCF = 1;
TRISB.F0=0;
TRISB.F1=1;
TRISB.F2=0;
cmcon=7;
PORTB=0;
Man_Send_Config(&PORTB, 0);
Man_Send_Init(&PORTB);
ADD=0b10101010;
for(;{
if(PORTB.F1==0){
Man_Send(ADD);
delay_ms(17);
while(PORTB.F1==0){
Delay_ms(200);}}
}}
and This is the Receiver Code:
char Signal, error;
char x;
void main(){
TRISB.F6=1;
TRISB.F1=0;
TRISB.F2=0;
PORTB=0;
x=0;
Man_Receive_Config(&PORTB, 6);
loop1:
Man_Receive_Init(&PORTB);
for(;{
Signal = Man_receive(error);
if(error != 255){
if(Signal==0b10101010){PORTB.F1=1;}}
if(error==255){x++;}
if(x==200){
x=0;
PORTB.F2=1;
goto loop1;}}}
Just a simple Code to send one Byte, and when the receiver (P18F452) gets it , it powers on a LED.
Is there anything wrong with my Code?
Thanks in advance,,,