Need help for Dot matrix display

Thread Starter

jigarpatelp

Joined Aug 8, 2014
2
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.
 

Attachments

absf

Joined Dec 29, 2010
1,968
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
 

MrCarlos

Joined Jan 2, 2010
400
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 !.
 

Attachments

Last edited:

Thread Starter

jigarpatelp

Joined Aug 8, 2014
2
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.
 

absf

Joined Dec 29, 2010
1,968
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:
#include"font_data.h"
 sbit Serial_Data at RB0_bit;
 sbit SH_Clk at RB1_bit;
 sbit ST_Clk at RB2_bit;

unsigned short Buffer[32][11];                                          //As per display size[row][colmn]
unsigned short scroll,lsb,msb,speed,StringLength,l,k,shift_step=1 ;
unsigned short i,m,m1,row,temp,j,len0,len,k_min,k_max,i_min,i_max ;

void zero(){
for(j = 0; j < 8; j++)
{
    for(i = 0; i < 8; i++)
    {
        Buffer[i][j] = 0;
    }
} }
//Timer2
//Prescaler 1:1; Postscaler 1:1; TMR2 Preload = 199; Actual Interrupt Time : 50 us

//Place/Copy this part in declaration section
void InitTimer2(){
  T2CON	 = 0x04;
  TMR2IE_bit	 = 1;
  PR2		 = 199;
  INTCON	 = 0xC0;
}

void Interrupt(){
  if (TMR2IF_bit){
    TMR2IF_bit = 0;
    //Enter your code here
    i++;
  }
}
void Send_Data(unsigned short rw)                                     //returns row value either 1 or 0
{
unsigned short Mask,t,num,Flag;
   for (num = 0; num < 11; num++)         //total matrix column
   {
       Mask = 1;
      for (t=0; t<8; t++)
      {
         Flag = Buffer[rw][num] & Mask;
         if(Flag==0) Serial_Data = 0;
         else        Serial_Data = 1;
         SH_Clk = 1;
         SH_Clk = 0;
         Mask = Mask << 1;
       }
   }
}
void row_shift(short i_min,short i_max)
{
 for (row=i_min; row<i_max; row++)
 {
   temp = CharData[k][row];
   for(i=0;i<=10;i++)
   {
     if(i==0)  Buffer[row][i] = (Buffer[row][i] << shift_step)   | (temp >> ((8-shift_step)-scroll*shift_step));
     else      Buffer[row][i] = (Buffer[row][i] << shift_step)   | (Buffer[row][i-1] >> (8-shift_step));
   }
 }
}
void Init()
{
   TRISB=0x00;
   TRISE=0x00;
   TRISA=0x00;
   TRISD=0x00;
   TRISC=0x00;
   PORTB=0x00;
   PORTC=0xFF;
   ADCON1=0x0F;
}
void scrolll(short k_min,short k_max,short i_min,short i_max)
{
      for (k=k_min; k<k_max; k++)
      {
         for (scroll=0; scroll<8; scroll++)
         {
            row_shift(i_min,i_max);
            speed = 1;
            for(l=0; l<speed;l++)
            {
               for (i=0; i<32; i++)
               {
                  Send_Data(i);    PORTC=i;   ST_Clk = 1;  ST_Clk = 0;     Delay_us(20);
                }
            }
         }
      }
}
void display(short k_min,short k_max,short i_min,short i_max)
{
      for (k=k_min; k<k_max; k++)
      {
          speed = 1;
          for(l=0; l<speed;l++)
          {
              for(i=0; i<32; i++)
              {
                 Send_Data(i);    PORTC=i;   ST_Clk = 1;  ST_Clk = 0;  Delay_us(20);
              }
          }
       }
}
void main()
{
   Init();
   while(1)
   {  //scroll in 1st char-line:
        scrolll(0,10,0,8);
        display(0,10,0,8);
      //scroll in 2nd char-line:
        scrolll(10,20,8,16);
        display(10,20,8,16);
      //scroll in 3rd char-line:
        scrolll(20,30,16,24);
        display(20,30,16,24);
      //scroll in 4th char-line:
        scrolll(30,40,24,32);
        display(30,40,24,32);
    }
}

Allen
 

Attachments

Top