Shop OBEX P1 Docs P2 Docs Learn Events
Why wont this work - led with the prop "sinking" style — Parallax Forums

Why wont this work - led with the prop "sinking" style

BitsBits Posts: 414
edited 2012-07-12 04:48 in Propeller 1
I was thinking that this was going to be simple but I am struggling for some reason. Can someone point out the obvious thing I am missing here please.

Attachment not found.

Pub main


  SetNumber  
  repeat
      
      
Pub SetNumber


  Dira[8]~  
  Outa[8] := %0

Comments

  • RaymanRayman Posts: 14,826
    edited 2012-07-11 14:56
    need Dira[8]~~
  • BitsBits Posts: 414
    edited 2012-07-11 14:57
    Wont that make Dira[8] and output? Ill try it as I was under the imperssion that I needed to make it an input because I am sinking the led current. But now that I think about it sounds right.
  • BitsBits Posts: 414
    edited 2012-07-11 14:59
    Ah thank you kindly. Its working
  • tonyp12tonyp12 Posts: 1,951
    edited 2012-07-11 15:01
    Input = nothing
    A output with it state as 1 = Vdd.
    A output with it state as 0 = Vss = Sinking
  • Cluso99Cluso99 Posts: 18,069
    edited 2012-07-11 17:18
    Bits: I always use resistors >3k3 and often 10K. Just buy the cheap ultra bright leds off ebay.
    Sinking is the old way where 0 = on. Much better to source and put the led to gnd. The a 1 = on.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-07-11 19:29
    Sinking a load, versus sourcing it, is a habit formed from microcontrollers that have asymmetrical P vs. N output drive capabilities. The Propeller is not such a device, so you have other reasons available for making the choice.

    -Phil
  • Mark_TMark_T Posts: 1,981
    edited 2012-07-12 04:18
    Sinking a load has one advantage in real word pieces of equipment - accidental shorts on output cables to ground don't damage/overload the driver circuits, they just turn on the load (in other words the load limits the current). However in some circumstances this is a disadvantage (say the load is potentially dangerous if activated at the wrong time).
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-07-12 04:48
    Since we are taking the opportunity to elaborate on the art of leds and sinking vs sourcing, this is my opinion. If the led or load doesn't require much current then I will source it as the load returns to ground which also makes it a little more suitable for external connections. If it shorts to ground then it is current limited by the resistor plus we are not picking up EMI on the supply line if it was a sink drive.

    Too much of a load on the 3.3V supply is not good though as the Prop and other chips are also connected to this source. Frequently though my 3.3V is regulated from 5V so if I have a few leds that I like to drive hard I will choose to drive them in sink fashion but with the anodes connected to the +5V supply. Red leds have a voltage drop of around 1.6V at low currents climbing to a typical 1.8V with decent drive. All other leds have a higher voltage drop, 1.8..2 for green etc. The maximum voltage therefore that the Prop I/O pin will see is 5V-1.6V = 3.4V, just above the 3.3V threshold but still within the +/- 300mV limits. There is a tiny caveat with red leds though as they can "glow" dimly even when they are turned off due to the minute current flowing at this near cutoff voltage. If it's a concern I just use a bleed resistor or a series diode if I really want a red led driven from +5V.

    BTW, the reason I might drive the leds harder is because even though I use ultra-brights mostly, I may need to make them visible in bright sunlight (not all of us live in caves you know).
Sign In or Register to comment.