S
smileguitar
Guest
Cod:
LISTA P = 16F877
# Include <P16F877.INC>
errorlevel -302
errorlevel -207
__CONFIG _CP_OFF & _PWRTE_ON & _XT_OSC & _WDT_OFF;========== VARIABILĂ ===============CBLOCK 0X20
NUM1; pentru numărul
NUM2; pentru numărul
NUM3; pentru numărul
NUM4; pentru numărul
D1
D2
D3
D4
ENDCINT 0X00
Mergi la STARTTEXT CALL LCD_INIT
BSF PORTB, 2; R / S setat pe'1 '
MOVLW H'45 "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'6E "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'74 "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'65 "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'72 "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'20 "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'43 "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'6F "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'64 "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'65 "
MOVWF PORTD
CALL CLOCK_E
RETLW 0X00Greşit CALL LCD_INIT
CALL LCD_LINE2
BSF PORTB, 2; R / S setat pe'1 '
MOVLW H'57 "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'72 "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'6F "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'6E "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'67 "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'20 "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'43 "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'6F "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'64 "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'65 "
MOVWF PORTD
CALL CLOCK_E
RETLW 0X00CORECT CALL LCD_INIT
CALL LCD_LINE2
BSF PORTB, 2; R / S setat pe'1 '
MOVLW H'43 "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'6F "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'72 "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'72 "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'65 "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'63 "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'74 "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'20 "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'43 "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'6F "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'64 "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'65 "
MOVWF PORTD
CALL CLOCK_E
RETLW 0X00START BSF STATUS, RP0
MOVLW B'00000001 "
MOVWF TRISB
MOVLW B'00000000 "
MOVWF TRISD
BCF STATUS, RP0
CLRF PORTB
CLRF PORTD
Mergi la BEGINBEGIN CALL TEXT
BTFSC PORTB, 0; Skip DACĂ ENTER = 1
Mergi la BEGIN; DACĂ ENTER = 0 GO TO STARTONE MOVLW D'1 '
MOVWF NUM1; SET NUM1 = 1
SUBLW B'00000001 "; NUM1-1
BTFSS STARE, Z; NUM1-1 = 0?
Mergi la TWO; YES, Go to next NUMĂRUL
Goto greşitTWO MOVLW D'2 '
MOVWF NUM2; SET NUM1 = 2
SUBLW B'00000010 "; NUM2-2
BTFSS STARE, Z; NUM2-2 = 0?
Mergi la trei; YES, Go to next NUMĂRUL
Goto greşitTREI MOVLW D'3 '
MOVWF NUM3; SET NUM1 = 3
SUBLW B'00000011 "; NUM3-3
BTFSS STARE, Z; NUM3-3 = 0?
Mergi la FOUR; YES, Go to next NUMĂRUL
Goto greşitPATRU MOVLW D'4 '
MOVWF NUM4; SET NUM1 = 4
SUBLW B'00000100 "; NUM4-4
BTFSS STARE, Z; NUM4-4 = 0?
Goto greşit; Nu, reveniţi la START
Mergi la CORECTĂ
BSF PORTB, 5LCD_INIT BCF PORTB, 2
MOVLW B'00110000 "
MOVWF PORTD; FUNCŢIA SET: 8 BIT INTERFATA
CALL CLOCK_E
MOVLW B'00001100 "
MOVWF PORTD; DISPALY & CURSOR: SET pentru a le afişa pe; CURSOR Underline OFF; CURSOR Blink OFF
CALL CLOCK_E
MOVLW B'00111000 "
MOVWF PORTD; FUNCŢIA SET: 8 BIT; 2 LINE MODE; 5X10 DOT FORMAT
CALL CLOCK_E
MOVWF B'00000001 "
MOVWF PORTD; clar DISPLAY
CALL CLOCK_E
MOVLW B'00000110 "
MOVWF PORTD; PERSONAJ ENTRY MODE: Increment; DISPLAY SHIFT PE
CALL CLOCK_E
RETLW 0X00LCD_LINE2 BCF PORTB, 2; R / S setat la "0"
MOVLW B'11000000 "
MOVWF PORTD; Salt la 2nd LINE
CALL CLOCK_E
RETLW 0X00CLOCK_E BSF PORTB, 1
CALL DELAY2
BCF PORTB, 1
RETLW 0X00DELAY1 MOVLW D'130 '
MOVWF D2
MOVLW D'221 '
MOVWF D1
LOOP1 DECFSZ D1, 1
Mergi la LOOP1
DECFSZ D2, 1
Mergi la LOOP1
RETLW 0X00DELAY2 MOVLW D'13 "; întârziere 10ms
MOVWF D4
MOVLW D'251 '
MOVWF D3
LOOP2 DECFSZ D3, 1
Mergi la LOOP2
DECFSZ D4, 1
Mergi la LOOP2
RETLW 0X00END
LISTA P = 16F877
# Include <P16F877.INC>
errorlevel -302
errorlevel -207
__CONFIG _CP_OFF & _PWRTE_ON & _XT_OSC & _WDT_OFF;========== VARIABILĂ ===============CBLOCK 0X20
NUM1; pentru numărul
NUM2; pentru numărul
NUM3; pentru numărul
NUM4; pentru numărul
D1
D2
D3
D4
ENDCINT 0X00
Mergi la STARTTEXT CALL LCD_INIT
BSF PORTB, 2; R / S setat pe'1 '
MOVLW H'45 "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'6E "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'74 "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'65 "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'72 "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'20 "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'43 "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'6F "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'64 "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'65 "
MOVWF PORTD
CALL CLOCK_E
RETLW 0X00Greşit CALL LCD_INIT
CALL LCD_LINE2
BSF PORTB, 2; R / S setat pe'1 '
MOVLW H'57 "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'72 "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'6F "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'6E "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'67 "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'20 "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'43 "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'6F "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'64 "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'65 "
MOVWF PORTD
CALL CLOCK_E
RETLW 0X00CORECT CALL LCD_INIT
CALL LCD_LINE2
BSF PORTB, 2; R / S setat pe'1 '
MOVLW H'43 "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'6F "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'72 "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'72 "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'65 "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'63 "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'74 "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'20 "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'43 "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'6F "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'64 "
MOVWF PORTD
CALL CLOCK_E
MOVLW H'65 "
MOVWF PORTD
CALL CLOCK_E
RETLW 0X00START BSF STATUS, RP0
MOVLW B'00000001 "
MOVWF TRISB
MOVLW B'00000000 "
MOVWF TRISD
BCF STATUS, RP0
CLRF PORTB
CLRF PORTD
Mergi la BEGINBEGIN CALL TEXT
BTFSC PORTB, 0; Skip DACĂ ENTER = 1
Mergi la BEGIN; DACĂ ENTER = 0 GO TO STARTONE MOVLW D'1 '
MOVWF NUM1; SET NUM1 = 1
SUBLW B'00000001 "; NUM1-1
BTFSS STARE, Z; NUM1-1 = 0?
Mergi la TWO; YES, Go to next NUMĂRUL
Goto greşitTWO MOVLW D'2 '
MOVWF NUM2; SET NUM1 = 2
SUBLW B'00000010 "; NUM2-2
BTFSS STARE, Z; NUM2-2 = 0?
Mergi la trei; YES, Go to next NUMĂRUL
Goto greşitTREI MOVLW D'3 '
MOVWF NUM3; SET NUM1 = 3
SUBLW B'00000011 "; NUM3-3
BTFSS STARE, Z; NUM3-3 = 0?
Mergi la FOUR; YES, Go to next NUMĂRUL
Goto greşitPATRU MOVLW D'4 '
MOVWF NUM4; SET NUM1 = 4
SUBLW B'00000100 "; NUM4-4
BTFSS STARE, Z; NUM4-4 = 0?
Goto greşit; Nu, reveniţi la START
Mergi la CORECTĂ
BSF PORTB, 5LCD_INIT BCF PORTB, 2
MOVLW B'00110000 "
MOVWF PORTD; FUNCŢIA SET: 8 BIT INTERFATA
CALL CLOCK_E
MOVLW B'00001100 "
MOVWF PORTD; DISPALY & CURSOR: SET pentru a le afişa pe; CURSOR Underline OFF; CURSOR Blink OFF
CALL CLOCK_E
MOVLW B'00111000 "
MOVWF PORTD; FUNCŢIA SET: 8 BIT; 2 LINE MODE; 5X10 DOT FORMAT
CALL CLOCK_E
MOVWF B'00000001 "
MOVWF PORTD; clar DISPLAY
CALL CLOCK_E
MOVLW B'00000110 "
MOVWF PORTD; PERSONAJ ENTRY MODE: Increment; DISPLAY SHIFT PE
CALL CLOCK_E
RETLW 0X00LCD_LINE2 BCF PORTB, 2; R / S setat la "0"
MOVLW B'11000000 "
MOVWF PORTD; Salt la 2nd LINE
CALL CLOCK_E
RETLW 0X00CLOCK_E BSF PORTB, 1
CALL DELAY2
BCF PORTB, 1
RETLW 0X00DELAY1 MOVLW D'130 '
MOVWF D2
MOVLW D'221 '
MOVWF D1
LOOP1 DECFSZ D1, 1
Mergi la LOOP1
DECFSZ D2, 1
Mergi la LOOP1
RETLW 0X00DELAY2 MOVLW D'13 "; întârziere 10ms
MOVWF D4
MOVLW D'251 '
MOVWF D3
LOOP2 DECFSZ D3, 1
Mergi la LOOP2
DECFSZ D4, 1
Mergi la LOOP2
RETLW 0X00END