How to use For Next Loop to run sequence light ?


Results 1 to 14 of 14

Threaded View

  1. #10
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Bracer View Post
    But me...trying to "copy" your way, not knowing what I am doing, do this:

    Code:
    PORTA = PORTA | %00000101
    PORTB = PORTB | %00000101
    Pause 500
     
    PORTA = PORTA & %00000010
    PORTB = PORTB & %00000010
     
    pause 500
    PORTA = PORTA | %00000101 = Read PORTA and set to 1 ports A0 and A2

    PORTA = PORTA & %00000010 = Read PORTA and clear ports A0 and A2

    you use " | " ( OR ) to SET portspins and & ( AND ) to clear them ... but no mix allowed

    you can try ...
    Code:
     
    PORTA = PORTA | %00000101
    PORTB = PORTB | %00000101
    .
    .
    .
    .
     
    Subroutine:
     
    PORTA = PORTA ^ %00000111 ' FLIPS the bits with a " 1 " 
    PORTB = PORTB ^ %00000111
     
    pause 500
    GOTO Subroutine
    see your manual " Bitwise Operators " section $4.16.17

    Alain
    Last edited by Acetronics2; - 30th August 2010 at 20:44.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

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