[SOLVED] pic 16f1824 problem with internal oscillator

Status
Not open for further replies.
Yes. From the configuration settings you can select when you press Ctrl + Shift + E.
 

void main()
{

OSCCON=0x72;
ANSELA=0;
delay_ms(500);
UART1_Init(9600) ;

TXCKSEL_bit=1;
TRISA0_bit=0;
ANSELC=0x00;
TRISC0_bit=0;

delay_ms(2000);





while (1)
{
UART1_Write('A');
RC0_bit=1;
delay_ms(1000);
RC0_bit=0;
delay_ms(1000);


} }




this is the code used to test usart...but nothing write in the terminal..but the pin is toggling
 

this is the rar file containing the project

- - - Updated - - -

TXCKSEL_bit=1
this is bit in the APFCON0 Register
 

Attachments

  • pjcttest.rar
    735 bytes · Views: 92

Disable the comparators and the capacitive sensing module:
Code:
CM1CON0 = 0;
CM2CON0 = 0;
CPSON_bit = 0;

Does the program run with external oscillator?

- - - Updated - - -

Change value of OSCCON to 0x70.
 

Disable the comparators and the capacitive sensing module:
Code:
CM1CON0 = 0;
CM2CON0 = 0;
CPSON_bit = 0;

Does the program run with external oscillator?

- - - Updated - - -

Change value of OSCCON to 0x70.

OSCCON0=0X70 makes delay verly large.i dont have option to test with external oscillator
 

Try with this code:
Code:
    void main()
    {
    OSCCON=0x72;
    ANSELA=0;
    TRISA0_bit=0;
    
    TXCKSEL_bit=1;
    RXDTSEL_bit=1;
    //UART1_Init(9600);

    SPBRGH = 0;
    SPBRGL = 12;
    BRGH_bit = 0;
    BRG16_bit = 0;
    SYNC_bit = 0;
    SPEN_bit = 1;
    TX9_bit = 0;
    TXEN_bit = 1;
    
    delay_ms(500) ;

    CPSON_bit=0;
    C1ON_bit=0;
    GIE_bit=0;

    TRISA1_bit=1;
    TRISC5_bit=0;


    TRISC4_bit=1;


    // initialize UART1 module


    while (1)
    {
    TXREG = 'A';
    RC0_bit=1;
    delay_ms(1000);
    RC0_bit=0;
    delay_ms(1000);

    } }

 

no tahmid its not working....
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…