pic and common anode 7 segment led

Discussion in 'The Projects Forum' started by abhiananth, Dec 24, 2014.

  1. abhiananth

    Thread Starter New Member

    Jul 24, 2014
    18
    1
    Hi

    I got common anode 7 segment led display and PIC microcontroller.

    The connection should be made like this between led display and PIC, to see the output in display via PORTB of PIC, right?

    Image – PIC (PORTB) and 7 segment led connection with transistor
    pic _ 7 segment led _ transistor.jpg

    I don’t have enough transistors right now to make this connection.

    Since charge flows from high potential to low potential, I came up with this connection (connecting the PORTB pins directly to the cathode pins of 7 segment led)

    Image – PIC (PORTB) and 7 segment led connection without transistor
    pic _ 7 segment led - transistor.jpg

    Will the microcontroller be damaged by this connection?

    Actually I tried this connection via PORTC pins. 7-segment led glowed but not according to the program. When I removed 7 segment led display and placed 7 individual leds in it, they got worked correctly according to the program.

    My questions are:

    1. Is connections I mentioned with transistor right?
    2. Will the microcontroller be damaged by the connection I made without transistor?
    3. If not, will this connection work?
     
  2. Dodgydave

    AAC Fanatic!

    Jun 22, 2012
    5,003
    745
    Your second drawing needs 330 ohm resistors between the port pins and the cathodes, otherwise you will blow the pic.
     
  3. GopherT

    AAC Fanatic!

    Nov 23, 2012
    6,072
    3,844
    Yes, it will work as dDave said above.
    You need to add 7 resistors (one for each segment between the LED AND THE portB pins (330 to 1k depending how bright you need and how efficient/inefficient your LEDs are.

    To turn a segment on, you will have to set the portB pin as an output low.
    In a program, you will have to first, set it to a digital pin (in case it can be an analog comparator or other analog function analog is normally the default.

    Then you set the Tris bit to output (0)

    Then you set the state of the output to LOW (0) to turn the segment on and hi (1) to turn it off.
     
  4. takao21203

    Distinguished Member

    Apr 28, 2012
    3,577
    463
    The resistors manufacturers mafia tries everything possible to keep this urban legend alive.

    In fact, LED calculators in the early 1980s didnt use resistors, that's where PICs are coming from.

    They are totally unneccessary. If the display is too bright, well with a controller, you can modulate it.

    Only bad thing is the brightness variation. But with suitable scanning, that isnt visible either.
     
  5. tshuck

    Well-Known Member

    Oct 18, 2012
    3,531
    675
    No, it's people that do not understand how these things work that purport some sort of conspiracy is afoot. There may be times you can get away with it (as in current-limited drivers), but that is not a good practice in wide-sweeping statements.

    @OP, please don't do this, use resistors.
     
  6. GopherT

    AAC Fanatic!

    Nov 23, 2012
    6,072
    3,844
    Interesting. If true, I would like to understand why Microchip uses resistors in all of their Application Notes that use LEDs.
     
  7. takao21203

    Distinguished Member

    Apr 28, 2012
    3,577
    463
    Eventually the knowledge got lost when the japanese electronics economy lost its monopoly in the early 1980s.

    Many kinds of electronic gadgets disappeared around that time. Watches and calculators are all LCD now, made in China.

    Why do you want resistors when there's no benefit? Chip traces wearing out? I've read statements as obscure as electromigration. When is this supposed to happen? After a year? Two years? Any references to research about it?

    How comes CPU chips deal with a number of Watts? Just wider traces, thicker bonding wires?

    Or its just the ambigous usual disclaimer "it hasnt been tested operating outside the specification MAY have some adverse effects on relieability".

    I have run a 768 LED matrix, 8 PIC 16F59, for months, didnt see any failures or degrading.
     
  8. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,395
    1,607
    4 out of 5 dentists surveyed agree that resistors should be used by their patents who chew LEDs.
     
Loading...