Internal oscillator configuration

Moderator: Benj

Post Reply
alaahima
Posts: 6
Joined: Fri Apr 11, 2014 12:54 pm
Has thanked: 3 times
Been thanked: 2 times
Contact:

Internal oscillator configuration

Post by alaahima »

I have an atmega32 , Its default frequency is 1 MHz , I created a simple flasher program , I configured the chip to run at 8 MHz from project settings , Thus I changed the clock speed from project options also to 8000000 Hz(8MHz) ... When I ran the hardware the delays were almost 10 times longer than they should.
What went wrong? , and can Flowcode change the default internal oscillator frequency? , and how does this affect delays and/or PWM? ... And if possible I would appreciate a 1 hz test flasher program configuring the chip to 8 MHz (internal).
Thanks in advance ... Cheers

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Internal oscillator configuration

Post by Benj »

Hello,

With a PIC the config data is embedded into the hex file and sent at the same time as programming. For AVR the config is loaded separate from the hex file containing the program. When you go to the project options and select configure you select your setting and then press ok. A small dialogue box should then pop up with the textual settings for the device config. Pressing the OK and Send button should allow the values to be transferred to the device.

Flowcode calculates delays based on the clock speed in the project options so for a 1s delay at 8MHz you essentially need a counter loaded with 8million and when this has counted down to 0 you know 1 second has passed. If instead your device is running at the default 1MHz then the delay will be miscalculated and take 8 times longer than it should.

alaahima
Posts: 6
Joined: Fri Apr 11, 2014 12:54 pm
Has thanked: 3 times
Been thanked: 2 times
Contact:

Re: Internal oscillator configuration

Post by alaahima »

Thanks for replying Benj... I seem to have a problem with the "ok & send" to the device part ... My programmer isn't familiar to Flowcode ... Is there any other method to alternate the configuration of the device itself? ... Thanks in advance bro

Post Reply