怎么用C语言给74HC595写一个程序来控制数码管
展开全部
给你个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;
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;
威孚半导体技术
2024-08-19 广告
2024-08-19 广告
威孚(苏州)半导体技术有限公司是一家专注生产、研发、销售晶圆传输设备整机模块(EFEM/SORTER)及核心零部件的高科技半导体公司。公司核心团队均拥有多年半导体行业从业经验,其中技术团队成员博士、硕士学历占比80%以上,依托丰富的软件底层...
点击进入详情页
本回答由威孚半导体技术提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询