I M USING INTERNAL OSCILATOR TO SEND DATA FROM PIC 18F4550 TO HYPERTERMINAL .BUT GETTING GARBAGE VALUE.
I CAME TO KNOW THE BAUDRATE PROBLEM.
I CHECKED IT MANY TIMES BUT DIDN,T FIND SOLUTION.
I M DOING IN THIS WAY
#include<p18f4550.h>
#pragma CONFIG WDT = OFF ; Disable watchdog timer
#pragma CONFIG DEBUG = ON ; Enable Debug Mode
#pragma CONFIG LVP = OFF ; Low-Voltage programming disabled (necessary for debugging)
#pragma CONFIG FOSC = INTOSC:USB-HS ; Internal oscillator, port function on RA6
void main (void)
{
TRISCbits.TRISC6=0;
///////////////////////////////////// USING INTERNAL OSCILATOR ///////////////
OSCCON=0x72; // 8MHZ
//////////////////////////// setting baud rate ////////////////////////////////////////
//CONFIG1H=0xC;
//CONFIG1L=0x4;
SPBRG =51; // BAUDRATE SET TO 2400
BAUDCONbits.BRG16=0;
////////////////////////// setting transmit control register ///////////////////////////
TXSTAbits.SYNC= 0; // ASYNCHRONOUS MODE
TXSTAbits.TX9 =0;
TXSTAbits.TXEN= 1;
TXSTAbits.BRGH=0;
/////////////////////////// SETTING RECIEVE control register ///////////////////////////
RCSTAbits.SPEN=1;
RCSTAbits.CREN=1;
TXREG='B';
while(PIR1bits.TXIF==0);
}
PLZZZ HELP ME ............................
I CAME TO KNOW THE BAUDRATE PROBLEM.
I CHECKED IT MANY TIMES BUT DIDN,T FIND SOLUTION.
I M DOING IN THIS WAY
#include<p18f4550.h>
#pragma CONFIG WDT = OFF ; Disable watchdog timer
#pragma CONFIG DEBUG = ON ; Enable Debug Mode
#pragma CONFIG LVP = OFF ; Low-Voltage programming disabled (necessary for debugging)
#pragma CONFIG FOSC = INTOSC:USB-HS ; Internal oscillator, port function on RA6
void main (void)
{
TRISCbits.TRISC6=0;
///////////////////////////////////// USING INTERNAL OSCILATOR ///////////////
OSCCON=0x72; // 8MHZ
//////////////////////////// setting baud rate ////////////////////////////////////////
//CONFIG1H=0xC;
//CONFIG1L=0x4;
SPBRG =51; // BAUDRATE SET TO 2400
BAUDCONbits.BRG16=0;
////////////////////////// setting transmit control register ///////////////////////////
TXSTAbits.SYNC= 0; // ASYNCHRONOUS MODE
TXSTAbits.TX9 =0;
TXSTAbits.TXEN= 1;
TXSTAbits.BRGH=0;
/////////////////////////// SETTING RECIEVE control register ///////////////////////////
RCSTAbits.SPEN=1;
RCSTAbits.CREN=1;
TXREG='B';
while(PIR1bits.TXIF==0);
}
PLZZZ HELP ME ............................