16f819 - acting strange... only does first line of code


Closed Thread
Results 1 to 2 of 2
  1. #1
    4Lewis's Avatar
    4Lewis Guest

    Default 16f819 - acting strange... only does first line of code

    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

  2. #2
    Join Date
    Feb 2003
    Location
    Salt Lake City, Utah USA
    Posts
    517


    Did you find this post helpful? Yes | No

    Default

    In your cw and ccw subroutines, change your "Goto Main" line to "Return".

    Paul Borgmeier
    Salt Lake City, Utah
    USA

Similar Threads

  1. decoding quadrature encoders
    By ice in forum mel PIC BASIC Pro
    Replies: 93
    Last Post: - 28th February 2017, 09:02
  2. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 08:26
  3. Writing code for battery operated projects
    By jessey in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 16th June 2005, 03:39
  4. Spooked code lines
    By POLA in forum General
    Replies: 1
    Last Post: - 27th March 2005, 20:40
  5. Line following robot... problems with some code
    By nepstar in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 24th March 2005, 01:10

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts