ashishvdeshpande
Newbie level 6
While creating codevisionavr project uC clock frequency is configured. How we can change this frequency in .c/.h file without creating new project.
I have C program which is created for 16MHz frequency if I run it with 8MHz then I won't get proper serial output also delay function won't work properly. I guess even delay.h must be using some #define to find out frequency of controller but i didn't find it in any c/h file.
I have two main requirement
1. I want to make my program generic to clock frequency.
2. I don't want to create new project for different clock frequency. Can't we change frequency in C file.
---------- Post added at 04:09 ---------- Previous post was at 04:05 ----------
Ohh Just now I found macro in code vision avr. _MCU_CLOCK_FREQUENCY_ macro give clock frequency in Hz. I can use this to make my code generic (irrespective of clock).
But can I change this frequency in C/H file without creating new project?
I have C program which is created for 16MHz frequency if I run it with 8MHz then I won't get proper serial output also delay function won't work properly. I guess even delay.h must be using some #define to find out frequency of controller but i didn't find it in any c/h file.
I have two main requirement
1. I want to make my program generic to clock frequency.
2. I don't want to create new project for different clock frequency. Can't we change frequency in C file.
---------- Post added at 04:09 ---------- Previous post was at 04:05 ----------
Ohh Just now I found macro in code vision avr. _MCU_CLOCK_FREQUENCY_ macro give clock frequency in Hz. I can use this to make my code generic (irrespective of clock).
But can I change this frequency in C/H file without creating new project?