Below is the simple program I am working with and it should work. However, the outputs on port B will not stay on. Portb.0 will come on then go off after the 2 second pause, them portb.1 will come on for 2 seconds and go off then portb.2 comes on and stays on. I am using a PIC16F882, simply because I have several laying around.
It has been several years since I worked with PICs and with PBP so I am certain there is something stupidly simple to fix this.
Thank you to anyone who will assist me on this,
Here is the code:
adcon1 = 111
define osc = 8
porta = %00000000
portb = %00000000
portc = %00000000
trisa = %11111111
trisb = %00000000
trisc = %00001111
'Alias define
power1 var portb.0
power2 var portb.1
power3 var portb.2
main:
if portc.0 = 1 then
gosub Startup
endif
if portc.1 = 1 then
gosub shutdown
endif
goto main
startup:
pause 500
high power1
pause 2000
high power2
pause 2000
high power3
'pause 2000
'portb.3 = 1
'pause 2000
'portb.4 = 1
'pause 2000
'portb.5 = 1
'pause 500
return
shutdown:
pause 500
'portb.5 = 0
'pause 2000
'portb.4 = 0
'pause 2000
'portb.3 =0
'pause 2000
low power3
pause 2000
low power2
pause 2000
low power1
pause 500
return
end
Bookmarks