Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Pwm on other port
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> AVR
View previous topic :: View next topic  
Author Message
MAK3

Bascom Member



Joined: 24 Sep 2010
Posts: 449
Location: Germany

germany.gif
PostPosted: Fri Dec 30, 2011 12:53 pm    Post subject: Reply with quote

Hi hobby,

my last comment here before you change the specs again:

Quote:
Hi Mak3,

Because the ATXMEGA128A1 is not low cost.
Farnell: 8Euro/10pc

With my final solution: PCA9685 2.13/10PC + ATTINT44 1.48/10pc = 3.61 Euro.


You changed your specifications to 16 Channels ! Confused
We (the forum) can only answer on what you give us.

ATXMEGA16A4U = 4,01 Euro/10pc (still a one chip solution on a PCB and no external Osc needed up to 32Mhz, no external components for I2C like pullup)
(44 pin = the same as ATMGEA324P )

USB Interface included !

MAK3
Back to top
View user's profile
Luciano

Bascom Member



Joined: 29 Nov 2004
Posts: 3149
Location: Italy

blank.gif
PostPosted: Fri Dec 30, 2011 1:18 pm    Post subject: Reply with quote

hobby wrote:
The specification is change, sorry 2 LEDs in same time.


This is not a problem.

Use a 220 ohm resistor on the PWM output (the I/O pin of an AVR can
drive up to 40mA, verify the datasheet). In this case two LEDs must
be always on.

You can also have a 470 ohm resistor for each LED but then you must make sure
that you have only two LEDs on at the same time, otherwise you will exceed the
maximum current on the I/O pin with the PWM output. In this case you
can have one LED or two LEDs on because the current of each LED is limited
by individual resistors.

Best regards,

Luciano
Back to top
View user's profile
MWS

Bascom Member



Joined: 22 Aug 2009
Posts: 2262

blank.gif
PostPosted: Fri Dec 30, 2011 1:54 pm    Post subject: Reply with quote

Luciano,
Quote:
(the I/O pin of an AVR can drive up to 40mA, verify the datasheet)

it's not sound and not recommended to drive the chip to it's maximum ratings.

The ATXMEGA16A4U as suggested by Mak, (only XMegas apply if 18pin hw-pwm is to be used) is on it's edge at 25mA.
Quote:
XMEGA A4U
36.1 Absolute Maximum Ratings
I I/O pin sink/source current -25 25 mA


There are led-drivers available with integrated current sink, reducing external parts to a minimum. If looking a bit further, one would likely find suitable cheaper circuits than the PCA.

But if we're back to 16pin soft-pwm, it can be easily done with a single Tiny.
Back to top
View user's profile
Luciano

Bascom Member



Joined: 29 Nov 2004
Posts: 3149
Location: Italy

blank.gif
PostPosted: Fri Dec 30, 2011 2:18 pm    Post subject: Reply with quote

40 mA?

5V / 220 ohm = 22.72 mA

Best regards,

Luciano
Back to top
View user's profile
MWS

Bascom Member



Joined: 22 Aug 2009
Posts: 2262

blank.gif
PostPosted: Fri Dec 30, 2011 2:26 pm    Post subject: Reply with quote

Luciano wrote:
40 mA?

I did refer to the statement in your post
Quote:
can drive up to 40mA

and not your choice of resistor value.
The current thereof however is lower than in your calculation
Quote:
5V / 220 ohm = 22.72 mA

as you omit the led's forward voltage.
Back to top
View user's profile
hgrueneis

Bascom Member



Joined: 04 Apr 2009
Posts: 902
Location: A-4786 Brunnenthal

austria.gif
PostPosted: Fri Dec 30, 2011 3:17 pm    Post subject: Reply with quote

@MWS and everybody interested.
Not everybody runs the MCU with the internal OSC. at 8 MHz.
The AT168 (also 48, 8Cool can do 24 MHz at 5 V! It also has enough pins to do at least 18 channels (I know because I did it without a problem or jitter). The price in the USA is about $3.00.
I was also not talking about ISRs because they are not needed for a simple thing like that.
This seems to turn into an electronics discussion.
BTW, with a forward voltage of for example 2 V there will be about 13-14 mA at 5 V (220 ohm resistor).
Have fun dissecting a problem that does not really exist.....he found a solution.
Have a HAPPY NEW YEAR!
Hubert[/quote]
Back to top
View user's profile
MWS

Bascom Member



Joined: 22 Aug 2009
Posts: 2262

blank.gif
PostPosted: Fri Dec 30, 2011 3:34 pm    Post subject: Reply with quote

Hubert,
hgrueneis wrote:
Have fun dissecting a problem that does not really exist.....he found a solution.

That's the fun in discussion, nobody is obligated to find a different or better solution, but everybody is allowed to Very Happy
And if it would be always perfectly clear what TO's want, many discussions would stay undiscussed.
Quote:
Have a HAPPY NEW YEAR!

Thanks, to you too, all the best,

Ludwig
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5921
Location: Holland

blank.gif
PostPosted: Fri Dec 30, 2011 4:00 pm    Post subject: Reply with quote

Even while a pin can sink/source a max. of 25 or 40 mA, it does not mean you can use this on ALL pins! There is a maximum current for the chip. It depends on the chip.
_________________
Mark
Back to top
View user's profile Visit poster's website
hgrueneis

Bascom Member



Joined: 04 Apr 2009
Posts: 902
Location: A-4786 Brunnenthal

austria.gif
PostPosted: Fri Dec 30, 2011 4:03 pm    Post subject: Reply with quote

@Ludwig
"RIGHT YOU ARE" to quote Yoda.
Hubert
Back to top
View user's profile
hobby

Bascom Member



Joined: 12 Apr 2004
Posts: 109
Location: Brussels

belgium.gif
PostPosted: Fri Dec 30, 2011 5:52 pm    Post subject: Reply with quote

Thank you all for your suggestions. I do a test tonight with a tiny44 and directly 3.6V to prevent resistance of LED (green LED voltage from 3.5 to 4V).

Happy New Year to all.

Thank you
Olivier

_________________
Thanks
Olivier
Back to top
View user's profile
Luciano

Bascom Member



Joined: 29 Nov 2004
Posts: 3149
Location: Italy

blank.gif
PostPosted: Fri Dec 30, 2011 6:32 pm    Post subject: Reply with quote

@MWS:

Stop criticizing the solutions posted by other users and
try to propose something on your own, if you can.

Best regards,

Luciano
Back to top
View user's profile
MWS

Bascom Member



Joined: 22 Aug 2009
Posts: 2262

blank.gif
PostPosted: Fri Dec 30, 2011 7:12 pm    Post subject: Reply with quote

Luciano wrote:
Stop criticizing the solutions posted by other users

Do you refer to improper calculation of led current and not recommendable advices about absolute maximum ratings ?
It was never my intention to criticize your person, instead to correct errors. It's not good to leave them unanswered.
Quote:
...try to propose something on your own, if you can.

I think I did, in this post and many times before.
What I'm still doing hard, is to propose errors as solutions, but I promise, I will try to learn. Very Happy
Back to top
View user's profile
MWS

Bascom Member



Joined: 22 Aug 2009
Posts: 2262

blank.gif
PostPosted: Fri Dec 30, 2011 7:18 pm    Post subject: Reply with quote

hobby wrote:
I do a test tonight with a tiny44 and directly 3.6V to prevent resistance of LED (green LED voltage from 3.5 to 4V).

If this means what I guess, leaving out resistors, this is definitely not a good idea.
Back to top
View user's profile
six1

Bascom Expert



Joined: 27 Feb 2009
Posts: 553

germany.gif
PostPosted: Fri Dec 30, 2011 8:25 pm    Post subject: Reply with quote

Ludwig, that's same as the man who jumped from the 100m high tower... first 99m are ok Smile
_________________
For technical reasons, the signature is on the back of this message.
Back to top
View user's profile
MWS

Bascom Member



Joined: 22 Aug 2009
Posts: 2262

blank.gif
PostPosted: Fri Dec 30, 2011 9:12 pm    Post subject: Reply with quote

If the µC glows brighter than the connected led, something might go wrong Wink
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> AVR All times are GMT + 1 Hour
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
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
You cannot attach files in this forum
You cannot download files in this forum