Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
1.4 kB
2
Indexable
Never
LIST P=16F877A 
#INCLUDE<P16F877A.INC> 
__CONFIG _CP_OFF & _WDT_OFF & _BODEN_OFF & _PWRTE_ON & _HS_OSC & _WRT_OFF & _LVP_OFF & _CPD_OFF 
 
TIN equ 0x20 
ONE equ 0x21 
VAL equ 0x22 
C1  equ 0x23 
 
    ORG     0x00 
    GOTO    Main 
     
    ORG     0x50  
MAPPING: 
    ADDWF   PCL,F 
    RETLW    0XC0 
    RETLW    0xF9 
    RETLW    0xA4 
    RETLW    0xB0 
    RETLW    0x99 
    RETLW    0x92 
    RETLW    0x82 
    RETLW    0xF8 
    RETLW    0x80 
    RETLW    0x90 
     
    ORG     0x100 
Main: 
    BANKSEL TRISB 
    MOVLW 0X00 
    MOVWF TRISB 
    MOVWF TRISD 
    MOVLW 0X38 
    MOVWF OPTION_REG 
    MOVLW 0X10 
    MOVWF TRISA 
    BANKSEL TMR0 
    CLRF TMR0 
    CLRF PORTD 
    CLRF PORTB 
    CLRF TIN 
    CLRF ONE 
     
  
LOOP: 
    CALL CHECK 
    CALL PRINT 
    GOTO TINS 
     
     
TINS: 
    CLRF TIN 
    CLRF ONE 
    MOVF TMR0,0 
    MOVWF VAL 
    MOVLW 0X0A 
LOOP1: 
    SUBWF VAL,1 
    BTFSC VAL,7 
    GOTO ONES 
    INCF TIN 
    GOTO LOOP1 
ONES: 
    ADDWF VAL,0 
    MOVWF ONE 
    GOTO LOOP 
     
 
 
    ORG 0X400 
PRINT: 
    MOVF TIN,0 
    CALL MAPPING 
    MOVWF PORTB 
    MOVF ONE,0 
    CALL MAPPING 
    MOVWF PORTD 
    RETURN 
CHECK: 
    MOVF TMR0,0 
    MOVWF C1 
    MOVLW D'100' 
    XORWF C1,1 
    BTFSC STATUS,Z 
    CLRF TMR0 
    RETURN 
     
    END
Leave a Comment