⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 count868.asm

📁 89C51 based counter program 5 Digit
💻 ASM
字号:
;***********************************************************************
;TAXI FARE METER & AMICUS BUS AUTOMATION
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;***********************************************************************
;Chip: P89C51RD2BN, Phillips, Crystal: 6MHz,                 
;
;***********************************************************************
;
;Programed by:	Engr. Shahid		
                                       	
;				M/S Engineering Complex                       
;				415, Lion Shopping Complex             
;				73 Monipuripara, Airport Road          
;				Tejgaon, Dhaka-1215, Bangladesh.       
;				Ph: +880-2-9137453, +880-1713-062224                     
;				Fax:+880-2-9139563                    
;				E-mail: ecl@dhaka.net                                   
;
;******************************************************
;Date of Development: 	09/05/2004, Day: SUnday       *
;Date of Modification : 09/05/2004, Day: Sunday       *
;Version: 1.10                                        *
;******************************************************
;
;Connection List:
;	    U6/CD4514   U7/ULN2003  U8/ULN2003  H1	7-SEG.  Cathod
;==============================================================
;		S0/11		1-16		-			21	DS0		K0 
;		S1/9		2-15		-			22	DS1		K1
;		S2/10		3-14		-			23	DS2		K2
;		S3/8		4-13		-			24	DS3		K3
;		S4/7		5-12		-			25	DS4		K4
;		S5/6		6-11		-			26	DS5		K5
;		S6/5		7-10		-			27	DS6		K6
;		S7/4		-			1-16		14	DS7		K7
;		S8/18		-			2-15		15	DS8		K8
;		S9/17		-			3-14		16	DS9		K9
;		S10/20		-			4-13		17	DS10	K10
;		S11/19		-			5-12		18	DS11	K11
;		S12/14		-			6-11		19	DS12	K12
;		S13/13		-			7-10		20	DS13	K13
;		S14/16		-			-  	N/C
;		S15/15		-			-   N/C
;
;		U3/89C52    H1
;===========================================================
;		P2.0/21     N/C    
;		P2.1/22     3 All LED Anode(Via R10 4K7,Q9/2N4403 PNP,
;									Collector to All LED Anode, Emitter to Vcc).
;		P2.2/23     5 All Switches(R9/4K7 Connected to Vcc from P2.2)
;		P2.3/24     CD4511/U5/Pin-3/^LT(Normally to be High).
;		P2.4/25     6 All dp's(Via R7/4K7, Q7/2N403,
;							   collector to All dp's Anode, Emitter to Vcc).
;		P2.5/26     U6/CD4514/Pin-1/Strobe
;		P2.6/27     CD4511/U5/Pin-5/LE(Low for On, High for OFF the SEGMENT).
;		P2.7/28     U4/DS12C885/Pin-13/^CS
;
;		P0.0/39     U5/CD4511/Pin-7 and U6/CD4514/Pin-2  A Input and U4/DS12C885/AD0/Pin-4 
;		P0.1/38     U5/CD4511/Pin-1 and U6/CD4514/Pin-3  B Input and U4/DS12C885/AD1/Pin-5
;		P0.2/37     U5/CD4511/Pin-2 and U6/CD4514/Pin-21 C Input and U4/DS12C885/AD2/Pin-6
;		P0.3/36     U5/CD4511/Pin-6 and U6/CD4514/Pin-22 D Input and U4/DS12C885/AD3/Pin-7
;
;		P0.4/35     U4/DS12C885/AD4/Pin-8
;		P0.5/34     U4/DS12C885/AD5/Pin-9
;		P0.6/33     U4/DS12C885/AD6/Pin-10
;		P0.7/32     U4/DS12C885/AD7/Pin-11
;		ALE/30      U4/DS12C885/AS /Pin- 14 
; 		
;       CD4514 Output should be low for Segment Display,i.e: ULN Input High.


		$MOD51
		ORG 00H
		;
		MOV SP,#30H;Set SP to 30H
		; 
START:	
		CLR P1.7	; Buzzer OFF
		SETB P2.6 	;Pin 5 of CD4511 ^LE. for OFF the segment display.
		MOV 40H,#00H
		MOV 41H,#0FFH
		MOV 42H,#0FFH
		MOV 43H,#0FFH
		MOV 44H,#0FFH
		MOV 45H,#0FFH
		MOV 46H,#0FFH
		MOV 47H,#0FFH
		MOV 48H,#0FFH
		MOV 49H,#0FFH
		MOV 4AH,#0FFH
		MOV 4BH,#0FFH
		MOV 4CH,#0FFH
		MOV 4DH,#0FFH
        ;
        ;
        MOV 50H,#00H
        MOV 51H,#00H
        MOV 52H,#00H
        MOV 53H,#00H
        MOV 54H,#00H
        MOV 55H,#00H
        ;
        ;
		SETB P2.1 ; All LED OFF
		CLR  P2.2 ; All SW    
		SETB P2.3 ;CD4511/U5/Pin-3/^LT(Normally to be High).
		;SETB P2.4 ; All dp's OFF
        ;CLR P2.4   
        ;
        MOV TMOD,#01100000B
        MOV TH1,#0
        MOV TL1,#0
        SETB P3.5
        SETB TR1
        ;       
DISP:	ACALL BCD1 
AGAIN:	MOV R0,#40H
		MOV R4,#0DH
BACK:	CJNE @R0,#0FFH,SEG
        SJMP SEG1
SEG:	MOV P0,R4
		SETB P2.5 ;Strobe for CD4514 
		NOP
		NOP
		NOP
		CLR P2.5
		MOV P0,@R0
		CLR  P2.6 ;Pin 5 of CD4511 ^LE. for ON the segment display.  	
		NOP
		NOP
		NOP
		SETB P2.6 ;Pin 5 of CD4511 ^LE. for OFF the segment display.
SEG1:	ACALL DELAY
		DEC R4
		INC R0
		CJNE R4,#08H,BACK
RE:		SJMP DISP


		ORG 150H
BCD1:	MOV 40H,TL1
		MOV A,40H 
		ANL A,#0FH
		CJNE A,#0AH,REP
		MOV TL1,#0
		MOV 40H,#0
S1:		INC 41H
		;
		MOV A,41H
		JZ S1
		CJNE A,#0AH,REP
		MOV TL1,#0
		MOV 40H,#0
		MOV 41H,#0
S2:		INC 42H
		;
		MOV A,42H
		JZ S2
		CJNE A,#0AH,REP
		MOV TL1,#0
		MOV 40H,#0
		MOV 41H,#0
		MOV 42H,#0
S3:		INC 43H
		;
		MOV A,43H
		JZ S3
		CJNE A,#0AH,REP
		MOV TL1,#0
		MOV 40H,#0
		MOV 41H,#0
		MOV 42H,#0
		MOV 43H,#0
S4:		INC 44H
		;
		MOV A,44H
		JZ S4
		CJNE A,#0AH,REP
		MOV TL1,#0
		MOV 40H,#0
		MOV 41H,#0
		MOV 42H,#0
		MOV 43H,#0
		MOV 44H,#0
S5:		INC 45H
		;
		MOV A,45H 
		JZ S5
		CJNE A,#0AH,REP
		MOV TL1,#0
		MOV 40H,#0FFH
		MOV 41H,#0FFH
		MOV 42H,#0FFH
		MOV 43H,#0FFH
		MOV 44H,#0FFH
		MOV 45H,#0FFH
REP:	RET
		
		ORG 300H
DELAY:	
		MOV R2,#2
Loop2:	MOV R3,#229	;1 Machine cycle 
Loop1:	NOP
		NOP
		DJNZ R3,Loop1
		DJNZ R2,Loop2
		RET		;return to caller   
		END

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -