i have two momentary switches each with its own output. If switch one is pressed, output 1 would go high for x number of sec. How do I make it so that while output 1 is high because switch one is pressed, the MCU would still watch out for switch number 2 state and would make output 2 high if switch two is pressed? Kinda like multitasking I guess.
If you're using PICs, connect the inputs to RB4 and RB5 ports, handle them in PORT-B on-change ISR, and use hardware timers to drive the outputs. This way you'll keep processing time enough to land a rocket in Mars.
EXT-interrupt or scan-mode all can realize this function
EXT-interrupt: use two ext-interrupt input I/O for sw1 and sw2,it like keyboard circuit.
scan-mode: with special interval time to scan sw1 and sw2,If it have press signal ,then enter sub-function to do with it.
you can do this without multitasking :lol: even with low-end PICs without interrupts (polling method) if you don't need to do something else than polling output 2 while output one is up