Humberto
Joined: 08 Sep 2003 Posts: 1215 Location: Buenos Aires, La Reina del Plata
|
|
Posted: Tue Jul 01, 2008 6:03 am |
|
|
Code: |
}while (adc_value != 2345) &&(!input(PIN-B0)));
|
To answer you I must assume a lot of things, one of them is that you are using an MCU
with a built-in 12 bits AD Converter, wich is very complex and new. Is the only way that
your ADC output would get such value.
Another comment is the way you are codding, it is very difficult to know if the task inside
the loop were done really or not. I will try to explain:
Being true my first assumption, that you really are using a 12 bit converter, there
is 4094 against 1 possibilities to exit the loop after the first pass, doing nothing.
Being false my first assumption, that you really are NOT using a 12 bit converter, there
is 100% of possibilities to exit the loop after the first pass doing nothing too.
(!input(PIN-B0))); is wrong
Replace it by (!input(PIN_B0)));
The point is that with the posted code, you would never know if it is running or not because
it doesn't matter if the code stay in the loop or not, because it is doing nothing. Just for
debugging, inside the loop it is a good practice to do something "visible" like toggle a LED
or setting a flag or increment a counter or setting a variable that is going to be checked as
soon as exit the loop.
When posting please, give us as much as data as you have, post a complete code and if
you doesn't know how to code it, at least tell us what your intention is. In this way you will
get a lot of help and nobody would be guessing like me.
Humberto
PD:
Andrew,
I like your nick -morebudwiser- but I'd suggest a new one: moreKernighan & Ritchie.
No offence |
|