Loop is one of those reserved words in PBP3 and I'm pretty sure in earlier versions. It really fouls things up.
If your inputs and outputs are either high or low you want to set all your pins to digital with analog select register. i.e ansel=0. Otherwise the pins get sensed in the middle and often never toggle.
if you want gpio.0 to be low then I think you need low gpio.0 not just low 0.
I've never used PULSOUT before but I'm certain you need to spell out gpio.0 and not just 0
Most people recommend a CLEAR at beginning and a END at end.
I'd also recommend you turn on capitalization of commands in PBP. It helps me recognize some of the reserved words and commands.
If you'll post schematic I'll run it on simulator if you like.
Code:
clear
Define OSCCAL_1K 1
CMCON=7 ' disable analog comparator
ansel=0
TRISIO=111110 ' set GPIO as output
' others as input
i VAR BYTE
' commented out low 0
low gpio.0
pause 100
' commented outloop:
main:
if GPIO.1=1 then turn1
if GPIO.2=1 then turn2
' commented out goto loop
goto main
turn1:
for i=0 to 5
' comment out pulsout 0, 147
pulsout gpio.0, 147
pause 20
next i
' commented out goto loop
goto main
turn2:
for i=0 to 5
' comment out pulsout 0, 152
pulsout gpio.0, 152
pause 20
next i
'commented out goto loop
goto main
end
Bookmarks