Single PIC to Blink 5 LEDs Independently?


Results 1 to 40 of 69

Threaded View

  1. #17
    Join Date
    Aug 2005
    Location
    Michigan, USA
    Posts
    224


    Did you find this post helpful? Yes | No

    Default Re: Single PIC to Blink 5 LEDs Independently?

    Quote Originally Posted by Darrel Taylor View Post
    It is equivelent to ...
    Code:
    IF LoopLED(x) < OnTime(x) THEN
        GPIO.0(x) = 1
    ELSE
        GPIO.0(x) = 0
    ENDIF
    What you would like to do is a direct assignment of a True/False comparison to a variable.
    Code:
    GPIO.0(x) = LoopLED(x) < OnTime(x)
    But LoopLED(x) < OnTime(x) is a "Logical" expression that can't be assigned to a BIT variable.

    The bitwise NOT operator (!) can convert the logical expression to a bitwise expression that can be assigned to a BIT variable.

    A single ! will invert the result, so a second ! is used to invert it back.
    Somtimes you want the result inverted, and you can use a single !.
    Other times you might invert the logic of the comparison, use a single !, which gives you a non-inverted result.
    Could the comparison have been reversed, like this?

    Code:
    GPIO.0(x) = !(LoopLED(x) >= OnTime(x))
    Also, is the GPIO.0(x) a valid PBP construct? It's not very intuitive (to me). I would think that GPIO.0 is the GP0 pin and then the (x) looks really alien...
    Last edited by Mike, K8LH; - 30th October 2012 at 15:03.

Similar Threads

  1. Single button function
    By DynamoBen in forum mel PIC BASIC Pro
    Replies: 40
    Last Post: - 4th April 2020, 18:33
  2. How to blink 8 LEDs at different rates- concurrently?
    By rmteo in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 26th April 2010, 23:47
  3. single sided PCB
    By schu4647 in forum General
    Replies: 1
    Last Post: - 10th December 2008, 18:22
  4. Can't Blink 2 LEDs
    By dfort in forum mel PIC BASIC
    Replies: 2
    Last Post: - 5th March 2008, 22:36
  5. Tx and Rx of Single Pin PIC's
    By Dwayne in forum Code Examples
    Replies: 0
    Last Post: - 26th May 2004, 14:55

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