你找那个kile c的代码搜一下算了,
#include
#define uchar unsigned char
#define uint unsigned int
uchar b=5,c;
unsigned char code a[]=;
sbit sg=P1^0;
sbit sy=P1^1;
sbit sr=P1^2;
sbit hg=P1^3;
sbit hy=P1^4;
sbit hr=P1^5;
sbit ge=P1^6;
sbit shi=P1^7;
uint num1,num2,num3;
void delay(unsigned int z1)
{
unsigned int a1,b1;
for(a1=z1;a1>0;a1--)
for(b1=12500;b1>0;b1--);
}
void main()
{
P2=0;
P1=0;
shi=1;
P2=a[8];
shi=0;
ge=1;
P2=a[4];
ge=0;
TMOD=0X11;
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
TH1=(65536-50000)/256;
TL1=(65536-50000)%256;
EA=1;
ET0=1;
ET1=1;
TR0=1;
TR1=1;
while(1)
{
switch(num2) //红绿灯
{
case(0): //10s内s绿灯亮
sr=0;
hg=0;
sg=1;
hr=1;
break;
case(1): //5S:竖黄横红
sg=0;
sy=1;
delay(5);
sy=0;
delay(5);
break;
case(2): //10s:竖红横绿
sg=0;
sr=1;
sy=0;
hg=1;
hr=0;
break;
case(3): //5S:竖红横黄
hg=0;
hy=1;
delay(5);
hy=0;
delay(5);
break;
}
}
}
void timer0() interrupt 1 //定时器0
{
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
num1++;
if(num1==200)
num2=1;
if(num1==300)
num2=2;
if(num1==500)
num2=3;
if(num1==600)
{
num1=0;
num2=0;
}
}
void timer1() interrupt 3 //定时器1
{
TH1=(65536-50000)/256;
TL1=(65536-50000)%256;
num3++;
if(num3>=20) //数码管显示
{
num3=0;
c++;
ge=1;
P2=a[b++];
ge=0;
if(b>=10)
b=0;
if(b==1)
{
P2=a[9];
shi=1;
shi=0;
}
if(c>=15)
{
c=0;
shi=1;
P2=a[8];
shi=0;
ge=1;
P2=a[4];
ge=0;
b=5;
}
}
}
CODE SEGMENT
ASSUME CS:CODE
IOCONPT EQU 0073H
IOAPT EQU 0070H
IOBPT EQU 0071H
IOCPT EQU 0072H
IOBDATA EQU 0500H
CONTPORT EQU 00DFH
DATAPORT EQU 00DEH
DATA1 EQU 0640H
START:
MOV AX,0H
MOV DS,AX
MOV AL,82H
MOV DX,IOCONPT
OUT DX,AL
MOV DX,IOCONPT
MOV AL,80H
OUT DX,AL
MOV AL,0FH
MOV DX,IOBPT
OUT DX,AL
MOV DX,IOCPT
MOV AL,0F0H
OUT DX,AL
CALL DELAY1
D0: MOV AL,5AH
MOV DX,IOCPT
OUT DX,AL
CALL DELAY1
CALL DELAY1
MOV AL,0AH
OUT DX,AL
MOV CX,8H
D1: MOV DX,IOBPT
MOV AL,5FH
OUT DX,AL
CALL DELAY2
MOV AL,00
OUT DX,AL
CALL DELAY2
LOOP D1
MOV DX,IOCPT
MOV AL,0FH
OUT DX,AL
CALL DELAY2
MOV AL,0A5H
OUT DX,AL
CALL DELAY1
CALL DELAY1
MOV AL,05H
OUT DX,AL
MOV CX,8H
D2: MOV DX,IOBPT
MOV AL,0AFH
OUT DX,AL
CALL DELAY2
MOV AL,00
OUT DX,AL
CALL DELAY2
LOOP D2
MOV DX,IOCPT
MOV AL,0FH
OUT DX,AL
CALL DELAY2
JMP D0
DELAY1: PUSH AX
PUSH CX
MOV CX,0030H
DELY2: CALL DELAY2
LOOP DELY2
POP CX
YAN1: POP AX
CMP CX,00
JE YAN
RET
YAN:MOV BX,00
ADD BX,01H
MOV CX,0030H
CMP BX,10H
JE YAN1
DELAY2: PUSH CX
MOV CX,8000H
DELA1: LOOP DELA1
POP CX
RET
CODE ENDS
END START
A端口地址218H;B端口地址219H;C端口地址21AH;控制口地址21BH。
---------
这是什么系统?
有点像8088的PC机?