list p=16F84A #include __config _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC bitSDI equ 3 bitCLK equ 2 bitLAT equ 1 iniTMR equ d'022' count1 equ 0x0C dig_U equ 0x0D dig_D equ 0x0E dig_H equ 0x0F impnum equ 0x10 segcod equ 0x11 hdnull equ 0x12 org 0x000 clrf PORTA clrf PORTB clrf INTCON clrf TMR0 clrWDT bsf STATUS,RP0 movlw b'11111111' movwf PORTA movlw b'00000001' movwf PORTB movlw b'01000111' movwf OPTION_REG bcf STATUS,RP0 loop clrf impnum movlw d'010' movwf dig_U movwf dig_D movwf dig_H movwf count1 bcf INTCON,INTF ms600 movlw iniTMR movwf TMR0 bcf INTCON,T0IF ms60 btfss INTCON,INTF goto NoINCR DoINCR incf impnum,f decfsz dig_U,f goto eoINCR movlw d'010' movwf dig_U decfsz dig_D,f goto eoINCR movlw d'010' movwf dig_D decfsz dig_H,f goto eoINCR movlw d'010' movwf dig_H eoINCR bcf INTCON,INTF NoINCR btfss INTCON,T0IF goto ms60 decfsz count1,f goto ms600 clrf hdnull movf dig_H,W call SendDD movf dig_D,W call SendDD bsf hdnull,0 movf dig_U,W call SendDD bsf PORTB,bitLAT nop bcf PORTB,bitLAT nop goto loop SendDD sublw d'010' btfss STATUS,Z goto DoDIGIT btfss hdnull,0 goto DoBLANK DoDIGIT bsf hdnull,0 call SEG_7 DoBLANK movwf segcod movlw 7 movwf count1 BitLoop rlf segcod,f btfss STATUS,C goto SendB0 goto SendB1 SendB0 bcf PORTB,bitSDI goto BitReady SendB1 bsf PORTB,bitSDI nop BitReady bsf PORTB,bitCLK nop bcf PORTB,bitCLK nop decfsz count1,f goto BitLoop return SEG_7 andlw 0x0F addwf PCL,f retlw b'01111110' retlw b'00000110' retlw b'11011010' retlw b'11001110' retlw b'10100110' retlw b'11101100' retlw b'11111100' retlw b'01000110' retlw b'11111110' retlw b'11101110' retlw b'10000000' retlw b'01000000' retlw b'00100000' retlw b'00010000' retlw b'00001000' retlw b'00000100' end