CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

LED on pin A4 ?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
horizontech



Joined: 09 Nov 2003
Posts: 13

View user's profile Send private message Send e-mail

LED on pin A4 ?
PostPosted: Sat Apr 23, 2005 1:26 pm     Reply with quote

Hi !

I try to use pin A4 on pic 16f84a to drive a Led true a 330ohm resistor

Not work ?

I have try 4.7K pull up resistor the led stay at 25% on !!


I need some idea ?

Thanks

Alain Tanguay
newguy



Joined: 24 Jun 2004
Posts: 1907

View user's profile Send private message

PostPosted: Sat Apr 23, 2005 1:34 pm     Reply with quote

Not too sure about a 16F84A, but pin A4 on a lot of PICs is open drain.
Mattr0



Joined: 27 Mar 2005
Posts: 30

View user's profile Send private message Visit poster's website

PostPosted: Sat Apr 23, 2005 2:18 pm     Reply with quote

you are going to have todrive the LED through a transistor to get the full brightness

If you think about it you are taking the 4.7k + the 330 Ohm resistor to drive the LED. which would probably get you in the range of 1 mA The transistor takes a very small amount of current to turn it on to accomplish this task



the Dreaded a4 had me working for hours until I found that out a few years back
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Sat Apr 23, 2005 2:49 pm     Reply with quote

If you connect a LED through a 330 Ohm pull up resistor tied to +5V, you
should get full LED bright, doesn´t matter if the PIC pin is open collector or not.
One of the best characteristics of the PIC family is that they can
source/sink up to 25mA in every INP/OUT PIN.
Re-check your hardware and if posible swap the PIC.

Humberto
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Sun Apr 24, 2005 4:38 am     Reply with quote

Alain's first attempt. Not working because A4 is Open Collector:
Code:
         -------     |\|
  A4  ---| 330 |-----| |-----|
         -------     |/|     |
                             |
                           -----
                            ---
                             -


My interpretation of Alain's second attempt:
Code:
         +5V
        |
       ---
       |4|
       |k|
       |7|
       ---
        |
        |
        |  -------     |\|
  A4  -----| 330 |-----| |-----|
           -------     |/|     |
                               |
                             -----
                              ---
                               -

Now the led gets 1mA, not enough for standard leds.

How it should be done:
Code:
                            +5V
                            |
                            |
         -------     |/|    |
  A4  ---| 330 |-----| |-----
         -------     |\|

Note the reversal of the led. Also check the maximum current allowed for the led, in this example the 330 Ohm resistor at 5V will give a led current of 15mA.
horizontech



Joined: 09 Nov 2003
Posts: 13

View user's profile Send private message Send e-mail

PostPosted: Sun Apr 24, 2005 11:40 am     Reply with quote

Thanks for you help !!!


Alain Tanguay
Guest








PostPosted: Sun Apr 24, 2005 1:32 pm     Reply with quote

Can I add that although nearly all PIC pins can sink/source 25mA they can't do it all at the same time! There is a overall current limit for the device!
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group