void setup() {
// put your setup code here, to run once:
volatile char *dir2;
dir2=0x30; //configured PORTK as output port
*dir2=0xFF;//configured all the pins as output
volatile char *dir1;
dir1=0x107;//configured PORTF as output port
*dir1=0xFF;//configured all the pins as output
}
void loop() {
// put your main code here, to run repeatedly:
volatile char *out2;
out2=0x31; //configured Data register for PORTK
volatile char *out1;
out1=0x108; //configured Data register for PORTF
int a[10]={0x3F,0x30,0x5B,0x4F,0x64,0x6D,0x7C,0x07,0xFF,0x67};//hex value for 0-9
int b[10]={0x3F,0x30,0x5B,0x4F,0x64,0x6D,0x7C,0x07,0xFF,0x67};//hex value for 0-9
for(int i=0;i<10;i++)// loop for one's position
{
*out1=a[i*1];
*out2=0x3F;
delay(1000);
for(int j=1;j<=9;j++)// loop for ten's position
{
*out1=a[i];
*out2=b[j];
delay(1000);
}
}
}