Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] Character is not displaying correctly on 8x8 dotmatrix while using 74HC595

Status
Not open for further replies.

Umer Hassan

Newbie level 4
Joined
Sep 15, 2015
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
49
Hello, i am working on using lesser bits of mcu for displaying character on 8x8 dot matrix. therefore, i use 8bit serial shift register 74HC595. The character is not displaying properly. Its overlapping. The code, video and the pic is attached herewith.

Code:
#define shcp PORTA.B0
#define serialdata PORTA.B1
#define stcp PORTA.B2
#define addressbus PORTB

const char font[8]={0x3C, 0x20, 0x20, 0x20, 0x3C, 0x20, 0x20, 0x20};
unsigned char i,j,sd; // 'i' shift data from MSB to LSB, 'sd' stores single bit by selecting character from font array and taking %2

void serialize()   //function for serializing the data
{
sd = (font[j]>>i)%2;    //select the LSB
serialdata = 0;
serialdata = sd;        //send sd on PORTB.B1
}

void main()
{
TRISA=TRISB=0x00;      //PORTS set as output
while(1)
{
for(j=0;j<8;j++)
{
addressbus = j;
stcp = 0;
for(i=0;i<8;i++)
{
shcp = 0;
serialize();
shcp = 1;
Delay_Ms(100);
}
stcp = 1;
Delay_Ms(100);
}
}
}


[video]https://www.dropbox.com/s/a0i4mgi3x5tmmu5/Proteus.flv?dl=0[/video]
 

Attachments

  • Screenshot_1.png
    Screenshot_1.png
    154.3 KB · Views: 99
Last edited:

To avoid any oberlapping, the row driver would be disabled before updating the column data and switched to the new row after it. An additional select line is required to do so. In real hardware, a short overlapping isn't necessarily a problem.

In your code, the overlapping time is huge due to the useless delay after sending a serial data bit.
 
It looks like you change U3 to a new row while the previous font column is still on the shift register outputs of U2. Then delay, and then clock the new column data to the outputs of the shift register U2 , and then delay again. Try getting rid of the first delay. It is delaying while the old font is on the new row.
 
You peoples are awesome :thumbsup:. Thanks for helping. Actually the purpose of putting too much delay is to analyze the program in simulation. Well i figured out to disable the U3 initially. put the data serially in to shift register U2. and finally enabling U3 and latching data simultaneously. Below is the actual and correcting working code.

Code:
#define shcp PORTA.B0
#define serialdata PORTA.B1
#define stcp PORTA.B2
#define En1 PORTA.B3
#define addressbus PORTB

const char font[8]={0x3C, 0x20, 0x20, 0x20, 0x3C, 0x20, 0x20, 0x20};
unsigned char i,j,sd; // 'i' shift data from MSB to LSB, 'sd' stores single bit by selecting character from font array and taking %2

void serialize()   //function for serializing the data
{
sd = (font[j]>>i)%2;    //select the LSB
serialdata = 0;
serialdata = sd;        //send sd on PORTB.B1
}

void main()
{
TRISA=TRISB=0x00;      //PORTS set as output
while(1)
{
for(j=0;j<8;j++)
{
En1 = 0;
addressbus = j;
stcp = 0;
for(i=0;i<8;i++)
{
shcp = 0;
serialize();
shcp = 1;
}
En1 = 1;
stcp = 1;
Delay_us(100);
}
}
}

 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top