S
Shawn
Hello all...
I'm new to the world of C programming, and am working with an embedded
microcontroller as a hobby. I have a reasonably simple program
running now, but I'm having trouble figuring out how to test for a
specific bit when an interrupt is triggered.
Basically when the interrupt is set, the program reads a register to
determine what caused the interrupt. It could be one or both of 2
values - bit 2 and/or biit 4. Depending on which or both it is, I
want to do different things.
If the hex result of the interrupt register is 0x08, bit 4 is set -
OK, likewise 0x02 would mean bit 2 - again, no problem. 0x10 would
mean both were set.
My question is more of style, and more complicated situations - is the
best way to handle this just with IF statements and test for the 3
different conditions? Likewise, if I want to use some of the other
interrupt conditions, how would I handle circumstances with 5 or 6
different interrupts, and a ton of different possibilities?
Thanks up front for any help from an old guy that is trying to catch
up!
I'm new to the world of C programming, and am working with an embedded
microcontroller as a hobby. I have a reasonably simple program
running now, but I'm having trouble figuring out how to test for a
specific bit when an interrupt is triggered.
Basically when the interrupt is set, the program reads a register to
determine what caused the interrupt. It could be one or both of 2
values - bit 2 and/or biit 4. Depending on which or both it is, I
want to do different things.
If the hex result of the interrupt register is 0x08, bit 4 is set -
OK, likewise 0x02 would mean bit 2 - again, no problem. 0x10 would
mean both were set.
My question is more of style, and more complicated situations - is the
best way to handle this just with IF statements and test for the 3
different conditions? Likewise, if I want to use some of the other
interrupt conditions, how would I handle circumstances with 5 or 6
different interrupts, and a ton of different possibilities?
Thanks up front for any help from an old guy that is trying to catch
up!