完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
扫一扫,分享给好友
刚学单片机几乎一窍不通,找个大神带一下 有时间的大神帮忙 看看怎么在下面程序基础上插入一个简单的锯齿波程序 和数码管显示程序实现对不同波形显示不同数字 比如 ORG 0000H LJMP MAIN ORG 0100H MAIN: JNB P1.0,P10 JNB P1.1,P11 JNB P1.2,P12 LJMP MAIN P10: MOV R7,#00H LCALL SQU LJMP MAIN P11: MOV R7,#01H LCALL TRI LJMP MAIN P12: MOV R7,#02H LCALL SIN LJMP MAIN SQU: JNB P1.1,N1 JNB P1.2,N2 LJMP SSQU N1: MOV R7,#01H LJMP TC0 N2: MOV R7,#02H LJMP TC0 SSQU: CJNE R7,#00H,TC0 MOV R0,#00H K00: MOV P0,#0FFH MOV P2,#0FFH MOV A,P2 CPL A MOV R3,A L00: DEC R3 CJNE R3,#255,L00 INC R0 INC R0 CJNE R0,#254,K00 MOV R0,#00H K01: MOV P0,#00H MOV P2,#0FFH MOV A,P2 CPL A MOV R3,A L01: DEC R3 CJNE R3,#255,L01 INC R0 INC R0 CJNE R0,#254,K01 LJMP SQU TC0: RET TRI: JNB P1.0,N3 JNB P1.2,N4 LJMP TTRI N3: MOV R7,#00H LJMP TC2 N4: MOV R7,#02H LJMP TC2 TTRI: CJNE R7,#01H,TC2 MOV R0,#00H K20: MOV P0,R0 MOV P2,#0FFH MOV A,P2 CPL A MOV R3,A L20: DEC R3 CJNE R3,#255,L20 INC R0 INC R0 CJNE R0,#254,K20 K21: MOV P0,R0 MOV P2,#0FFH MOV A,P2 CPL A MOV R3,A L21: DEC R3 CJNE R3,#255,L21 DEC R0 DEC R0 CJNE R0,#0,K21 LJMP TRI TC2: RET SIN: JNB P1.0,N5 JNB P1.1,N6 LJMP SSIN N5: MOV R7,#00H LJMP TC3 N6: MOV R7,#01H LJMP TC3 SSIN: CJNE R7,#02H,TC3 MOV R0,#00H K30: MOV A,R0 MOV DPTR,#TAB MOVC A,@A+DPTR MOV P0,A INC R0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H,3EH,3FH,40H,42H DB 43H,45H,46H,48H,49H,4BH,4DH,4EH,50H,52H,54H,55H,57H,59H,5BH,5DH DB 5FH,61H,63H,65H,67H,69H,6BH,6DH,6FH,71H,73H,75H,77H,79H,7BH,7DH END |
|
相关推荐 |
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
464 浏览 0 评论
478 浏览 1 评论
基于瑞萨FPB-RA4E2智能床头灯项目——1编译环境搭建与点亮驱动ws2812全彩LED
439 浏览 0 评论
嵌入式学习-飞凌嵌入式ElfBoard ELF 1板卡-LCD显示图片编程示例之介绍mmap
994 浏览 0 评论
《DNESP32S3使用指南-IDF版_V1.6》第二章 常用的C语言知识点
1056 浏览 0 评论
【youyeetoo X1 windows 开发板体验】少儿AI智能STEAM积木平台
11779 浏览 31 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-25 02:06 , Processed in 0.561488 second(s), Total 70, Slave 52 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号