??? 06/27/05 11:38 Read: times |
#96006 - Some confusion abounds... Responding to: ???'s previous message |
"The original post used only integers, and a lot of brackets: that meant the integer result in the denominator was zero - and, hence, the divide-by-zero error."
The original post was: #define Xtal 22.1184 #define tic12 (12/Xtal) #define _10msec (65536 - ((1000 * 10) / tic12)) . . TL1 = _10msec; TH1 = _10msec >> 8 ; which does have a floating point constant in it. The expansion is: TL1 = (65536 - ((1000 * 10) / (12/22.1184))); TH1 = (65536 - ((1000 * 10) / (12/22.1184))) >> 8 ; which, contrary to what the OP reports, correctly generates a value of zero for TL1. The real error is in the second line where an attempt is being made to right shift a floating point value. |