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] 8*10 led dot matrix display-need some modifications

Status
Not open for further replies.

vinodstanur

Advanced Member level 3
Joined
Oct 31, 2009
Messages
751
Helped
114
Reputation
234
Reaction score
114
Trophy points
1,333
Location
Kerala (INDIA)
Activity points
7,054
BELOW IS MY 8*10 LED DOT MATRIX DISPLAY DESIGN AND VIDEO AND THE C PROGRAM. I NEED SOME HELP.
16_1286191770.png

THE PROGRAM SHOWN BELOW WORKS AS IN ABOVE VIDEO
#include <htc.h>
#define _XTAL_FREQ 4e6 // 4MHz
__CONFIG(0x3FFA);
void delay(unsigned int k)
{for(int i=0;i<=k;i++)}
void pattern(unsigned int a,b,c,d,e,f,g,h,i,j)
{
for(int z=0;z<9;z++)
{ for(int z=0;z<10;z++)
{
PORTB=a;delay(100);RA0=1;RA0=0;
PORTB=b;delay(100);RA0=1;RA0=0;
PORTB=c;delay(100);RA0=1;RA0=0;
PORTB=d;delay(100);RA0=1;RA0=0;
PORTB=e;delay(100);RA0=1;RA0=0;
PORTB=f;delay(100);RA0=1;RA0=0;
PORTB=g;delay(100);RA0=1;RA0=0;
PORTB=h;delay(100);RA0=1;RA0=0;
PORTB=i;delay(100);RA0=1;RA0=0;
PORTB=j;delay(100);RA0=1;RA0=0;
}
(a=a<<1);
(b=b<<1);
(c=c<<1);
(d=d<<1);
(e=e<<1);
(f=f<<1);
(g=g<<1);
(h=h<<1);
(i=i<<1);
(j=j<<1);

}
}
void main()
{
TRISB=0;TRISA=11100;PORTA=0;PORTA=2;PORTA=1;PORTA= 0;
while(1)
{
pattern(28,20,54,34,99,127,127,99,65,65); //LETTER A
pattern(124,102,99,99,126,126,99,99,102,124); //LETTER B
pattern(62,127,99,96,96,96,96,99,127,62); //LETTER C
pattern(124,126,103,99,99,99,99,103,126,124); //LETTER D
pattern(127,127,96,96,124,124,96,96,127,127); //LETTER E

}

}

IN THE ABOVE PROGRAM , THE LETTERS A, B C ETC WILL SCROLL INDEPENDENTLY ONE AFTER OTHER. ONLY AFTER COMPLETELY SHIFTING A TO EXTREEM LEFT , THEN ONLY B WILL START .
1>WHAT SHOULD I DO SO THAT LETTER B STARTS FROM RIGHT WHEN LETTER A SHIFTS TO RIGHT SO THAT A MESSAGE COULD BE DISPLAYED IN CONTINUOUS MANNER RATHER THAN IN LETTER BY LETTER MANNER...
IF ANY ONE IS FREE AND HAVE ENOUGH TIME TO CHECK THE PROGRAM ,THEN PLS HELP ME...:roll:
 
Last edited:

Did you try it by reducing the delay between the displaying of consecutive letters?
 

hi jerin, actually, in the program itself, u could see that its in such a way that, a letter, eg; B will be displayed only after completely shifting the letter A to left. Actually i want to display all letters in such a way that they enters from right side and leaves through left side, in a chain manner. Actually the above program is working as in the above video.

I Think u understood my need...

---------- Post added at 12:32 ---------- Previous post was at 12:27 ----------

Did you try it by reducing the delay between the displaying of consecutive letters?

actually in the above program i hadn't given any delay between letters.
I
 

1) you should make sure that your code and your schematic are consistent with what you want to do. right now, your code isn't consistent with your schematic and neither is consistent with what you want to do.

2) you should form a "display buffer" of 8x10. and feed the bitmap information of the display into that buffer. for example, in one frame, it could be last 5 columns of 'A' followed by first 3 columns of 'B'. and in the next frame, it would be the last 4 columns of 'A', followed by the first 4 columns of 'B'. then you see a moving message.
 

it doesn't seem that you have many much progress.

so here is a short version and if you understand how it works it can be easily expanded to cover your situation or adding more digits.

Code:
//utilizing a hc164 to display string on one 8x8 led matrix (common cathode)

#include <regx51.h>
#include "gpio.h"
#include "delay.h"

#define COL_PORT        P2            //columns are driven by P2
#define COL_DDR            P2
#define COL_PINs        0xff        //all pins on p2
#define COL_DLY            100            //delay cycles for each col
#define COL_REPEAT        0x1f        //control the repeats

#define HC164_PORT        P3
#define HC164_DDR        P3
#define HC164_CLK        (1<<7)        //hc164 clock
#define HC164_SDA        (1<<5)        //hc164 data out
#define HC164_CLR(pin)    IO_CLR(HC164_PORT, pin)    //clear a hc164 pin
#define HC164_SET(pin)    IO_SET(HC164_PORT, pin)    //set a hc164pin

//strobe hc164_CLK
#define HC164_STROBE()    {HC164_SET(HC164_CLK); HC164_CLR(HC164_CLK);}

const unsigned char code font_8x8[3][8] = {    //asci font for 'A', 'B', 'C'
0x1f,    0x28,    0x48,    0x88,    0x48,    0x28,    0x1f,    0x00,
0xff,    0x91,    0x91,    0x91,    0x91,    0xaa,    0x44,    0x00,
0x7e,    0x81,    0x81,    0x81,    0x81,    0x81,    0x42,    0x00
};

unsigned char disp_buffer[8] = {    //each column is a byte. 0=right most col
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};    //start with a blank space

unsigned char disp_str[]="ABCBABBAC";    //ascii string to be displayed
unsigned char *disp_str_ptr=disp_str;            //display col index


void _8x8_init(void) {
    IO_CLR(COL_PORT, COL_PINs);        //all col low
    IO_OUT(COL_DDR, COL_PINs);        //all col as output

    IO_CLR(HC164_PORT, HC164_CLK | HC164_SDA);    //_clk / _sda low
    IO_OUT(HC164_DDR, HC164_CLK | HC164_SDA);    //_clk / _sda as output
}

void _8x8_update(unsigned char new_col) {            //show the content of disp_buffer
    unsigned char index=0;            //colum index

    for (index=0; index<7; index++) //shift disp_buffer by 1
        disp_buffer[index]=disp_buffer[index+1];
    disp_buffer[7]=new_col;            //fill in the new column
}

void _8x8_disp(void) {            //show the content of disp_buffer
    unsigned char index=0;            //colum index

    HC164_CLR(HC164_CLK);            //clear _clk 
    HC164_CLR(HC164_SDA);            //set sda -> send the 1st one -> common cathode
    
    for (index=0; index<8; index++) {
        HC164_STROBE();                //strobe out the sda
        HC164_SET(HC164_SDA);        //clear the bit
        COL_PORT=disp_buffer[index];
        //COL_PORT = font_8x8[1][index];
        delay(COL_DLY);                //delay some
    }
    //COL_PORT=0;                        //turn off the led
}

void mcu_init(void) {
}

int main(void) {
    unsigned char i=0,j=0;
    mcu_init();                        //reset the mcu
    _8x8_init();                    //initialize the matrix

    while (1) {
        i++;
        _8x8_disp();                //display the current buffer on the leds
        if (i==COL_REPEAT) {        //is it time to update the display buffer?
            i=0;                    //if yes, reset i (loop index)
            _8x8_update(font_8x8[*disp_str_ptr-'A'][j++]);      //move the current colum into the display buffer
            if (j==8) {                    //finished updating one whole char?
                j=0;                    //if yes, reset j to display the 1st column
                disp_str_ptr++;            //advance the ptr to the next char
                //if we have reached the end of the str, wrap around at the end
                if (*disp_str_ptr==0) disp_str_ptr=disp_str;            
            }
        }
    }
}

some explanation:

1) the code runs on a 8051.
2) it drives a 8x8 led matrix (common anode) through a serial shift register (HC164).
3) P2 of the 8051 is connected to the rows of the matrix and HC164 to its columns.
4) the basic working is for the user to specify an ascii string (disp_str[]) and the code will display the string on one led matrix, scrolling it from right to left.
5) so far, the code has font information for only three letters ('A', 'B', and 'C') but you can add more.
6) also, the architecture is fairly flexible if you want to add more led maxtric: just add more hc164, :).
7) if you want to drive 8x10 matrix, you will need to add another port (to potentially drive 8x16 matrix) and it can be easily done as well.

the basic working idea is to left shift the display buffer one column at a time and then fill in the right most column with new bitmap information for the next character.

hope it helps.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top