Problem with LED matrix multiplexing

Discussion in 'Homework Help' started by Tim Weri, Sep 6, 2012.

  1. Tim Weri

    Thread Starter New Member

    Sep 6, 2012
    15
    0
    Circuit file
    Code ( (Unknown Language)):
    1. #include<at89x52.h>
    2. sbit DATA = P0^0;
    3. sbit SCK = P0^1;
    4. sbit SCL = P0^2;
    5.     unsigned char code hang[]={
    6.     0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    7.     0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    8.     0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    9.     0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    10.     0xC3,0xBD,0xBD,0xBD,0xBD,0xBD,0xBD,0xC3,
    11.     0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    12.     0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    13.     0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
    14.     0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF
    15.     };
    16. unsigned char cot[8]={0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01};
    17. int n,k;
    18. void delay(unsigned long time)
    19. {
    20.     while(time--)
    21.     {
    22.         _nop_();
    23.     };
    24. }
    25. void quet(unsigned char x)
    26. {
    27.     unsigned char i, temp;
    28.     for (i=0;i<8;i++)
    29.     {
    30.     SCK = 0;
    31.     temp = x;
    32.     temp = temp&0x80;
    33.     if (temp==0x80)
    34.         DATA = 0;
    35.     else DATA = 1;
    36.     x*=2;
    37.     SCK = 1;
    38.     }                                                            **
    39. }
    40. void main()
    41. {
    42.     while(1)
    43.     {
    44.  
    45.     for(n=0;n<8;n++)
    46.     {
    47.     SCL = 0;
    48.     quet(0xFF);
    49.     quet(0xFF);
    50.     quet(0xFF);
    51.     quet(hang[4*8 + n]);
    52.     P2 = ~cot[n];
    53.     SCL = 1;
    54.     }
    55.     }
    56. }
    I'm working on how to use 89x52 and 74HC595 to multiplex a 8x32 LED matrix. I was able to use column scanning method, but when I changed to row scanning, it went awful. Even when I remove the delay, it still scans really slow. Is it because of my circuit design ? I need help. Thank you in advance.
    P.S: I want to master both row and column scanning so, please, don't suggest using column scanning...
     
    Last edited: Sep 6, 2012
  2. bertus

    Administrator

    Apr 5, 2008
    15,649
    2,348
    Hello,

    I do not see anything at the link.
    Please upload the circuit to the forum.
    See here how to do that:
    Attachments and Images

    Bertus
     
    Tim Weri likes this.
  3. Tim Weri

    Thread Starter New Member

    Sep 6, 2012
    15
    0
    Last edited: Sep 6, 2012
  4. Tim Weri

    Thread Starter New Member

    Sep 6, 2012
    15
    0
    can anyone please indicate what the problem is? :(
     
  5. absf

    Senior Member

    Dec 29, 2010
    1,493
    373
    your proteus version is higher than mine so I cant open your DSN file.

    You can go to "\edit\copy to clipboard" then open with "paint" and save the picture as .PNG file and upload it here so others can see your schematic.

    Not everyone uses proteus here.

    Like this.....

    Allen
     
    Last edited: Sep 6, 2012
    Tim Weri likes this.
  6. Tim Weri

    Thread Starter New Member

    Sep 6, 2012
    15
    0
    Here you go :D
     
  7. Tim Weri

    Thread Starter New Member

    Sep 6, 2012
    15
    0
    Oh god, I just realized the reason why it scans so slow. My CPU cannot handle the simulation, so it takes a whole minute to animate 1 sec. Well, I still need somebody to check my schematic though. Thank you.
     
  8. Tim Weri

    Thread Starter New Member

    Sep 6, 2012
    15
    0
    Are the values of resistors properly calculated? I am going to assemble everything soon :D
     
  9. absf

    Senior Member

    Dec 29, 2010
    1,493
    373
    I'd put 1K resistors between the base of Q1-Q8 to port 1 pins.

    D1 would be quite dim with 2.2K resistor. Was it used as a power on indicator?

    Allen
     
    Tim Weri likes this.
  10. Tim Weri

    Thread Starter New Member

    Sep 6, 2012
    15
    0
    yeah, it's the power indicator. And you are right, I am gonna change the indicator's components into a red LED and a 320 ohms resistor, all of the circuits use a 5V power supply. Does that sound fine? I am rechecking the transistor properties... It' a little confusing ...
     
    Last edited: Sep 7, 2012
  11. Tim Weri

    Thread Starter New Member

    Sep 6, 2012
    15
    0
    Yeah, I agree, I'll change all the values of R10-16 to 1K. Thank you.
     
  12. takao21203

    Distinguished Member

    Apr 28, 2012
    3,577
    463
    I would remove all the resistors and use digital MOSFETs instead.

    For the software, use a memory image of the matrix, then only update one scanline each refresh cycle. If you want to swap X/Y, you need to remap the data from the memory image.
     
    Tim Weri likes this.
  13. Tim Weri

    Thread Starter New Member

    Sep 6, 2012
    15
    0
    Is it necessary to use MOSFETs? I know MOSFETs can work exponentially, but what's wrong with transistors?
     
  14. takao21203

    Distinguished Member

    Apr 28, 2012
    3,577
    463
    Tim Weri likes this.
Loading...