2024-11-20 04:38 AM - last edited on 2024-11-21 01:55 AM by Andrew Neil
Friends, which algorithm do you use to control the LEDs in this structure? I need your ideas. I have prepared a table of the LEDs' turn on order.
2024-11-20 04:44 AM
Hello,
Not sure what do you mean by
@XooM wrote:
Friends, which algorithm do you use to control the LEDs in this structure?
Define a lookup table where you put your pattern.
const uint16_t tab[] = {0x8080, 0x8040, ....};
Then use this table to shift out the bits to the shift register.
2024-11-20 04:50 AM
Have you examined the electronic circuit?
for example, what should be the algorithm to turn on led1 led2 led3 and led4?
Because when led1 led2 led3 is active, the (2nd) 74hc4094 integrated circuit on the right has to give cathode information to all leds.
If you turn on led4 while led1 led2 led3 is on, how will you ensure that led5 and led6 remain off?
2024-11-20 04:53 AM - edited 2024-11-20 04:56 AM
I thought you said you had the LEDs working already?
Surely, the table you've provided tells you what to do - load the appropriate values into U1 and U2 ?
2024-11-20 04:59 AM
@XooM wrote:what should be the algorithm to turn on led1 led2 led3 and led4?
That's what the table you posted tells you - it tells you what values to write to get each LED illuminated.
You said you already had this working:
2024-11-20 05:01 AM
Yes, I am doing this, I am sending the information of the LEDs that need to be lit with 250us. But the LEDs are dimly lit and there are very, very small traces of the LEDs that should not be lit.
I wanted to get your opinions on whether I need to change the control method.
Otherwise, I can control the LEDs, yes.
2024-11-20 05:06 AM - edited 2024-11-20 05:08 AM
@XooM wrote:I am sending the information of the LEDs that need to be lit with 250us. But the LEDs are dimly lit and there are very, very small traces of the LEDs that should not be lit..
So why didn't you say that, then?
What do you mean by, "sending the information of the LEDs that need to be lit with 250us" ?
You should know by know that you need to provide a complete and clear description of what's going on - don't leave us guessing, and having to pull the information out of you bit-by-bit!
Show a minimum but complete code example.
PS:
It's already been noted that there are no current-limiting resistors in your schematic.
Is that just an omission from the schematic, or are they really not there in the actual hardware?
2024-11-20 05:08 AM - edited 2024-11-20 05:54 AM
This is a LED matrix configuration.
You've already answered your question:
@XooM wrote:
Because when led1 led2 led3 is active, the (2nd) 74hc4094 integrated circuit on the right has to give cathode information to all leds.
If you turn on led4 while led1 led2 led3 is on, how will you ensure that led5 and led6 remain off?
You need to ensure that for each clock. And each data needs to correspond to that anode and cathode state at each step with a lookup table:
const uint16_t tab[] = {0x8080, 0x8040, ....};
This is based on the table shared by you:
I don't want to enter in the details value and check the content of the table. I've already provided the concept.
PS:
Need to use transistors for the 74hc4094 on the right. I don't think the pin could sustain a such current consumed by all these LEDs (sink current).
M74HC4094 datasheet:
A proposed structure to prevent to exceed sink current:
For each LED branch you need a transistor. In your case 3 transistors.
2024-11-20 05:48 AM
@XooM wrote:
Yes, I am doing this, I am sending the information of the LEDs that need to be lit with 250us. But the LEDs are dimly lit and there are very, very small traces of the LEDs that should not be lit.
I wanted to get your opinions on whether I need to change the control method.
Otherwise, I can control the LEDs, yes.
Normally you need to mention the timing from the beginning.
The timing is the same as for the 7-segment display control, and you need for each step to let the LED to lit for 5ms duration. So 250us is a very short duration to let the human eye to catch the event.
Look also at the HW structure. (source: https://www.st.com/resource/en/application_note/an1781-str71x-gpio-driving-four-7segment-display-stmicroelectronics.pdf)
2024-11-20 05:48 AM
Yes, that's right, I'm using 3 transistors in my circuit as you said. I didn't want to show it here for my algorithm. I asked for some help with the coding part. I'll upload my own codes when I get home.