Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to communicate two pic controller with rf module?

Status
Not open for further replies.

manikandanshine

Full Member level 1
Full Member level 1
Joined
Aug 15, 2012
Messages
99
Helped
7
Reputation
14
Reaction score
7
Trophy points
1,298
Location
india
Activity points
1,809
Sir i am confused with rf tranmitting and receiving.can any one help me how to communicate two pic controller with rf module...........
Thank you in advance.i am using hitech c compiler.
 

Re: Pic16f877a+rf transmitter+rf receiver+pic16f877a

Here I have used Pic ccs c to program the 16f877a it is working
***receiver program ***
#include <16F877A.h>
#fuses XT,noWDT,NOPROTECT,NOBROWNOUT,NOLVP,NOPUT,NOWRT,NODEBUG,NOCPD
#use delay(clock=4000000)
#use rs232 (baud=2400, xmit=pin_C6, rcv=pin_C7,bits=9,stop=1,enable=pin_c0, parity=N,errors)
#use fast_io(b)

int16 test =0,al=0;

#int_rda // RX ucuna veri gelince meydane gelen kesme
void serihaberlesme_kesmesi ()
{
disable_interrupts(int_rda); // int_rda kesmesini pasif yap
al=getch();
}
void main()
{
setup_adc_ports(NO_ANALOGS); //ANALOG giriş yok
setup_adc(ADC_OFF); //ADC yok
setup_psp(PSP_DISABLED); //PSP birimi devre dışı
setup_timer_1(T1_DISABLED); //T1 zamanlayıcı devre dışı
setup_timer_2(T2_DISABLED,0,1); //PWM frekansı ayarlanması
setup_ccp1(CCP_OFF); //CCP1 birimi PWM çıkışı için ayarla
setup_ccp2(CCP_OFF); //CCP2 birimi PWM çıkışı için ayarla
set_tris_b(0x00);
output_b(0x00);
output_b(0xFF);
delay_ms(100);
output_b(0x00);
enable_interrupts(GLOBAL);
enable_interrupts(int_rda);
// Aktif edilen tüm kesmelere izin ver

while(true)
{

switch(al)
{
case 'A':
{
test =1;
output_b(test);
/* output_high(pin_c0);
delay_ms(50);
output_low(pin_c0); */
}
break;
case 'B':
{
test =2;
output_b(test);
output_high(pin_c0);
delay_ms(10);
output_low(pin_c0);
}
break;
case 'C':
{
test =3;
output_b(test);
output_high(pin_c0);
delay_ms(10);
output_low(pin_c0);
}
break;
case 'D':
{
test =4;
output_b(test);
output_high(pin_c0);
delay_ms(10);
output_low(pin_c0);
}
break;
case 'E':
{
test =5;
output_b(test);
output_high(pin_c0);
delay_ms(10);
output_low(pin_c0);
}
break;
case 'F':
{
test =6;
output_b(test);
output_high(pin_c0);
delay_ms(10);
output_low(pin_c0);
}
break;
case 'G':
{
test =7;
output_b(test);
output_high(pin_c0);
delay_ms(10);
output_low(pin_c0);
}
break;
case 'H':
{
test =8;
output_b(test);
output_high(pin_c0);
delay_ms(10);
output_low(pin_c0);
}
case 'I':
{
test =9;
output_b(test);
output_high(pin_c0);
delay_ms(10);
output_low(pin_c0);
}
break;

}
enable_interrupts(int_rda); // int_rda kesmesi aktif
}
}


And
***transmitter program ***
#include <16F877A.h>
#FUSES NOWDT //No Watch Dog Timer
#FUSES XT //Crystal osc <= 4mhz for PCM/PCH , 3mhz to 10 mhz for PCD
#FUSES NOPUT //No Power Up Timer
#FUSES NOPROTECT //Code not protected from reading
#FUSES BROWNOUT //Reset when brownout detected
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOCPD //No EE protection
#FUSES NOWRT //Program memory not write protected
#FUSES NODEBUG //No Debug mode for ICD //No EE protection

#use delay(clock=4000000)
#use rs232 (baud=2400, xmit=pin_C6, rcv=pin_C7,enable=pin_c0,bits=9, parity=N,stop=1)
#use fast_io(a)
#use fast_io(e)

int16 ver,test=0;
void gonder() // alıcı uyandırma kodları
{
putc(0x55);
putc(0x55);
putc(0x55);
putc(0x55);
putc(0x55);
putc(0x00);
putc(0x00);
putc(0x00);
putc(0x00);
putc(0x00);
putc(0xFF);
putc(0xFF);
putc(0xFF);
putc(0xFF);
putc(0xFF);
putc(ver); //alıcıya ver değişkeni içindeki bilgi gönderiliyor
}
void main()
{
setup_psp(PSP_DISABLED);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_vref(FALSE);
setup_adc_ports(NO_ANALOGS); //ANALOG giriş yok
setup_adc(ADC_OFF); // ANALOG giriş yok
setup_psp(PSP_DISABLED); //PSP birimi devre dışı
setup_ccp1(CCP_OFF); //CCP1 birimi PWM çıkışı için ayarla
setup_ccp2(CCP_OFF); //CCP1 birimi PWM çıkışı için ayarla
set_tris_a(0xFF);
set_tris_e(0b111);
output_a(0xFF);
output_e(0b111);
output_b(0xFF);
delay_ms(500);
output_b(0x00);
while(true)
{
//
if(!input(pin_a0))
{
test=1;
delay_ms(10);
while(!input(pin_a0));
ver='A';
gonder();
}
//
if(!input(pin_a1))
{
test=1;
delay_ms(10);
while(!input(pin_a1));
ver='B';
gonder();
/* output_high(pin_c0);
delay_ms(500);
output_low(pin_c0);*/
}
//
if(!input(pin_a2))
{
test=1;
delay_ms(10);
while(!input(pin_a2));
ver='C';
gonder();

}
//
if(!input(pin_a3))
{
test=1;
delay_ms(10);
while(!input(pin_a3));
ver='D';
gonder();
}
//
if(!input(pin_a4))
{
test=1;
delay_ms(10);
while(!input(pin_a4));
ver='E';
gonder();
}
//
if(!input(pin_a5))
{
test=1;
delay_ms(10);
while(!input(pin_a5));
ver='F';
gonder();
}
//
if(!input(pin_e0))
{
test=1;
delay_ms(10);
while(!input(pin_e0));
ver='G';
gonder();
}
//
if(!input(pin_e1))
{
test=1;
delay_ms(10);
while(!input(pin_e1));
ver='H';
gonder();
}
//
if(!input(pin_e2))
{
test=1;
delay_ms(10);
while(!input(pin_e2));
ver='I';
gonder();
}
}
}
 
Re: Pic16f877a+rf transmitter+rf receiver+pic16f877a

Please, Can you post this circuit for code? Thank for your share!
email: quangdien0301@gmail.com
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top