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.

PIC16F877A :serial communication problem

Status
Not open for further replies.

Moustafa

Newbie level 5
Newbie level 5
Joined
Nov 17, 2005
Messages
10
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,364
pic16f877a serial communication

dear all
I am using the pic 16f877a to make serial comm. with the PC via RS232
also i use MicroC c-compiler and the code as follows
when i tried the hyperterminal it does not receive any thing from PIC
the program is simple : send character from computer to PIC so PIC sends it back
i connected the
pin 25 :RC6 to pin 11 in max232
pin 25 :RC7 to pin 12 in max232
max232 :
Pin 13 to pin 3 in serial cable Tx
pin 14 to pin 2 in serial cable RX
Code:
unsigned short i;
void main(){
  Usart_Init(19200);
  Delay_ms(100);
   while(1){
           if (Usart_Data_Ready()) {   // If data is received
            i = Usart_Read();        // Read the received data
            Usart_Write(i);          // Send data via USART
            Delay_80us();
           }          
  }
}

can anyone help me in this problem ?
thanks
 

serial communication pic16f877a

What is the compiler you're using?
 

pic16f877a serial

it is microC from a compay callled mikroElektronika
 

micro c usart_write

Did you check the manual to see what actually is done inside Usart_Write() ? The reason I ask is it was not clear if that function check TMIF before writting to TXREG.
 

    Moustafa

    Points: 2
    Helpful Answer Positive Rating
usart_write

hi
check whether u connection b/w pic and pc are reversed or not first
 

    Moustafa

    Points: 2
    Helpful Answer Positive Rating
serial communication problem with pic16f877a

thanks
i checked the connection again and i know the problem , it was the serial cable connection : i use the male pin cnfiguration insted of the female to know the RX,TX,..
Did you check the manual to see what actually is done inside Usart_Write() ? The reason I ask is it was not clear if that function check TMIF before writting to TXREG
about the compiler i saw the generated assembly and it does that check.
thanks again for responses
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top