PIC16F877a wit 74hc595 Led Matrix

Submitted by Bilal on Tue, 11/19/2019 - 20:52

// CONFIG
#pragma config FOSC = HS        // Oscillator Selection bits (HS oscillator)
#pragma config WDTE = OFF       // Watchdog Timer Enable bit (WDT disabled)
#pragma config PWRTE = OFF      // Power-up Timer Enable bit (PWRT disabled)
#pragma config BOREN = ON       // Brown-out Reset Enable bit (BOR enabled)
#pragma config LVP = OFF         // Low-Voltage (Single-Supply) In-Circuit Serial Programming Enable bit (RB3/PGM pin has PGM function; low-voltage programming enabled)
#pragma config CPD = OFF        // Data EEPROM Memory Code Protection bit (Data EEPROM code protection off)
#pragma config WRT = OFF        // Flash Program Memory Write Enable bits (Write protection off; all program memory may be written to by EECON control)
#pragma config CP = OFF         // Flash Program Memory Code Protection bit (Code protection off)

// #pragma config statements should precede project file includes.
// Use project enums instead of #define for ON and OFF.

#include <xc.h>
#include <pic16f877a.h>
#define _XTAL_FREQ 12000000

//rows pin assignment  (- of led matrix))
#define row_clk PORTDbits.RD0   //pin 11 clock pin
#define row_latch PORTDbits.RD1   //pin 12 latch pin
#define row_ds   PORTDbits.RD2   //PIN 14
//columens pins  (+ of led matrix)
#define col_clk  PORTCbits.RC4     //pin 11 clock pin
#define col_latch  PORTCbits.RC5
#define col_ds    PORTCbits.RC6
unsigned int A[1][8]={0b00111100,0b01100110,0b1100110,0b01111110,0b01111110,01100110,0b01100110,0b01100110};
unsigned int L[1][8]={0x80,0x80,0x80,0x80,0x80,0x80,0xFF};

unsigned int I[1][8]={
                      0b11111111,
                      0b00011000,
                      0b00011000,
                      0b00011000,
                      0b00011000,
                      0b00011000,
                      0b11111111,
                      0b00000000};

 

//unsigned int A[][8]={0b00111100,0b01100110,0b01100110,0b011111110,
//                   0b011111110,0b01100110,0b01100110};
//unsigned int col[]={0b00000000,0b10000000,0b01000000,0b00100000,0b00010000,0b00001000,0b000000100,0b00000010,0b00000001};

void systeminit()
{
    row_clk=0;   col_clk=0;
    row_ds=0;    col_ds=0;
    row_latch=0;  col_latch=0;
       
}

void main()
{
    
    TRISD=0;
    TRISC=0;
    unsigned int i,j,k,x;
    //unsigned char gnd=0b11111110;
   //unsigned char gnd=0b0000001;
    unsigned char gnd=0b00000001;
    unsigned char GndFinal,rowFinal=0;
    char z,m=0;
   
    systeminit();
    while(1)
{
        
        for( i=1;i<2; i++)
        {
                for(k=0;k<=7;k++)
                {
                      for(j=0;j<=7;j++)
                       {
                     
                        col_latch=0; col_clk=0;
                        col_ds=(A[i][k]>>j)&0x01;
                         col_clk=1;__delay_us(500);col_clk=0; __delay_us(500);
                        col_latch=0;__delay_us(500);col_latch=1;
                       
                        GndFinal=gnd<<j;
                        rowFinal=~GndFinal;
                        //rowFinal=GndFinal;
                        row_latch=0; row_clk=0;
                        row_ds=(rowFinal)&0xFE;
                        row_clk=1;__delay_us(500);row_clk=0;__delay_us(500);
                        row_latch=0;__delay_us(500);row_latch=1;
                        __delay_ms(20);
                    }
                  __delay_ms(2);
                }
            }
            
        }
        
}

    
    hi everyone ,,hope  i will get some help ,,as i am unable to print I alphabet on 8*8 led matrix (Scrolling) where i have used two 74hc595 one for column and one for row,,,with arduino it works,,,but my task is to do this scrolling with PIC16f877a, hope some will surely help me .above is my code'

thanks is advanced
   

help please waiting for your someone help

  Joined November 19, 2019      4
Tuesday at 08:44 PM

What response are you getting for this code? Have you tried the simulation first? Use Proteus to simulate your program and post the result of simulation 

  Joined August 16, 2016      998
Tuesday at 12:29 AM

i have made the complete 8x8 led matrix ,,,and have used the 74hc595 on columns (all positive connected) and 74hc595 on rows(all negative connected in rows)

but i am unable to scroll A, or any alphabet

 

  Joined November 19, 2019      4
Tuesday at 08:44 PM