burrow
Full Member level 2
Hai,
I am not able to make UART module of PIC12F1840 work, I have tried all possible way outs.But it simply doesnt seem to work.. I have attached my code below
I am using internal clock set to 32.000 Mhz
I am not able to make UART module of PIC12F1840 work, I have tried all possible way outs.But it simply doesnt seem to work.. I have attached my code below
Code:
void main() {
TRISA.TRISA0=0;
TRISA.TRISA1=1;
ANSELA=0;
ANSELA.ANSA0=0;
ANSELA.ANSA1=0;
OPTION_REG.TMR0CS=0;
OPTION_REG.PSA=0;
OPTION_REG.PS2=1;
OPTION_REG.PS1=1;
OPTION_REG.PS0=1;
APFCON.TXCKSEL=0;
ADCON0.ADON=0;
DACCON0.DACEN =0;
SRCON0.SRLEN=0;
CM1CON0.C1ON=0;
MDCON.MDEN=0;
TXSTA.SYNC=0;
TXSTA.TXEN=1;
TXSTA.BRGH=0;
RCSTA.SPEN=1;
TXSTA.TX9=0 ;
BAUDCON.BRG16=1;
SPBRG=207;
UART1_Init(9600); // initialize UART1 module
Delay_ms(100);
while(1)
{
UART1_WRITE_TEXT("hello");
Delay_ms(100);
}
}
I am using internal clock set to 32.000 Mhz