Microcontroller

Submitted by Bilal on Sat, 01/11/2020 - 23:17

hi everyone please help me as i am not able to get proper result of scrolling text as expected attache is my c code

#include"ConfigBits.h"
#include<pic16f877a.h>
#define _XTAL_FREQ 12000000

#define clk    PORTCbits.RC4
#define latch  PORTCbits.RC5
#define ds     PORTCbits.RC6

#define clkr    PORTDbits.RD0                 // (-)
#define latchr  PORTDbits.RD1
#define dsr     PORTDbits.RD2

unsigned char alph[2][5]={{0xFF,0xFF,0xFF,0xFF,0xFF},
                         {0x83,0xf5,0xf6,0xf5,0x83}};
                       
//unsigned char alph[5]={0x83,0xf5,0xf6,0xf5,0x83};

unsigned char  scrollspeed=10;
void off_the_col()
{
   unsigned char m;
                for(m=0;m<=7;m++)
                {
                
                        clk=0;    latch=0;
                        ds=0;
                        clk=1;   latch=1;
                }     
}
 void col_scan(unsigned char colpos)
 {
     unsigned char m,n;
         for(m=0;m<=7;m++)
          {
           clk=0;  latch=0;
           if(m==colpos)
            ds=1;
            else
            ds=0;
            clk=1; latch=1;
         }
     __delay_ms(1);
     off_the_col();
}

void main()
    {
    TRISCbits.TRISC4=0;
    TRISCbits.TRISC5=0;
    TRISCbits.TRISC6=0;
    TRISDbits.TRISD0=0;
    TRISDbits.TRISD1=0;
    TRISDbits.TRISD2=0;
    unsigned char row,j,dataRow,col,z,i,r,c;
    while(1)
    {
        for(row=0;row<2;row++)
        {
            for(i=0;i<8;i++)
            {
              for(z=0;z<=scrollspeed;z++)
                {
                   for(col=0;col<=15;col++)
                     {
                      for (j=0;j<=7;j++)
                       {
                          c=i+col;
                           dataRow=(alph[row][c]<<j)&0x80;
                           clkr=0; latchr=0;
                           if(dataRow==0)
                           dsr=dataRow;
                           else
                           dsr=1;
                           clkr=1; latchr=1;
                           __delay_ms(1);
                      }
                      col_scan(col);   
               }//col
           }//z
            }//i
        }//row
        
               
     }//while
}

What error is showing? What is happening?

  Joined February 12, 2018      696
Monday at 02:11 PM

jaksonlee

Permalink

microcontroller is a compact integrated circuit designed to govern a specific operation in an embedded system. A typical microcontroller includes a processor, memory and input/output A microcontroller is a compact integrated circuit designed to govern a specific operation in an embedded system. A typical microcontroller includes a processor, memory and input/output.

Today, billions of microcontrollers are manufactured and sold each year, making up approximately half of the global processor market. A microcontroller or MCU is a minimal computer implemented on an integrated circuit. It contains memory one or more small CPU and programmable I/O . Microcontrollers are used in a wide range of digital electronic devices, such as smartphones automobiles, and computers peripherals . Their small size and low power requirements make them ideal for use in embadded systems, IOT appliances.

  Joined November 07, 2019      124
Thursday at 04:25 PM

I think that it would be better to show your microcontroller to the professionals. I believe that everyone must be a professional in his deal. 

  Joined January 28, 2020      1
Tuesday at 11:40 AM