How to use For Next Loop to run sequence light ?


Results 1 to 14 of 14

Threaded View

  1. #1
    Join Date
    Aug 2010
    Posts
    7

    Default How to use For Next Loop to run sequence light ?

    Code:
    @ DEVICE pic16F628A, INTRC_OSC_NOCLKOUT, MCLR_OFF
    CMCON = 7
     
    Counter var Byte
    Counter = 0
     
    Routine:
     
    For Counter = 0 to 6
    High PortB.Counter
    Next Counter
     
    pause 500
     
    For Counter = 0 to 6
    Low PortB.Counter
    Next Counter
     
    pause 500
     
    GoTo Routine

    Apparently:
    Code:
    High PortB.Counter
    and
    Code:
    Low PortB.Counter
    is giving me errors, I could have done this with no errors:
    Code:
    For Counter = 0 to 6
    High Counter
    Next Counter
    but this will be a PICBasic command and I will not be able to control PortA.

    How do I use the For Next Loop to handle PortA too ?

    Hi,

    PortA.something ... something must be a CONSTANT ...

    so, try indexing PortA

    Code:
    PortA.0[counter] = 1 
    ; OR
    HIGH PortA.0[counter]
    Should compile fine.
    Alain
    Last edited by Acetronics2; - 29th August 2010 at 10:33.

Members who have read this thread : 0

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