Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

setting a config in 16F877A

Status
Not open for further replies.
hi
today is my first time i connect my 877A
to my pickit2 , and now i need some help
on changing the config line the c code
here is the code
Code:
#include <system.h>

#pragma CLOCK_FREQ 4000000  // config clock to 4mhz.

// Set configuration fuse.

[COLOR="red"]#pragma DATA _CONFIG, _XT_OSC & _WDT_OFF & _CP_OFF & _PWRTE_OFF[/COLOR]

void main()
{
   trisb = 0;        //configure port B pins as output
   while( 1 )      //endless loop
   {
     portb.0=1;        // set portb pin0 to high.
     portb.1=0;        // set portb pin1 to low.
     delay_ms( 500 );  // pause 0.5 seconds
     portb=0x02;       // shows hex notation for entering data.
     delay_ms(500);    // you can also write portb=2 in decimal
   }
}
the red line is the thing i confused on
please help me ! :)
also ,
is 877A have internal clock ?
because i run out of crystal
 
Last edited:
hi,
No internal oscillator.
 

Attachments

  • AAesp01.gif
    AAesp01.gif
    66.7 KB · Views: 313
hi eric
what about if i using resistor for clock
as it shown on the attachment ?

hi,
You could do that, change that CONFIG to suit an RC osc.

EDIT:
 

Attachments

  • AAesp03.gif
    AAesp03.gif
    25.9 KB · Views: 265
Last edited:
hi,
Its just an output = Freq/4
 
so i need to set the the set clock to 4040000 , right ?

hi,
Unless you are doing something thats time critical, setting it at 4hHz would be ok, or as suggested change the PIC type.
 
Status
Not open for further replies.

Latest threads

Back
Top