怎么用C语言给74HC595写一个程序来控制数码管

2024-12-27 23:45:56
推荐回答(3个)
回答1:

给你个51汇编的164和595的驱动吧。有悬赏的话,再提供个C51的164和595.悬赏多的话再给个LPC1114驱动的两个595控制2个4位一体数码管的吧。

DISP:MOV R0,#38H;
MOV R3,#8H;
MOV A,#00001000B;LOOP12:PUSH ACC;
MOV R1,#8H;
LOOP10:RLC A;
CLR CLK_164;
MOV DATA_164,C;
SETB CLK_164;
DJNZ R1,LOOP10;

MOV A,R0;
CJNE A,#3FH,LOOP13;
MOV A,3FH;
JMP LOOP14;
LOOP13:MOV A,@R0;MOVC A,@A+DPTR;
LOOP14:MOV R2,#8H;
CLR RCK0_595;
LOOP11:CLR SCK0_595;
RLC A;
MOV SER0_595,C;
SETB SCK0_595;
DJNZ R2,LOOP11;
SETB RCK0_595;
CALL DELAY50US;

MOV A,#00H;
MOV R2,#8H;
CLR RCK0_595;
LOOP16:CLR SCK0_595;
RLC A;
MOV SER0_595,C;
SETB SCK0_595;
DJNZ R2,LOOP16;
SETB RCK0_595;

POP ACC;
RR A
INC R0;
DJNZ R3,LOOP12;
RET;

回答2:


74H573跟单片机那些IO口连接的?没给出来,怎么写?

回答3:

在PUDN上能下载到,我以前就是在这上面找的