البرنامج الأصل
LIST P=16F84 #include p16f84.inc __CONFIG 0x3FF9 #define bank0 bcf 3,5 #define bank1 bsf 3,5 porta equ h'5' portb equ h'6' trisa equ h'5' trisb equ h'6' status equ h'3' pcl equ h'2' intcon equ h'0b' option_reg equ h'81' delay equ h'0e' f equ 1 w equ 0 one equ 12 ten equ 13 c equ 0 gie equ 7 inte equ 4 intf equ 1 org 0 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; display1 macro bcf porta,0 call timer endm ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; display2 macro bcf porta,1 call timer endm ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; goto start org 4 goto isr menu addwf pcl,f retlw b'01111110';0 retlw b'00001100';1 retlw b'10110110';2 retlw b'10011110';3 retlw b'11001100';4 retlw b'11011010';5 retlw b'11111010';6 retlw b'01001110';7 retlw b'11111110';8 retlw b'11011110';9 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; start clrf portb clrf porta clrf one clrf ten bank1 movlw b'00000001' movwf trisb movlw b'00000' movwf trisa movlw b'11000000' movwf option_reg movlw b'10010000' movwf intcon bank0 mplx movlw b'11' movwf porta; disable ones & tens movf one,w call menu movwf portb; show number display1;on disp1 movf ten,w call menu bsf porta,0 movwf portb; show number display2 bsf intcon,gie goto mplx ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; isr movlw b'11'; disable ones & tens movwf porta bcf intcon,intf incf one,f bcf status,c movlw d'246'; one >= 10? addwf one,w ;;;;;;;;;;;;;;;;;;;;;;;;;; btfsc status,c goto next; if yes ;;;;;;;;;;;;;;;;;;;;;;;;;; goto mplx ;;;;;;;;;;;;;;;;;;;;;;;;;;;; next clrf one incf ten,f movlw d'246' addwf ten,w btfsc status,c clrf ten goto mplx ;;;;;;;;;;;;;;;;;;;;;;;;;;; timer clrf delay inc incf delay btfss delay,4 goto inc clrf delay return end
تم تعديل هذه المشاركة بواسطة tell me في 15 نوفمبر 2004 في 13:40
{وقل ربي زدني علماً}

