2 LEDs and one pin left


Closed Thread
Results 1 to 40 of 54

Hybrid View

  1. #1
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    704


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by scalerobotics View Post
    Really? Because I am using Dave's code on a 18F26J50 (3.3 volt) with no resistors, and it works like a charm. Red, Blue, off

    Code:
    BLINK:  
         HIGH PORTA.0 
         PAUSE 2500 
         LOW PORTA.0  
         PAUSE 2500   
         TRISA.0 = 1 
         PAUSE 20000    
         GOTO BLINK
    DOH,

    The trick is in the TRISA.0 = 1 to get both off (the 0,0 state). Nice!

    Robert

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    I think this page explains what Walter is doing pretty well ...
    http://www.batsocks.co.uk/readme/p_tut_led16.htm
    DT

  3. #3


    Did you find this post helpful? Yes | No

    Default

    Simplest coding would be to generate a square wave signal on the pin, and then set the TRIS based on state of each LED. TRIS would have to be set every time you change the state of the pin in the square wave generating code. That way the LEDs will always be the same brightness. Of course the square wave signal would have to be interrupt driven off of a timer in order to have both LEDs on at the same time.
    Tim Barr

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