微波EDA网,见证研发工程师的成长!
首页 > 硬件设计 > 嵌入式设计 > 51单片机驱动ads774汇编程序

51单片机驱动ads774汇编程序

时间:12-01 来源:互联网 点击:
51单片机驱动模数转换器ads774数据采集汇编程序,脉冲6061五个,BCD码78~7B,段码70~73,TIM0用7FH,看门狗P3.3 。
ORG 0LJMP MAINORG 000BHTM1:LJMP TIM0ORG 0100HMAIN:MOV SP,#30HMOV R0,#20H;20--7F=0CLR AMOV R7,#60HINB1:MOV @R0,AINC R0DJNZ R7,INB1MOV IP,#02HMOV 7FH,#7MOV TMOD,#11HMOV TL0,#0AEHMOV TH0,#74HSETB TR0SETB ET0CLR   P3.3         ;WATCH DOG CLOCKNOPSETB  P3.3SETB EACA0:MOV DPTR,#7FFFHMOV A,#0D1HMOVX @DPTR,AIN1:MOVX A,@DPTRJB ACC.7,IN1MOV A,#30HMOVX @DPTR,AMOV A,#08HMOVX @DPTR,AED: lcall abcdCLR   P3.3         ;WATCH DOG CLOCKNOPSETB  P3.3SJMP EDDSY2:NOP;BCD码78~7B转为段码送入70~73MOV R7,#04HMOV R1,#70HMOV R0,#78HDIS2: MOV A,@R0MOV DPTR,#DDDAMOVC A,@A+DPTRMOV @R1,AINC R0INC R1DJNZ R7,DIS2DDD8:NOPRETDSY3:MOV DPTR,#7FFFHMOV A,#90HMOVX @DPTR,AMOV R7,#04H ;段码送显示,共4位MOV R0,#70HTM00: MOV A,@R0MOV DPTR,#7FFEHMOVX @DPTR,AINC R0DJNZ R7,TM00CLR AMOVX @DPTR,AMOVX @DPTR,AMOVX @DPTR,AMOVX @DPTR,ARETDDDA:DB 3FH,06H,5BHDB 4FH,66H,6DHDB 7DH,07H,7FHDB 6FH,77H,7CHDB 39H,5EH,79HDB 71H,7CH,39HDB 5EH,3EH,6EHDB 40H,0FFH,0BFHDB 76H,00H,00HDB 00H,00H,00HBICD:CLR AMOV 61H,AMOV 62H,AMOV R1,#10HCLR CBIC1:MOV A,@R0RLC AMOV @R0,AMOV A,61HADDC A,61HDA AMOV 61H,AMOV A,60HADDC A,60HDA AMOV 60H,ADJNZ R1,BIC1BBBB:RETAD:MOV A,BMOV R0,#60HMOV R7,#5;5次A/DADD1:MOV A,#7LCALL AO00ADD3:MOV A,R2MOV @R0,AINC R0MOV A,R3MOV @R0,AINC R0DJNZ R7,ADD1MOV R0,#64H;6465拆分送入78--7BHMOV R1,#78H;Z6:MOV A,@R0MOV B,AANL A,#0F0HSWAP AMOV @R1,AMOV A,BANL A,#0FHINC R1MOV @R1,AINC R0MOV A,@R0MOV B,AANL A,#0F0HSWAP AINC R1MOV @R1,AMOV A,BANL A,#0FHINC R1MOV @R1,ARETTIM0:NOPCLR TR0MOV TH0,#74HMOV TL0,#0AEHSETB TR0PUSH DPLPUSH DPHPUSH BPUSH PSWPUSH ACCSETB PSW.4DEC 7FHMOV A,7FHCJNE A,#00H,TTTMOV 7FH,#7LCALL ADLCALL DSY2LCALL DSY3TTT:POP ACCPOP PSWPOP BPOP DPHPOP DPLRETIAO0:MOV A,#0AO00: MOV DPTR,#0BFFFHMOVX @DPTR,A;通道@ACCLCALL ABCDCLR P1.5;A0/SC=P1.5=0,R/C=P1.6=0启动CLR P1.6LCALL ABCDMOVX @DPTR,ALCALL ABCDSETB P1.6  ;停止启动LCALL ABCDMOVX A,@DPTR;R/C=RD^A574=1,平时=0MOV R2,A;高8位A0/SC=P1.5=0,R/C=1SETB P1.5LCALL ABCDMOVX A,@DPTRMOV R3,A;低4位A0/SC=P1.5=1LCALL AD1RETABCD:MOV R5,#40HABC1:DJNZ R5,ABC1RETAD1:MOV A,R2;R2R3右移一字节MOV B,AANL A,#0F0HSWAP AMOV R2,AMOV A,BANL A,#0FHSWAP AMOV R5,AMOV A,R3ANL A,#0F0HSWAP AADD A,R5MOV R3,ARET

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top