Hi Carlos,
To do something when an input transitions from 1->0 you might write some code to remember the last state and look for the case where the new state is now 0 but the last state was 1. Here is an example:
int NewState,LastState;
LastState=ReadBit(46);
for ( ; ; ) // loop forever
{
NewState=ReadBit(46);
If (NewState==0 && LastState==1)
{
// do something because bit changed from 1 to 0
}
LastState=NewState; // remember the last State
}
For the case where there multiple things that you wish to be continuously monitored you can use a single loop and put all the things you need to do in the same loop. See below:
for ( ; ; ) // loop forever
{
// Do one thing here
// Do something else here
}
HTH