I am working on a simulation project. It mean that I should only simulate this atmel project on proteus.
My project is a simple clock in timer 0- I have a atmega16 microcontroller and a character lcd.that resulte should me hour,minute,second howing on lcd.
I should use F_CPU once 2MHz and then 8MHz.
First I form my circuit in proteus then start to write my code in atmel studio by F_CPU=2 MHz . I calculate my register values in normal mode by N=256(cs00 and cs01). And I pressed F7 and then I ran it in proteus by double clicking on micro and choosing internal RC 2MHz and by use of its hex file. it worked well and correctly. Resulted Minute and hour and second was completely true and there was no error in code and simulation. And lcd showed correct and time was correct.
But when I change my F_CPU to 8MHz by typing F_cpu=8000000 and changing my calculation it didnt worked. I mean When I ran the simulating it didn’t worked. Lcd showed nothing or strange things showed. I choose micro frequency by double clicking on micro and choosing external 8MHz . but lcd shows strange things. I asked someone my problem.he said it is because of defining F_cpu for external oscillator in atmel. He mean that for only internal oscillator we write #define F_CPU 2000000 and for external we should type another code or define it by another way. I didn’t get his words.
Now My question is that why when I change 2MHz internal to 8MHz external (even internal) it doesn’t worked. My calculation is true. What I forget to do? What is wrong? How should I correct it.