jimmyvarghese143
New Member
include<pic.h>
unsigned short mask(unsigned short num) {
switch (num)
{
case 0 : return 0x3F;
case 1 : return 0x06;
case 2 : return 0x5B;
case 3 : return 0x4F;
case 4 : return 0x66;
case 5 : return 0x6D;
case 6 : return 0x7D;
case 7 : return 0x07;
case 8 : return 0x7F;
case 9 : return 0x6F;
} //case end
}
void main()
{
int c;
int d;
TRISD=0; //
TRISB=0X00;
TRISC=0X00;
PORTC=0X02;
PORTC=0X00;
c=0;
while(c<100)
{
d++;
while(d=5000)
{
c++;
d=0;
PORTD=c;
PORTB=0X01;
_delay(5000);
PORTB=0X00;
}
}
}
i am a beginner in c programming..i am getting the continuous display,bt that runs very fast.how to correct this program?how i can give proper delay for that?
unsigned short mask(unsigned short num) {
switch (num)
{
case 0 : return 0x3F;
case 1 : return 0x06;
case 2 : return 0x5B;
case 3 : return 0x4F;
case 4 : return 0x66;
case 5 : return 0x6D;
case 6 : return 0x7D;
case 7 : return 0x07;
case 8 : return 0x7F;
case 9 : return 0x6F;
} //case end
}
void main()
{
int c;
int d;
TRISD=0; //
TRISB=0X00;
TRISC=0X00;
PORTC=0X02;
PORTC=0X00;
c=0;
while(c<100)
{
d++;
while(d=5000)
{
c++;
d=0;
PORTD=c;
PORTB=0X01;
_delay(5000);
PORTB=0X00;
}
}
}
i am a beginner in c programming..i am getting the continuous display,bt that runs very fast.how to correct this program?how i can give proper delay for that?
Last edited: