Quote:
Originally Posted by popnbrown
I tried it this way too and it doesnt work.
Code:
long time = ((long)1000* degrees)/ 300; //degrees is 30
And BTW anyone have gmail and could possibly help me around 8:00 EST today, would reely appreciate it and thank you anyways for your help so far.
|
But you didn't answer the burning question. How are you displaying time to get the value of zero?
If you're doing:
printf("Time = %d\r\n", time);
it won't work since %d is going to display a 2 byte integer and not the 4 byte long. It will only display either the upper or lower two bytes depending on whether the PIC is little or big endian.
You need to either:
printf("Time = %d\r\n", (int) time);
or
printf("Time = %ld\r\n", time);
Assuming the implementation of printf you're using is complete enough to accept the %ld specification to print longs.
I don't know this is your problem since you haven't shown your latest version with the printf, but it's a high probability on my list.