HELLO ...
I HAVE A PROBLEM ABOUT RF PROGRAMMING
I have a project about RF using PIC16F877A n mikroc compiler..
My project is about RF control switch... n have done my coding.. in mikroc compiler.. .. after compile.. all the codes are able to succsecssfully compiled...
but,.. the problem is , when i simulte in PROTEUS software... i dont know whats the problem.. CAN U HELP ME SIR>>.. is it about the programming part...
Here i attach my coding on Tx n Rx.. and alsoo the circuit basic structure.. This is just a testing for 2input button.. 2LED output.. using RF....
CAN U CHECK ON MY PROGRAMMING>>>
REALLY APPRECIATED IT.... THANKS>.
/////////////////////////// TX coding /////////////////////////////////
// Manchester module connections
sbit MANRXPIN at RC7_bit;
sbit MANRXPIN_Direction at TRISC7_bit;
sbit MANTXPIN at RC6_bit;
sbit MANTXPIN_Direction at TRISC6_bit;
// End Manchester module connections
int i=0;
void main()
{
Man_Send_Init(); // Initialize transmitter
TRISC=0;
TRISD=0B11111111;
//Man_Send_Config (&PORTC,0);
do{ Man_Send(0xC3); Delay_ms(10); i++; } while(i<10); //the same data 10 times for sync.
while(1) //this is prototype with only two buttons
{
if((PORTD.f0==1)&&(PORTD.f1==0) ) // to be sure that one button is pressed
{ Man_Send(0x3e); delay_ms(10); }
if((PORTD.f0==0)&&(PORTD.f1==1) )
{ Man_Send(0x3f); delay_ms(10);}
if((PORTD.f0==1)&&(PORTD.f1==1) )
{ Man_Send(0x3a); delay_ms(10); }
if((PORTD.f0==0)&&(PORTD.f1==0) ) //if no button is pressed
{ Man_Send(0xFC); delay_ms(10); }
}
}
////////////////////////RX coding//////////////////////////////////
// Manchester module connections
sbit MANRXPIN at RC7_bit;
sbit MANRXPIN_Direction at TRISC7_bit;
sbit MANTXPIN at RC6_bit;
sbit MANTXPIN_Direction at TRISC6_bit;
// End Manchester module connections
unsigned char error = 0, ErrorCount = 0, temp = 0;
//short fork,poy,spoon;
void main()
{
TRISC=0B11111111; //CIRCUIT IS RX.
TRISB=0;
PORTB=0;
//Man_Receive_Config (&PORTC,6);
while(1)
{
GET_BYTE:
temp = Man_Receive(&error); // Attempt byte receive
if (error != 0) goto ERROR_BYTE; // if comm's error goto error handler
if(temp==0xc3)
{
PORTB.F6 = 1; goto DISPLAY_BYTE;
} //light successfull sync. led
ERROR_BYTE:
PORTB.F7 = 1; // light error led
ErrorCount++; // Update error counter
if(ErrorCount > 5)
{
TRISC7_bit; ErrorCount=0;
}
goto GET_BYTE;
DISPLAY_BYTE:
do
{
temp = Man_Receive(&error); // Attempt byte receive
if (error!= 0)
{
TRISC7_bit;
}
if (temp == 0x3e) PORTB.F0 = 1;
if (temp == 0x3f) PORTB.F1 = 1;
if (temp == 0x3a) { PORTB=0B00000011; } // in case two buttons are pressed
}
while (temp != 0xFC);
goto STOP_BYTE;
STOP_BYTE:
if (temp == 0xFC)
{
PORTB=0B01000000;
}
goto DISPLAY_BYTE;
}
}
My Attachments