Continue to Site

[SOLVED] Serial Communication with PIC16F877A??

Status
Not open for further replies.

xpress_embedo

Advanced Member level 4
Advanced Member level 4
Joined
Jul 5, 2011
Messages
1,154
Helped
161
Reputation
396
Reaction score
189
Trophy points
1,353
Location
India
Activity points
10,591
Hello!! I am new in Micro-Controller's Programming.. and i am using PIC16F877A to start my journey in the field on Micro-Controller's??
But i stuck when trying to interface my PIC16F877A for Serial Communication???
I am using MPLAB IDE along with Hi-Tech C Compiler to Send Data from Controller to Hyper-Terminal, but i am getting redundant data when i simulate this in Proteus ISIS.
Here is my Code..

#include<htc.h>
#define _XTAL_FREQ 4000000
void main()
{
TXSTA = 0x20; //Enable the transmit enable bit
SPBRG = 0x06; //9600 Baud Rate with 4MHz Crystal
TXSTAbits.TXEN = 1;
RCSTAbits.SPEN = 1;
while(1)
{
TXREG = 'A';
__delay_ms(100);
while(PIR1bits.TXIF == 0);
PIR1bits.TXIF = 0;
}
}


But i am not getting A in the Virtual Terminal of Proteus ISIS.

Here is what i am getting...
Diode.PNG

help me.. Thanks in Advance....

The help must be in Hi-tech C Code Format...
and pls try to explain in simple format because i am new in the field of controllers.
 

Okay I will do that and thanks for this...
But the site you mentioned gives me a already built function to communicate with serial port..
But i want to build my own... can you tell me what is the fault in my code...
as i am getting redundant data on my virtual terminal
 

My Problem Gets Solved its due to the Baud Rate issue in Proteus and i don't know about the real time..
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top