Multiplexing, how to do it right?

Discussion in 'Embedded Systems and Microcontrollers' started by nemuikuma, Jul 16, 2012.

  1. nemuikuma

    Thread Starter New Member

    Apr 4, 2012
    I'm starting out with MCUs ( i have a TI MSP430, because it was the cheapest).
    I think I'm getting along fine, but i don't really know how to do multiplexing right code wise.

    I have a working program, but i think there are more elegant ways to do it.
    I tried to look at other peoples multiplexing code, but usually i couldn't make out anything useful, sometimes because a lot of definition trick me, or sometimes the lack of comment and i couldn't even make out which part is doing the multiplexing.

    Can anyone point me in the right direction?

    I attached the source code (although the formatting doesn't look that nice as in Code Composer Studio)

    One (first strange) problem is that in the debugger the 32Khz crystal does not start, but i guess the debugger is on the same ports, (It's got to be)

    Any comment and advice is very welcome! :D
  2. takao21203

    AAC Fanatic!

    Apr 28, 2012
    I don't know this MCU, but use a dummy software timer to supply it with say 30Khz, or 40 KHz, later replace with actual crystal based timer.

    Even if it is 100 KHz you can still test functionality as such.
  3. nemuikuma

    Thread Starter New Member

    Apr 4, 2012
    Thanks, but i already figured it out, but first time i had no idea why it isn't working and took my a while to figure it out that the crystal can't work with the debugger.
    But it's not a big problem.