用义隆78P153S驱动数码管,P6驱动段,P52,P53驱动位,其中,除了P62,P64两个段其余的都亮了,不知为何?
程序如下:
ORG 0
JMP MAIN ;PROGRAM START;
NOP
NOP
NOP
NOP
NOP
NOP
NOP
ORG 8
TCCI:
INC SEC
ENI
RETI
;--------------------------------------------
MAIN:
MOV A,@0B11000000
MOV A,@0Xff ;下拉控制寄存器,
;P5.0下拉使能
;P5.1下拉不使能
;P5.2下拉使能
;P6.0下拉使能
;P6.1下拉使能
;P6.2下拉使能
IOW IOCB
MOV A,@0Xff
IOW IOCD ;上啦控制寄存器,P6为上啦使能
MOV A,@0XFE
IOW IOCF
MOV A,@0X40 ;TCC信号源为内部指令始终
MOV CONT,A
SCAN:
MOV A,@0x00 ;;0x0f 不显示
IOW IOC5
MOV A,@0X00
IOW IOC6
INC MY
MOV A,@0X07;
MOV P5,A
MOV A,@0X00;
MOV P6,A
CALL F_DELAY
SCAN0:
NOP
NOP
MOV A,R6 ;读P6口寄存器
MOV A,@0X0b;
MOV P5,A
MOV A,@0X00;
MOV P6,A
CALL F_DELAY
MOV A,@0Xff;
MOV P6,A
MOV A,@0X07;
MOV P5,A
MOV A,@0Xbf;
MOV P6,A
CALL F_DELAY
MOV A,@0Xff;
MOV P6,A
SCAN1:
COM P5
JMP SCAN0;
;--------------------------------------------
F_DELAY:
MOV A,@200
MOV SEC,A
L_LOP:
DJZ SEC
JMP L_LOP
RET |