新聞中心

EEPW首頁 > 嵌入式系統(tǒng) > 設計應用 > 51單片機驅動ads774匯編程序

51單片機驅動ads774匯編程序

作者: 時間:2016-12-01 來源:網(wǎng)絡 收藏
51單片機驅動模數(shù)轉換器ads774數(shù)據(jù)采集匯編程序,脈沖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右移一字節(jié)MOV B,AANL A,#0F0HSWAP AMOV R2,AMOV A,BANL A,#0FHSWAP AMOV R5,AMOV A,R3ANL A,#0F0HSWAP AADD A,R5MOV R3,ARET


評論


技術專區(qū)

關閉