#include<reg51.H>
#include<intrins.h>
#define LED_1 0x5b
#define LED_2 0x76
#define LED_3 0x3f
#define LED_4 0x3e
#define uchar unsigned char
void delay_ms(uchar);
main(){
while(1){
P2 &= 0x3f; //选位
P0 = ~0x01;
delay_ms(1);
P2 |= 0xe0;
_nop_();
_nop_();
P2 &= 0x1f; //锁存数据并点亮
P0 = LED_1;
_nop_();
_nop_();
P2 |= 0xe0;
_nop_();
_nop_();
P2 &= 0x3f; //2
P0 = ~0x02;
delay_ms(1);
P2 |= 0xe0;
_nop_();
_nop_();
P2 &= 0x1f; //
P0 = LED_2;
_nop_();
_nop_();
P2 |= 0xe0;
_nop_();
_nop_();
P2 &= 0x3f; //3
P0 = ~0x04;
delay_ms(1);