English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

hey guys i need to make an instructions using interrupt at Rb0...i need to make 3 types of LED patterns(7 LEDs)..everytime te button is pressed the program must goto the next pattern if not it will continue executing the previous pattern...any idea?thanks

2006-07-30 16:12:33 · 1 answers · asked by Anonymous in Computers & Internet Programming & Design

1 answers

set up a counter in the interrupt and increment it every time you get a interrupt. when you hit 3, reset it back to 0. then based on the counter number, output the LED pattern.

pseudocode assuming the switch is causing the interrupt:

rb0 interrupt
increment pattern byte
if pattern = 3
pattern = 0
if pattern = 0
output LED pattern 0
else if pattern = 1
output LED pattern 1
else
output LED pattern 2

end of interrupt

2006-07-31 02:08:33 · answer #1 · answered by justme 7 · 0 0

fedest.com, questions and answers