xpress_embedo
Advanced Member level 4

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...

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.
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...

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.