tomas
Member level 1
I have 2 schematics. First is pic16f877 with pushbutton and rf transmitter, and other shematic is pic16f877 with LED and rf receiver.
my code for transmitter:
code for receiver:
I have those two circuits connected in reality, but this code didn't work. It should transmit signal when I press button which connected to portB pin 0 and LED on receiver portB pin 0 should be on.
Can anyone help me with code? ;/
my code for transmitter:
Code:
void main()
{
TRISB.F0 = 0xFF;
PORTB.F0 = 0;
UART1_Init(2400); // Initialize UART module at 9600bps
Delay_ms(100); // Wait for UART module to stabilize
while (1)
{ // Endless loop
UART1_Write(PORTB); // and send data via UART
Delay_ms(500);
}
}
code for receiver:
Code:
void main()
{
TRISB = 0;
PORTB = 0;
UART1_Init(2400); // Initialize UART module at 9600bps
Delay_ms(100); // Wait for UART module to stabilize
while (1)
{ // Endless loop
if (UART1_Data_Ready())
{ // If data is received,
PORTB = UART1_Read(); // read the received data,
}
}
}
I have those two circuits connected in reality, but this code didn't work. It should transmit signal when I press button which connected to portB pin 0 and LED on receiver portB pin 0 should be on.
Can anyone help me with code? ;/