16f676 timer interrupt for displaying 2 digit

driving tow 7 segments display by 16f676 mcu.
Used timer 0 interrupt
The codes.. . . . .









'****************************************************************
'*  Name    : 676 0 to 9 blink.BAS                                      *
'*  Author  : WAAGYI                                            *
'*  Notice  : Copyright (c) 2017 FEEL FREE TO SHARE AND MODIFY  *
'*          : All Rights Reserved                               *
'*  Date    : 7/28/2017                                         *
'*  Version : 1.0                                               *
'*  Notes   : 0 to 99 with interrupt on 676   worked                                               *
'*          :                                                   *
'****************************************************************
'****************************************************************

TRISC=000000
TRISA=000000

cnt var byte
cnt1 var word
digit var BYTE
decdigit var BYTE
FIRST VAR BYTE
SECOND var byte
DIGIT1 var PORTC.4
DIGIT2 var PORTC.5


INTCON=100000
OPTION_REG=000111
TMR0=217
on interrupt goto isr
INTCON=%10100000



MAIN:

for cnt=0 to 99

      for cnt1=0 to 10
       decdigit=cnt dig 0
        gosub convert
        first=digit         'convert num to mask
     
        decdigit=cnt dig 1
        gosub convert
        second=digit
 
     
      pause 1
      next cnt1
       next cnt
 
     
 
       goto main
     
     
     
     
     
     

CONVERT:
        lookup decdigit,[$3F,$21,$76,$5E,$4D,$5B,$7B,$4E,$7F,$5F],digit
        digit=digit^$ff
     
     
disable

isr:
     

 TMR0=217
       
        digit1=1
        digit2=0
        PORTA.0=first.0        'arrangements are for ease of connection
        PORTA.1=first.1        'seg1 to seg 7 around ic in clk wise direction
        PORTA.2=first.2
        PORTC.0=first.3
        PORTC.1=first.4
        PORTC.2=first.5
        PORTC.3=first.6
        pause 10
     
        digit1=0
        digit2=1
        PORTA.0=second.0        'arrangements are for ease of connection
        PORTA.1=second.1        'seg1 to seg 7 around ic in clk wise direction
        PORTA.2=second.2
        PORTC.0=second.3
        PORTC.1=second.4
        PORTC.2=second.5
        PORTC.3=second.6
        pause 10
     
 INTCON.2=0
 resume
 enable

     
        the result video

Comments

Popular posts from this blog

Inductance caculator

Pointer to object array