Need help for Dot matrix display

Discussion in 'General Electronics Chat' started by jigarpatelp, Sep 17, 2014.

  1. jigarpatelp

    Thread Starter New Member

    Aug 8, 2014
    2
    0
    I've completed my project using PIC18F4520,74HC595.
    But it is flickering .
    how to stop or minimize this flickering ???
    I'hv tried timer interrupt method but unable to do so .Help me to complete using interrupt method.

    Here I attached my code and proteus file.
    thank you
    Please reply me as soon as possible.
     
  2. ISB123

    Well-Known Member

    May 21, 2014
    1,239
    527
    Are symbols flickering or backlight?
     
  3. absf

    Senior Member

    Dec 29, 2010
    1,492
    372
    I simulated your DSN on my proteus and it was working not too bad. My PC is a 2GHz dual-core on XP and the processor reaches 100% running on your simulation but it looks to me it's working fine. I increased the PIC mcu clock to 20MHz and the flicker stopped.

    I think you should start making the real HW and see how it works. Are you using mikroC compiler?

    Allen
     
    Brian Griffin likes this.
  4. MrCarlos

    Active Member

    Jan 2, 2010
    400
    134
    Hello jigarpatelp

    The behavior of the devices we use work differently in the simulation (Proteus ISIS) than in reality.
    I have a similar PC to that of absf. I Have a LapTop but my operating system is Windows Vista.

    Apparently, making a run on my PC, does not have the problem you mention. So to build your
    design in reality it is very likely that this flickering will be not noticeable.
    I have some recommendations to make.
    If you're going to make the PCB with Proteus ARES I think going out the connectors that are hidden under the dot matrix. I found 8, but may be more. Take a look at the attached image.
    But most important is that you must verify the data sheets of the IC's that handle your Dot Matrix.
    They probably can not handle the current required to turn on the Dots.
    Pretty good design congratulations !.
     
    Last edited: Sep 18, 2014
    absf likes this.
  5. jigarpatelp

    Thread Starter New Member

    Aug 8, 2014
    2
    0
    Hello,

    Thank for your reply .

    @ISB123 : whole display flicker after 1st row completed.

    @absf : You are right but I want to improve this code. I want to drive this code using timer interrupt method. So because of that brightness of each row will be same . and I'm unable to complete this using interrupt method.

    @MrCarlos : This for simulation purpose while in real hardware i've to attach current source(uln2803) & sink (udn2981) IC's and some current limiting resisters..


    I want to work the same code using interrupt method so please help me for the same.
    Thank you.
     
  6. absf

    Senior Member

    Dec 29, 2010
    1,492
    372
    Some members dont like to open zip files and some dont use proteus at all. So let me help you upload the schematics and the source code so more people can study it. Most probably the better experienced programmers are able to help you.

    Code (Text):
    1.  
    2. #include"font_data.h"
    3.  sbit Serial_Data at RB0_bit;
    4.  sbit SH_Clk at RB1_bit;
    5.  sbit ST_Clk at RB2_bit;
    6.  
    7. unsigned short Buffer[32][11];                                          //As per display size[row][colmn]
    8. unsigned short scroll,lsb,msb,speed,StringLength,l,k,shift_step=1 ;
    9. unsigned short i,m,m1,row,temp,j,len0,len,k_min,k_max,i_min,i_max ;
    10.  
    11. void zero(){
    12. for(j = 0; j < 8; j++)
    13. {
    14.     for(i = 0; i < 8; i++)
    15.     {
    16.         Buffer[i][j] = 0;
    17.     }
    18. } }
    19. //Timer2
    20. //Prescaler 1:1; Postscaler 1:1; TMR2 Preload = 199; Actual Interrupt Time : 50 us
    21.  
    22. //Place/Copy this part in declaration section
    23. void InitTimer2(){
    24.   T2CON  = 0x04;
    25.   TMR2IE_bit     = 1;
    26.   PR2        = 199;
    27.   INTCON     = 0xC0;
    28. }
    29.  
    30. void Interrupt(){
    31.   if (TMR2IF_bit){
    32.     TMR2IF_bit = 0;
    33.     //Enter your code here
    34.     i++;
    35.   }
    36. }
    37. void Send_Data(unsigned short rw)                                     //returns row value either 1 or 0
    38. {
    39. unsigned short Mask,t,num,Flag;
    40.    for (num = 0; num < 11; num++)         //total matrix column
    41.    {
    42.        Mask = 1;
    43.       for (t=0; t<8; t++)
    44.       {
    45.          Flag = Buffer[rw][num] & Mask;
    46.          if(Flag==0) Serial_Data = 0;
    47.          else        Serial_Data = 1;
    48.          SH_Clk = 1;
    49.          SH_Clk = 0;
    50.          Mask = Mask << 1;
    51.        }
    52.    }
    53. }
    54. void row_shift(short i_min,short i_max)
    55. {
    56.  for (row=i_min; row<i_max; row++)
    57.  {
    58.    temp = CharData[k][row];
    59.    for(i=0;i<=10;i++)
    60.    {
    61.      if(i==0)  Buffer[row][i] = (Buffer[row][i] << shift_step)   | (temp >> ((8-shift_step)-scroll*shift_step));
    62.      else      Buffer[row][i] = (Buffer[row][i] << shift_step)   | (Buffer[row][i-1] >> (8-shift_step));
    63.    }
    64.  }
    65. }
    66. void Init()
    67. {
    68.    TRISB=0x00;
    69.    TRISE=0x00;
    70.    TRISA=0x00;
    71.    TRISD=0x00;
    72.    TRISC=0x00;
    73.    PORTB=0x00;
    74.    PORTC=0xFF;
    75.    ADCON1=0x0F;
    76. }
    77. void scrolll(short k_min,short k_max,short i_min,short i_max)
    78. {
    79.       for (k=k_min; k<k_max; k++)
    80.       {
    81.          for (scroll=0; scroll<8; scroll++)
    82.          {
    83.             row_shift(i_min,i_max);
    84.             speed = 1;
    85.             for(l=0; l<speed;l++)
    86.             {
    87.                for (i=0; i<32; i++)
    88.                {
    89.                   Send_Data(i);    PORTC=i;   ST_Clk = 1;  ST_Clk = 0;     Delay_us(20);
    90.                 }
    91.             }
    92.          }
    93.       }
    94. }
    95. void display(short k_min,short k_max,short i_min,short i_max)
    96. {
    97.       for (k=k_min; k<k_max; k++)
    98.       {
    99.           speed = 1;
    100.           for(l=0; l<speed;l++)
    101.           {
    102.               for(i=0; i<32; i++)
    103.               {
    104.                  Send_Data(i);    PORTC=i;   ST_Clk = 1;  ST_Clk = 0;  Delay_us(20);
    105.               }
    106.           }
    107.        }
    108. }
    109. void main()
    110. {
    111.    Init();
    112.    while(1)
    113.    {  //scroll in 1st char-line:
    114.         scrolll(0,10,0,8);
    115.         display(0,10,0,8);
    116.       //scroll in 2nd char-line:
    117.         scrolll(10,20,8,16);
    118.         display(10,20,8,16);
    119.       //scroll in 3rd char-line:
    120.         scrolll(20,30,16,24);
    121.         display(20,30,16,24);
    122.       //scroll in 4th char-line:
    123.         scrolll(30,40,24,32);
    124.         display(30,40,24,32);
    125.     }
    126. }
    127.  

    Allen
     
Loading...