PDA

View Full Version : 16f819 - acting strange... only does first line of code



4Lewis
- 10th May 2006, 21:49
Hello:

Can someone see if there is something wrong with this code? It runs an H-Bridge on PortB.2 and B.3 and then blinks a light on PortB.4.

No matter what I do it only runs the first line of code, so whatever is there is all it does.
-------------------------------------------
Define OSC 4
TRISB = %00000000 'set PortB to output
TRISA = %10111111 'set A.0-5,7 as input/ A.6 as output

output PortB.2
output PortB.3
output PortB.5

Main:
gosub clockwise
High PortB.5 'LED ON
LOW PortB.5 'LED OFF
gosub counterclockwise
High PortB.5 'LED ON
PAUSE 50000 'PAUSE
LOW PortB.5 'LED OFF
Goto main

clockwise:
low PortB.3
high PortB.2
GOTO Main

counterclockwise:
high PortB.3
low PortB.2
goto Main

paul borgmeier
- 10th May 2006, 22:53
In your cw and ccw subroutines, change your "Goto Main" line to "Return".

Paul Borgmeier
Salt Lake City, Utah
USA