Forverse – Reverse Control For Basic PRO Compiler

@ device  PIC16F877 
define osc 4
define adc_bits 8
main:

    trisb =$00
    trisa =$ff
    adcon1 = 7
    sw1     var porta.0
    sw2     var porta.1 
    sw3     var porta.2           
    lamp1   var portb.0
    lamp2   var portb.1     
    lamp1=0 
    lamp2=0     

while(1)  
     if(!sw1 and sw2 and sw3) then 
       repeat    
        lamp1=1
        lamp2=0
        pause 10         
      until(!sw3):endif
     if(sw1 and !sw2 and sw3) then 
       repeat    
        lamp1=0
        lamp2=1
        pause 10         
      until(!sw3):endif  
     if(sw1 and sw2 and !sw3) then 
       repeat    
        lamp1=0
        lamp2=0
        pause 10         
      until(!sw1 or !sw2):endif        
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