sheing3003
Joined: 05 Jul 2006 Posts: 10
|
newbie need help with if statement |
Posted: Wed Jul 05, 2006 4:41 pm |
|
|
ok i want to do something like this, but obviously this does not work like c, so if someone can help me out and give me a good example that'll be great
this is what i wanted to do, but the #if only evaluate to a constant or something.... can someone help me change my code so it'll do the same thing? Thanks in advance
#include <16F877A>
#fuses HS
#fuses NOWDT
#fuses NOPROTECT
#fuses NOLVP
#fuses NODEBUG
#fuses PUT
#fuses NOBROWNOUT
#use delay(clock=20000000)
void main()
{
int8 a;
a=100;
output_c(0);
while(1)
{
output_bit(PIN_C0,1);
output_bit(PIN_C1,1);
output_bit(PIN_C2,1);
output_bit(PIN_C3,1);
delay_ms(500);
#if a>90
output_bit(PIN_C0,0);
#elif a>70
output_bit(PIN_C1,0);
#elif a>50
output_bit(PIN_C2,0);
#elif a>30
output_bit(PIN_C3,0);
#else
a=100;
#endif
a--
delay_ms(500);
}
} |
|