Torello
Joined: 29 Sep 2006 Posts: 120
|
I would like #Error (or #?) to print the calculated values |
Posted: Sun Dec 16, 2007 9:06 am |
|
|
Hi
Does anybody know how to print-out the calculated values and not the complete "filled-in" define?
Calculation below calculates the reload values for timer 1, given some parameters. I want to error print-out when I need to increase the DIV_BY-X and of course to which value...
Regards,
Edwin
----
#define T1_OF 10.250 // requested overflow time
#define Tosc 1000000 // selected main oscillator
#define T1_DIV_BY_X 1 // selected divider
#define T1_Needed_Tics (T1_OF * Tosc / 4 * T1_DIV_BY_X)
#if T1_Needed_Tics >= 65535
#error Need to increase T1_DIV_BY_X to get T1_OF
#error Increase to at least: T1_Needed_Tics / 65535
#error possible dividers: 1,2,4,8
#endif
--- |
|