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.

18F4550 noob problem

Status
Not open for further replies.

Number17

New Member
This is the first time I worked with an 18F. I want to make the hello world project (flashing a LED).

I thought it would be easy just like a 16F chip, but its not. I've programmed the pic to flash a led at 4Hz but its way slower (about 0.5Hz).

I've checked that the oscillator is correct. I have tested the same program on a 16F and it worked fine. I've searched google, but all I can find is people with USB problems.

Code:
void main() {
LATA   = 0x00;
ADCON1 = 0x0f;
CMCON  = 0x07;
TRISA  = 0x00;

while(1){
PORTA = 0x01;
delay_ms(250);
PORTA = 0x00;
delay_ms(250);

}
}

I have disabled all the fuses and used the internal oscillator. When I measure RA6 I get a frequency of 250Khz.
 
You need to set the OSCCON =$72 so oscillator will run at full speed
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top