Go Down

### Topic: Multiplexing while preforming other operations (Read 633 times)previous topic - next topic

#### stoopkid

##### Mar 11, 2011, 08:04 am
What is the best method of multiplexing a display, while still being able to do other things? For example, reading my RTC and listening for button presses while running though a 4 digit display. The only thing I can think of is to put the display in a for loop, or while loop and give it about 50 rolls or so before going through the rest of my required code for updates. And the button listening could go with the multiplexing loop.

Is there a more practical, or common way?

#1
##### Mar 11, 2011, 08:11 am
More practical is blink without delay.
I have code that reads button pushes, makes decisions on stuff every 100uS
These are all unsigned long
currentMicros, previousMicros, hundred_uS_interval
Code: [Select]
`  // *******************************************************************  // start timing interval  currentMicros = micros();  // sample the time  if (currentMicros - previousMicros >= hundred_uS_interval) // more than our interval?  {    // save the last time we okayed time updates    previousMicros = currentMicros; // save the current time for next comparison    // do stuff on 100uS intervals}`
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

#### stoopkid

#2
##### Mar 11, 2011, 08:22 am
okay, so we are updating the display so quickly that we can do it a bunch of times before checking for button presses, and clock updates? then every so often we take a moment to do those other things?

#3
##### Mar 11, 2011, 08:29 am
Yes.
You could update a counter every time the if condition is met.
Everytime  hits 100, update your clock.
Something along those lines.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

Go Up

Please enter a valid email to subscribe