1
\$\begingroup\$

I'm practicing shift registers, and I'm trying to draw a smiley on an 8x8 LED matrix.

At first, it was okay because I set the scanning delay to 1 second, but in reality, this must be set to a faster delay (close to no delay) so that you can see the smiley image permanently.

So I set 10 μs for the delay, but when I ran the program, the smiley image wouldn't appear anymore. Is the program too fast for Proteus software to handle?

By the way, I'm watching this tutorial for my reference and we both did the same thing except I'm using another shift register (HEF4094) with a transistor array (ULN2003A).

Here is my code:

    int dataPin1 = 2;
    int dataPin2 = 3;
    int clockPin1 = 4;
    int clockPin2 = 5;
    int latchPin = 8;
    int delayTime = 5;

    int scan[] = {1, 2, 4, 8, 16, 32, 64, 128, 256};
    int smile[] = {0, 36, 36, 36, 0, 66, 60, 0};

    void setup() {
      pinMode(dataPin1, OUTPUT);
      pinMode(dataPin2, OUTPUT);
      pinMode(clockPin1, OUTPUT);
      pinMode(clockPin2, OUTPUT);
      pinMode(latchPin, OUTPUT);
    }

    void loop() {
      for (int i=0; i<7; i++) {
        shiftOut(dataPin2, clockPin2, LSBFIRST, scan[i]);
        shiftOut(dataPin1, clockPin1, MSBFIRST, smile[i]); 
        disp();
      }
    }

    void disp() {
      digitalWrite(latchPin, HIGH); 
      delay(delayTime);
      digitalWrite(latchPin, LOW); 
      delay(delayTime);
    }
```
\$\endgroup\$

1 Answer 1

0
\$\begingroup\$

Is the program too fast for Proteus software to handle this?

No, the software can handle that sort of thing. I have done the same with a transistor for each seven segment display. If I have two seven segments, when one is off the other is on and vice versa. This is all done at a very fast rate which cannot be detected by the naked eye, and Proteus handled this well.

Could there be something from your code which is not working?

\$\endgroup\$
6
  • \$\begingroup\$ I edit my original post and posted my code. I believe I'm doing this right. Can you check it? \$\endgroup\$
    – APR SAW
    Jan 3, 2018 at 16:00
  • \$\begingroup\$ From what I can gather (no comments in code) it seems correct, especially if it was working with a larger delay. So the smiley was "flashing" on and off with a larger delay? Can you reduce the delay but not so much to see at what time it no longer works? \$\endgroup\$
    – rrz0
    Jan 3, 2018 at 16:07
  • \$\begingroup\$ still the same, it wont appear when I set it to 3 ms or lower. 4 seems okay but the scanning pattern is visible. I think this is a software bug or due to my proteus verison. (8 Professional) \$\endgroup\$
    – APR SAW
    Jan 3, 2018 at 16:11
  • \$\begingroup\$ Could be that there is a software bug. I am sure to have worked on something similar with Proteus 7 professional, not sure with 8. You could always try to test your code in practice instead of on simulation software. Sorry that I could not assist you further. \$\endgroup\$
    – rrz0
    Jan 3, 2018 at 16:13
  • \$\begingroup\$ Its okay, I might downgrade to 7 Professional because of this. Thank you. \$\endgroup\$
    – APR SAW
    Jan 3, 2018 at 16:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.