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




READ  Analog to dugital 8 bits For Basic PRO Compiler

Leave a Comment

*
= 4 + 5

Read previous post:
MWC: MediaTek first with ARM’s Cortex-A72 ‘PC-class’ mobile chip

MediaTek expects to see the first smartphone with a mobile processor it has designed based on an ARM Cortex-A72 dual...

Close
Scroll to top