coyoteboy
Joined: 11 Dec 2007 Posts: 2
|
Conditional statements |
Posted: Mon Jan 07, 2008 10:31 am |
|
|
Dear all,
I have little experience in CCS-C so I apologise for the newbie question!
I have some code that runs an infinite loop (while(true)) and has inside it a further statement, they look a little like this:
Code: | main()
{
startup inc interrupts and timer1 setup
print startup output
while(true)
{
if ((input(PIN_B0) == 0) && connected == _OFF)
{
Print Debug statement
CODE
}
other code
}
} |
I've monitored "connected" and it never changes, unless instructed to do so, from _OFF.
PIN_B0 sits at 5v(1) indefinitely, unless I drag it low, and so the CODE should not be executed. At powerup I get the startup output and then nothing - which seems ideal. As soon as I hit transmit a character to the device via serial connection the debug and CODE statements are executed, despite PIB_B0 apparently never going to 0 (hardware holds it high).
Have I missed something? Is there any condition where these inputs can change? |
|