In this project we have used two types of different R.F Module like 433Mhz and 315Mhz Interface into Pic16f877a,HT640 for R.F Encoder,HT648 for R.F Decoder Ic’s.Hence in this we have touse two sensors one is for temperature sensor LM35, another one is potentiometer, the two sensors have an output of analog signal so that analog signal is fed into to two adc channel of pic16f877a and the corresponding digital output is get from the serial port, continuously watching the real time parameter monitoring purposes.
one of the important factor for using 2 adc channel of pic16f877a in the coding section delay_us(100) is very very important. Do u have any project for using 1 more channel of adc using 100 Micro sec delay is must,
in this project using 2 different R.F frequencies,but data is collide each other so in the programming section we have to use R.F Encoder,Decoder connected port must be zero after getting the data,and one more thing if u use more R.F module in the same frequency is it possible to use bc547 transistor for R.F transmitter section to bc547 like as a switch to cut the r.f transmitter voltage, through the coding part is it possible.
R.F TRANSMITTER C CODE:
#include<16f877a.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=20000000)
#use rs232(baud=1200,xmit=PIN_C6,rcv=PIN_C7)
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=20000000)
#use rs232(baud=1200,xmit=PIN_C6,rcv=PIN_C7)
void main()
{
unsigned char trim=0,temp=0;
setup_port_a( ALL_ANALOG );
setup_adc( ADC_CLOCK_INTERNAL );
printf(” NODE1 is Initialising\r\n”);
printf(” NODE1 is Communicating wait……..\r\n”);
printf(” Network NODE2 is Initialising\r\n”);
printf(” Network NODE2 is Communicating wait……..\r\n”);
while(1)
{
set_adc_channel( 0 );
delay_us(100);
trim=read_adc();
output_b(trim);
printf(”trim pot=%u\r\n”,trim);
set_adc_channel( 1 );
delay_us(100);
temp=read_adc();
output_c(temp);
printf(”temp sensor=%u\r\n”,temp);
}
}
{
unsigned char trim=0,temp=0;
setup_port_a( ALL_ANALOG );
setup_adc( ADC_CLOCK_INTERNAL );
printf(” NODE1 is Initialising\r\n”);
printf(” NODE1 is Communicating wait……..\r\n”);
printf(” Network NODE2 is Initialising\r\n”);
printf(” Network NODE2 is Communicating wait……..\r\n”);
while(1)
{
set_adc_channel( 0 );
delay_us(100);
trim=read_adc();
output_b(trim);
printf(”trim pot=%u\r\n”,trim);
set_adc_channel( 1 );
delay_us(100);
temp=read_adc();
output_c(temp);
printf(”temp sensor=%u\r\n”,temp);
}
}
R.F RECEIVER C CODE:
#include<16f877a.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=20000000)
#use rs232(baud=1200,xmit=PIN_C6,rcv=PIN_C7)
float lm35=0;
unsigned char pot=0;
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=20000000)
#use rs232(baud=1200,xmit=PIN_C6,rcv=PIN_C7)
float lm35=0;
unsigned char pot=0;
void main()
{
printf(”WIRELESS TRANSMISSION \r\n”);
delay_ms(1000);
printf(”NODE1 is Initializing\r\n”);
delay_ms(200);
printf(”NODE1 is Communicating wait……..\r\n”);
delay_ms(200);
printf(”NODE2 is Initializing\r\n”);
delay_ms(200);
printf(”NODE1 is Communicating wait……..\r\n”);
delay_ms(200);
while(1)
{
{
printf(”WIRELESS TRANSMISSION \r\n”);
delay_ms(1000);
printf(”NODE1 is Initializing\r\n”);
delay_ms(200);
printf(”NODE1 is Communicating wait……..\r\n”);
delay_ms(200);
printf(”NODE2 is Initializing\r\n”);
delay_ms(200);
printf(”NODE1 is Communicating wait……..\r\n”);
delay_ms(200);
while(1)
{
pot=input_b();
printf(”trim_pot value is=%u\r\n\n”,pot);
printf(”trim_pot value is=%u\r\n\n”,pot);
if(pot<=2)
{
printf("Node 1 is stop communicating\r\n");
}
if(pot>=254)
{
printf(”Avoid Data Collision between Node1 and Node2 zero to port B \r\n”);
}
{
printf("Node 1 is stop communicating\r\n");
}
if(pot>=254)
{
printf(”Avoid Data Collision between Node1 and Node2 zero to port B \r\n”);
}
output_b(0×00);
delay_ms(1000);
lm35=input_c();
lm35/=8;
if(lm35>=27)
{
printf(”L35 temp value is=%2.1f\r\n\n”,lm35);
}
if(lm35<27)
{
printf(”Node 2 is stop communicating\r\n”);
lm35=0;
delay_ms(1000);
lm35=input_c();
lm35/=8;
if(lm35>=27)
{
printf(”L35 temp value is=%2.1f\r\n\n”,lm35);
}
if(lm35<27)
{
printf(”Node 2 is stop communicating\r\n”);
lm35=0;
}
delay_ms(500);
output_b(0×00);
output_c(0×00);
output_b(0×00);
output_c(0×00);
}
}
No comments:
Post a Comment