Shift left – shift right value For Basic PRO Compiler




@ device pic16f877
define osc 4
define adc_bits 8
main:
    trisb =
@ device pic16f877
define osc 4
define adc_bits 8
main:
trisb =$00
trisa =$ff
adcon1 = 7
lamp       var portb
sw1        var porta.0
sw2        var porta.1    
lamp=0
while(1)
if(!sw1) then 
gosub speed1         
pause 50   
endif
if(!sw2) then       
gosub speed2  
pause 50                 
endif                         
pause 10   
wend
end
speed1:
lamp =$80
pause 200
while(sw2)
lamp = lamp >> 1   ' shift right
if lamp = $00 then lamp = $80
pause 200
wend   
return
speed2:
lamp =$01
pause 200
while(sw1)
lamp = lamp << 1  'shift left  
if lamp = $00 then lamp = $01
pause 200
wend    
return
trisa =$ff adcon1 = 7 lamp var portb sw1 var porta.0 sw2 var porta.1 lamp=0 while(1) if(!sw1) then gosub speed1 pause 50 endif if(!sw2) then gosub speed2 pause 50 endif pause 10 wend end speed1: lamp = pause 200 while(sw2) lamp = lamp >> 1 ' shift right if lamp =
@ device pic16f877
define osc 4
define adc_bits 8
main:
trisb =$00
trisa =$ff
adcon1 = 7
lamp       var portb
sw1        var porta.0
sw2        var porta.1    
lamp=0
while(1)
if(!sw1) then 
gosub speed1         
pause 50   
endif
if(!sw2) then       
gosub speed2  
pause 50                 
endif                         
pause 10   
wend
end
speed1:
lamp =$80
pause 200
while(sw2)
lamp = lamp >> 1   ' shift right
if lamp = $00 then lamp = $80
pause 200
wend   
return
speed2:
lamp =$01
pause 200
while(sw1)
lamp = lamp << 1  'shift left  
if lamp = $00 then lamp = $01
pause 200
wend    
return
then lamp = pause 200 wend return speed2: lamp = pause 200 while(sw1) lamp = lamp << 1 'shift left if lamp =
@ device pic16f877
define osc 4
define adc_bits 8
main:
trisb =$00
trisa =$ff
adcon1 = 7
lamp       var portb
sw1        var porta.0
sw2        var porta.1    
lamp=0
while(1)
if(!sw1) then 
gosub speed1         
pause 50   
endif
if(!sw2) then       
gosub speed2  
pause 50                 
endif                         
pause 10   
wend
end
speed1:
lamp =$80
pause 200
while(sw2)
lamp = lamp >> 1   ' shift right
if lamp = $00 then lamp = $80
pause 200
wend   
return
speed2:
lamp =$01
pause 200
while(sw1)
lamp = lamp << 1  'shift left  
if lamp = $00 then lamp = $01
pause 200
wend    
return
then lamp = pause 200 wend return




READ  Output bit For Basic PRO Compiler

Leave a Comment

*
= 4 + 8

Read previous post:
pic-microcontroller

Home Alarm System PIC16F84A Alarm Clock Analog data recording and playback unit Animated LED Signboard Capacitance measurement Capaciter meter Christmas...

Close
Scroll to top