dot-matrix for fixed character to display

1 post / 0 new
lara's picture

Offline

Joined: Oct 05, 2018

Replies: 8
dot-matrix for fixed character to display
July 4, 2019 - 8:54pm

Hi all,

I am tring to learn about dot matrix display, for that i have been tring to get a character (like "F") into display in my 8*8 (2.3 inch) dotmatrix. The code in xc8 for 16f877a mcu at 20mhz.

Dotmatrix is anodoide-column and refershing is being done in anode pin, which is connected to PORTB Pins.

And Cathode is connected to PORTD pins and 8bit data is sent for selected refershing pin at a time. Five-8 bit data is sent in one frame.(as the program to control 5 -8bit data like 5x8 dot matrix)

Now, trying to get o/p in proteus first before to implement in real h/w.

#include <xc.h>
#include <stdint.h>         // include stdint header
#define _XTAL_FREQ 20000000

/* To display a still letter 'F' in the display */

unsigned char i;
int j=0;
int VAL[5] = {1,2,4,8,16};//pin values of PORTB
void display(unsigned char c)
{
    PORTD=c;           // to display 1/5th of letter                                             
    PORTB = VAL[j];     // col refresh -anodide column
    __delay_us(500);    // to display the data in a column for 1ms                        
    PORTD=255;          // to blank the display                                                              
     j++ ;
     if (j > 5) 
         j = 0;
}

void pic_init()
{
    TRISD=0;
    TRISB=0;
    //TRISB7=0;
}
/* MAIN FUNCTION */
void main()
{
    pic_init();                /* to set out ports                                            */
    while(1)
    {
        //reset();               /* to jump to first column from right              */
        display(0x7f);    /* 1/5 portion of letter F                                 */
        display(0x6f);    /* 1/5 portion of letter F                                 */
        display(0x6f);    /* 1/5 portion of letter F                                 */
        display(0x6f);    /* 1/5 portion of letter F                                  */
        display(0x01);   /* 1/5 portion of letter F                                  */

        PORTB = 0X00 ;// col refresh -anodide column
        __delay_us(500);
    }
}
/*program end */

Problems is that the text "F" is not being standstill, continiously moving.. How to get standstill text..