Jump to content

bargraph multiplexing + light intensity


goule
 Share

Recommended Posts

Hello all,

I've multiplexed four 10 led bargraphs on a DOUT. The multiplexing process works but as I simulated a 16 bargraph sequence (only feeding the bargraphs on the 4 first steps of 16) I saw that the light is much lower than before.

The reason of this simulation is that I was planning to emmbed 16 bargraphs ... but I want their light to be still visible !

Is this begavior normal ?

Here is the code :

// This function is called by MIOS before the shift register are loaded

void SR_Service_Prepare(void) __wparam

{

static unsigned char sr_ctr;

sr_ctr = ++sr_ctr & 0x0F;

switch(sr_ctr)

{

case 0 :

{

// Je sélectionne la row 1

MIOS_DOUT_PinSet0(LED_ROW1);

MIOS_DOUT_PinSet1(LED_ROW2);

MIOS_DOUT_PinSet1(LED_ROW3);

MIOS_DOUT_PinSet1(LED_ROW4);

break;

}

case 1 :

{

// Je sélectionne la row 2

MIOS_DOUT_PinSet1(LED_ROW1);

MIOS_DOUT_PinSet0(LED_ROW2);

MIOS_DOUT_PinSet1(LED_ROW3);

MIOS_DOUT_PinSet1(LED_ROW4);

break;

}

case 2 :

{

// Je sélectionne la row 3

MIOS_DOUT_PinSet1(LED_ROW1);

MIOS_DOUT_PinSet1(LED_ROW2);

MIOS_DOUT_PinSet0(LED_ROW3);

MIOS_DOUT_PinSet1(LED_ROW4);

break;

}

case 3 :

{

// Je sélectionne la row 4

MIOS_DOUT_PinSet1(LED_ROW1);

MIOS_DOUT_PinSet1(LED_ROW2);

MIOS_DOUT_PinSet1(LED_ROW3);

MIOS_DOUT_PinSet0(LED_ROW4);

break;

}

default :

{

// Je sélectionne aucune row

MIOS_DOUT_PinSet1(LED_ROW1);

MIOS_DOUT_PinSet1(LED_ROW2);

MIOS_DOUT_PinSet1(LED_ROW3);

MIOS_DOUT_PinSet1(LED_ROW4);

break;

}

}

MIOS_DOUT_SRSet(7,255);

MIOS_DOUT_PinSet1(LED_BG9);

MIOS_DOUT_PinSet1(LED_BG10);

}

Thanks for help !!

Olivier

Link to comment
Share on other sites

Hi Olivier,

yes, this is normal, because each bar is only service fourth the time now. You could increase the brightness by using smaller resistor values, or by using more dout pins (4*4 select lines instead of 4), so that the counter is reset at lower values

Best Regards, Thorsten.

Link to comment
Share on other sites

Hi Thorsten

Thanks for your answer.

I retreived a thread dealing about multiplexing :

http://www.midibox.org/forum/index.php?topic=721.0

Here you say :

"So - a loop takes 16 mS. And now the trick: if a LED row is not supplied with power for 15 mS, it will continue to lit for a short moment. The brightness will be lower, but you won't regognized that it's switched off/on very quickly."

In my example I force the n-1 leds not used to switch off so I don't think I'm using the same method; how is it possible to have a led brighten for the other 14 ms instead of switching it off, like I do ?

I took a look on the mm_vpot.c file, but I don't understand these instructions :

  MIOS_DOUT_SRSet(LEDRINGS_SR_ANODES_1, anode_pattern & 0xff);

  MIOS_DOUT_SRSet(LEDRINGS_SR_ANODES_2, (anode_pattern >> 8 ) & 0xff);

Why adding 0xFF ? What does ">>" do ?

In case I don't find any coding trick, could you tell me the value of the resistor I should use ?

To sum up : I'd like to multiplex 16 bargraphs (10 led each) like on the classic example http://www.ucapps.de/mbhp/mbhp_doutx4_ledrings.pdf

Today I'm losing so much brightness I can hardly see them lit !

Sorry to bother you with all that questions ...   :-\

Olivier

Link to comment
Share on other sites

Hi Olivier,

how is it possible to have a led brighten for the other 14 ms instead of switching it off, like I do ?

this is not possible with the multiplex method - just imagine about how it works, maybe it makes sense to draw a flowchart, a diagram or whatever. So, the only possibility is to split the 16 x multiplexers to two 8 x multiplexers (or less) in order to decrease the update period

The best resistor values depend on the LEDs you are using - you have to do some experiments. In normal case (when cheap LEDs with low power consumption are used), the LEDs are bright enough, so that no special measure is required.

MIOS_DOUT_SRSet(LEDRINGS_SR_ANODES_1, anode_pattern & 0xff);

  MIOS_DOUT_SRSet(LEDRINGS_SR_ANODES_2, (anode_pattern >> 8 ) & 0xff);

Why adding 0xFF ? What does ">>" do ?

the AND opteration which masks out the first 8 bit is not really required, but it's a good programming style. The >> operator leftshifts the 16bit word - the purpose of these operations is to select the lower and upper byte of a 16bit word

Best Regards, Thorsten.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...