Cheetos
Member level 3

hello, i am new in using the USART library of PIC16F877A. i would just like to know if my PIC will be able to receive a data with this code. my all of pins in PORTB will turn on once i received a data. I have set i as the variable i needed. i need i be equal to 1 so that PORTB will turn on. if not equal to 1 then PORTB will turn off
void main(){
float i;
PORTB=0x00;
TRISB=0x00;
PORTC=0;
TRISC=0x03;
while(1){
Usart_Init(9600);
if(Usart_Data_Ready()){
i=Usart_Read();
if(i==1){
PORTB=0xFF;
}
if(i==0){
PORTB=0x00;
}
}
}
}
void main(){
float i;
PORTB=0x00;
TRISB=0x00;
PORTC=0;
TRISC=0x03;
while(1){
Usart_Init(9600);
if(Usart_Data_Ready()){
i=Usart_Read();
if(i==1){
PORTB=0xFF;
}
if(i==0){
PORTB=0x00;
}
}
}
}