Seven segment display 4 digit For Basic PRO Compiler

@ device pic16f877
define osc 4
define adc_bits 8
adcon1 = 7
trisa = $ff
trise = $00
trisc = $00
trisd = $00

digit   var     byte 
num     var     word
disp    var     byte
num =00
while(1)  
      digit = num dig 0
      lookup digit,[$3f,$06,$5b,$4f,$66,$6d,$7d,$07,$7f,$6f],disp
      portd = disp
      high portc.0 
      pause 5   
      low portc.0 

     digit = num dig 1
       lookup digit,[$3f,$06,$5b,$4f,$66,$6d,$7d,$07,$7f,$6f],disp
       portd = disp
      high portc.1 
      pause 5   
      low portc.1 
      digit = num dig 2
      lookup digit,[$3f,$06,$5b,$4f,$66,$6d,$7d,$07,$7f,$6f],disp
      portd = disp
      high portc.2 
      pause 5   
      low portc.2 

     digit = num dig 3
       lookup digit,[$3f,$06,$5b,$4f,$66,$6d,$7d,$07,$7f,$6f],disp
       portd = disp
      high portc.3 
      pause 5   
      low portc.3
  if(!porta.0) then 
        pause 150
       if(num>=9999) then 
        num=0
        else 
        num=num+1
        endif
   endif     
   if(!porta.1) then 
        pause 150
       if(num<=0) then 
        num=9999
        else 
        num=num-1
        endif 
    endif                      
    '   if(num>9999) then 
     '    num=0 
    '  else 
     '  num =num+1  
      'endif
      'pause 5                                                             
 wend
end

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.