Hi
I am an electronic engineer with little experiment of C programming but not programming micros. I am trying to understand the code in a micro in a hardware I am working with. This is one particle think I can not understand see the code below
“WDOG_CLK_OCO” is not defined any where in the code! “WDOG_CLK_CPU” is defined but no value is assign to it! How does the program know if the condition is true or false? Even if “WDOG_CLK_OCO” was defined I don’t really understand how this function works? There are in several other plases in the code there the name in
#if defined(********) are not define any where in the code. Is this an error or it can be this why? How?
Many tanks in advance
I am an electronic engineer with little experiment of C programming but not programming micros. I am trying to understand the code in a micro in a hardware I am working with. This is one particle think I can not understand see the code below
Code:
public void wdog_mng_startup(void)
{
#if defined(WDOG_CLK_OCO)
/* select on-chip osc. frequency */
prc0 = 1;rocr = (WDOG_CLK_OCO_F2|WDOG_CLK_DIV_4);prc0 = 0;
/* unprotect registers */
prc1 = 1;
/* watch-dog time-out creates reset */
pm12 = 1;
/* wdog clock is on-chip osc. */
pm22 = 1;
/* protect registers */
prc1 = 0;
/* start wdog counting */
wdts = 0;
#elif defined(WDOG_CLK_CPU)
/* unprotect registers */
prc1 = 1;
/* watch-dog time-out creates reset */
pm12 = 1;
/* protect registers */
prc1 = 0;
/* prescaler by 128 */
wdc7 = 1;
/* start wdog counting */
wdts = 0;
#endif
}
“WDOG_CLK_OCO” is not defined any where in the code! “WDOG_CLK_CPU” is defined but no value is assign to it! How does the program know if the condition is true or false? Even if “WDOG_CLK_OCO” was defined I don’t really understand how this function works? There are in several other plases in the code there the name in
#if defined(********) are not define any where in the code. Is this an error or it can be this why? How?
Many tanks in advance