Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Best way to do this with AVR or PIC?

Status
Not open for further replies.

david90

Advanced Member level 1
Joined
May 5, 2004
Messages
423
Helped
9
Reputation
18
Reaction score
4
Trophy points
1,298
Activity points
3,611
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.
 

Salam,

It's so easy with External Interrupt(Use external pin changed interrupt connected to SW2) to detect if the SW2 is pressed.

Bye
 

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
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top