cancel
Showing results for 
Search instead for 
Did you mean: 

control algorithm for LED shift register

XooM
Associate III

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.

ttaa

 

34 REPLIES 34

 

First of all, thank you very much for your kind and detailed explanation.

I have some problems.

1. I do not know English. I am writing to you via Translate. That is why I cannot understand some of your technical statements. It is not understood when translated.

2. As important as I said before, I am not as good a programmer as you. I know at a basic level.

3. I understand a little of what you say, but I understand better when you write code.

4. I have some missing topics, I learn as I practice.

If you have enough time to write a code that can run this system, I would love to see it.

Thank you. I control 24 LEDs by scanning with 250us using the codes I gave.

But as I said at the beginning, I opened this topic because I did not like the code I wrote.

 

 

 

 

Hi,

Have you measured the CLK speed, minimum Data setup and hold times?

Kind regards
Pedro

AI = Artificial Intelligence, NI = No Intelligence, RI = Real Intelligence.

@unsigned_char_array wrote:

Why are you bit banging and why aren't you using SPI?

One advantage of bit-banging - at this point, at least - is that you can step the process bit-by-bit to watch what's happening.

 


@unsigned_char_array wrote:
  • I would avoid using any inputs for the moment and just use fixed values, makes it much easier to test. This way you can test inputs and outputs separately.

Absolutely!

 


@unsigned_char_array wrote:
I wouldn't use magic numbers. Use bitshifting instead. So if you want bit 9 set for instance use currentval = 1UL<<9

Definitely!

@XooM - and if you want to set a bit without affecting others, use:

currentval |= 1UL<<9;

 Or, to clear a bit:

currentval &= ~(1UL<<9);

 


@XooM wrote:

1. I do not know English. I am writing to you via Translate. That is why I cannot understand some of your technical statements. It is not understood when translated.


Do you not have any colleagues or teachers, etc, locally who could help you?

 


@XooM wrote:

Thank you. I control 24 LEDs by scanning with 250us


Still not sure what you mean by, "scanning with 250us" ?

Is it: every 250ms you send a new 16-bit pattern to select a new LED ?

If so, that means that each LED is only ON for 250ms ?

 


@XooM wrote:

But as I said at the beginning, I opened this topic because I did not like the code I wrote.


No, you didn't say that; you just said, "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" - nothing there about having written anything!"

So what is it, exactly, that you "do not like" about your code?

Never mind, focus on the other topics. I don't like you questioning me. You don't have to answer every topic. Those who want to help me and guide me are already showing themselves. You are constantly being rude. I don't really get along with you. The question is very clear and simple. "How do you control these LEDs?" Sometimes I may want to light up just 1 LED, sometimes 10 LEDs. That's the question and it's simple. But never mind. You can ask 100 questions now.