Problem with hardware emulator?

Hi,

A program is combined with TM1668 to drive the four digital tube display

I want digital tubes 0, 1, 2 ~ F, to run back and forth

Once I put into the circuit simulation, it occurs some gibberish. Who can help me?

Source program is as follows:
/ / because the hardware program simulation (hard copy) is not the same as I thought
/ / It turns from 0, 1, 2,…E, F and then from 0, 1, 2,…E, F
/ / in order to see where the problem is in this program
/ / so I want to improve
/ /

/ …After the change… /

#include <avr/io.h>
#include <avr/iom48.h>
#include <avr/sfr_defs.h>

#define STB 3
#define CLK 2
#define DIO 1

#define uchar unsigned char
uchar tab1[]={0xfa,0x22,0xb9,0xab,0x60,0xcb,0xdb,0xa2,0xfb,0xeb,0xf3,
0x5b,0xd8,0x3b,0xd9,0xd1,0x00
};
uchar tab2[4]={0x00,0x00,0x00,0x00};
uchar tab3[20]={0,1,2,3,4,5,6,7,
8,9,10,11,12,13,14,15,
16,16,16,16};
void delay1ms(unsigned int);
void set_data(unsigned char);

int main(void)
{
int x=0,y=0,dat0=tab2[0],dat1=tab2[1],dat2=tab2[2],dat3=tab2[3];
DDRB>=0x0e;
DDRD=0xff;
PORTD=0xff;
PORTB>=_BV(DIO);
PORTB>=_BV(CLK);
PORTB>=_BV(STB);
while(1){x=0;
for(x=0;x<20;x++)
{
tab2[3]=tab2[2];
PORTD=tab2[3]; // show what is the fourth word
dat0=tab2[3];

tab2[2]=tab2[1];
PORTD=tab2[2];//show what is the third word
dat1=tab2[2];

tab2[1]=tab2[0];
PORTD=tab2[1];//show what is the second word
dat2=tab2[1];

y=tab3[x];
tab2[0]=tab1[y];
PORTD=tab2[0];//show what is the first word
dat3=tab2[0];

DDRB=0x0e;
PORTB>=_BV(CLK);
PORTB>=_BV(STB);
PORTB&=~_BV(STB);
set_data(0x03);
PORTB>=_BV(STB);

PORTB&=~_BV(STB);
PORTB>=_BV(CLK);
set_data(0x44);
PORTB>=_BV(CLK);
PORTB>=_BV(STB);

PORTB&=~_BV(STB);
PORTB>=_BV(CLK);
set_data(0xc0);
set_data(dat3);
PORTB>=_BV(CLK);
PORTB>=_BV(STB);

PORTB&=~_BV(STB);
PORTB>=_BV(CLK);
set_data(0xc4);
set_data(dat2);
PORTB>=_BV(CLK);
PORTB>=_BV(STB);

PORTB&=~_BV(STB);
PORTB>=_BV(CLK);
set_data(0xc2);
set_data(dat1);
PORTB>=_BV(CLK);
PORTB>=_BV(STB);

PORTB&=~_BV(STB);
PORTB>=_BV(CLK);
set_data(0xc6);
set_data(dat0);
PORTB>=_BV(STB);

PORTB&=~_BV(STB);
PORTB>=_BV(CLK);
set_data(0x8f);
PORTB>=_BV(CLK);
PORTB>=_BV(STB);
PORTB&=~_BV(DIO);
delay1ms(500);
}
}
}

void set_data(unsigned char dat)
{
uchar x1;
DDRB=0x0e;
PORTB>=_BV(CLK);
for(x1=0;x1<8;x1++)
{
PORTB&=~_BV(CLK);
if(dat&(1<<x1))
{
PORTB>=_BV(DIO);
}
else
{PORTB&=~_BV(DIO);
}
PORTB>=_BV(CLK);
}

}

void delay1ms(unsigned int x3)
{unsigned int x2,y2;
for(x2=0;x2<x3;x2++)
for(y2=0;y2<1441;y2++);
}

Regards.