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.

what is wrong with my code

Status
Not open for further replies.

bloke203

Member level 1
Joined
Jan 20, 2010
Messages
33
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,288
Location
UK
Activity points
1,578
I am trying to send and receive data using PIC16F877, MAX232 and Hyperterminal. Can you suggest me the soultion of it?

void main( )

{
unsigned short i;
PORTA = 0;
PORTC = 0;
PORTB = 0;
TRISA = 0X01;
TRISB = 0X0;
TRISC = 0X80;


// Initialize USART module (8 bit, 2400 baud rate, no parity bit..)
Usart_Init(9600);

do {

TXSTA.SPEN =1;
if (Usart_Data_Ready()) { // If data is received
i = Usart_Read(); // Read the received data
PORTB = 0X04;
// delay_us(150);
Usart_Write(i); // Send data via USART

PORTA = 0X01;
}
}while (1);


}


// I am using mikro C compiler.

Anykind of help will be appreciated

Thanks

Regards

bloke203
 

Your question is not proper.

1. No defination for Usart_Read() & Usart_init().
2. Are you using this function externaly? No header file included.

Regards
Chanchal
 

Thanks for the reply.

But Usart_read and other bits are coming from mikro C library itself. I am trying to send a character through Hypt terminal and want to receive the same data back to my Hyper terminal.

My program compile fines. It compiles fine. It doesn't give any error. When I dwnld its hex file into my PIC16F877 then it doesn't give me any character back to my hyper terminal.

Pls help me
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top