Umer Hassan
Newbie level 4
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.
[video]https://www.dropbox.com/s/a0i4mgi3x5tmmu5/Proteus.flv?dl=0[/video]
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
Last edited: