increment program

Status
Not open for further replies.
#include<pic.h>
#include<stdio.h>


void main()

{
int i,j,k,l,p;

char map[10]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F};

TRISD=0x00; // for diplay/led output
TRISC=0x00; // latch control
TRISB=0X00; // display control
RC1=0;
RC0=0;
i=0;
j=0;
k=0;
l=0;
p=0;
while(1000)
{

PORTD=map; //masking the values
RB3=1; //display enable for first display
_delay(7000); //delay
RB3=0;

PORTD=map[j]; //masking the values
RB2=1; //display enable for first display
_delay(7000); //delay
RB2=0; //turn off the display
PORTD=map[k];
//masking the values
RB1=1; //display enable for first display
_delay(7000); //delay
RB1=0;

PORTD=map[l]; //masking the values
RB0=1; //display enable for first display
_delay(7000); //delay
RB0=0;

if(i<10)
{
i++;
}
if(i==10)
{
j++;
i=0;
}
if(j==10)
{
k++;
j=0;
}
if(k==10)
{
l++;
k=0;
}
if(l==10)
{
i=0;
j=0;
k=0;
l=0;
}

}
}
 
Last edited:
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…