tiny2313: PD0 unable to sink when all PortD pins are low?

Go To Last Post
16 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm observing some bizarre behavior with an ATtiny2313 and wanted to know if someone can tell my why.

I pulled a 7-segment LED display out of some junk electronics. This display has 3 digits... Ones, Tens, and just 2 segments for hundred (it can disply the number 1 only).

This display is 16 pin. One of them is common anode, 14 pins are cathodes for the ones and tens digit, and the last pin is a cathode for both segments of the hundreds digit.

So, I'm running at 5v and I've attached the common anode to VTG using a 180 ohm resistor. First things first, I just want to cycle all of the segments until I turn them all on at once (displays the number 8).

Here's the bizarre part. If I use PD0-7, the segment connected to PD0 gets dimmer and dimmer until about 3 segments in it is completely off. I tried this on PORTB and the problem disappears so I don't think it's the display causing the trouble.

Any insight?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Are you driving them all at the same time or multi-plexing / charlie-plexing them?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm sinking them all at the same time... but with one anode and resistor. Here's a quick schematic.

Attachment(s): 

Last Edited: Mon. Aug 10, 2009 - 06:29 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Where is/are the resistor(s) in that?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
Where is/are the resistor(s) in that?

:oops: Where indeed... I have update the schematic in the above post to reflect the use of a resistor. Thanks.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Although the Tiny2313 won't win any AVR current contests, the total of all pins is stated as 60mA. I think with 180ohm you should be fine.

Then, one looks at alternate functions. PD0 is RXD. Is the USART disabled? Is there a transceiver connected?

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If the segments are not well matched they may have different brightness due to unequal current share
if turned on at the same time.

I would use one resistor per segment.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

theusch wrote:
... PD0 is RXD. Is the USART disabled? Is there a transceiver connected?

Thanks Lee, you win. I'm using a development board (dragon rider 500) and I had the jumpers in place to hook up the rs232 chip.

Thanks!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

also note that you will draw all the current through the single resistor.
5V-1,7V/180R = 19mA so in your schematic you have 19mA to run 7 LEd's If you activate 1 LEd all the 19mA will go through that LED, if you light them all you have 19/7 = 2mA per LED. Do they at that piont still give enough light?

note also that you will end up with a display that is more or less bright depending on the amount of segments that are on. I do not think you want that. better put resistors in the segment lines to have constant brigthness independant of the number of segemnts lit.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, always only one LED/resistor. Unless the resistors are in series connection.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you. Yes I do understand the drawback to using a single resistor. This is not a production design and for my purposes I find the brightness when all segments are lit to be acceptable.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I decided on a 22 ohm resistor for the common anode. I plan to drive this from 3v unregulated (two AAA batteries) and always have at minimum 4 segments illuminated (the number 11). If the number is less than 10 I will have a zero displayed in the tens position. With a 1.7v drop over the LED and the current divided 4 ways I should have roughly 25mA per segment:

(3.8v-1.7v)/22ohms = 0.095A/4 segments = 24mA

It seems to work well for me... comments appreciated.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

When going to such low external resistors the
internal On-resistance of the MOSFETs inside the AVR
(some 10 Ohms, say 50) work for an equal distribution.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sorry for the newb question, but are the internal resistors just in series with the port pins, or must they be enabled through code? I've stuck with external resistors up to this point.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

I should have roughly 25mA per segment:

Quote:

(3.8v-1.7v)/22ohms = 0.095A

Quote:

the total of all pins is stated as 60mA.

So you are exceeding the datasheet numbers? Now, it ain't gonna drop dead, and you can do whatever you like on your bench, but I wouldn't make/sell 100 of them.

(high current draw (7-segs often/continually lit) and

Quote:

drive this from 3v unregulated (two AAA batteries)

seems like an oxymoron)

AAA is ~1000mAH. 10 hours at 100mA. But that is at a lower draw...digging for a curve...
http://data.energizer.com/PDFs/E...
http://data.energizer.com/PDFs/l...

Lithium will give you about 10 hours to 1.0V; alkaline somewhat less.

Lee
[edit]

Quote:
4. Although each I/O port can sink more than the test conditions (10 mA at VCC = 5V, 5 mA at VCC = 3V) under steady state conditions (non-transient), the following must be observed:
1] The sum of all IOL, for all ports, should not exceed 60 mA.
If IOL exceeds the test condition, VOL may exceed the related specification. Pins are not guaranteed to sink current greater than the listed test condition.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

bugmenott wrote:
Sorry for the newb question, but are the internal resistors just in series with the port pins, or must they be enabled through code? I've stuck with external resistors up to this point.

Is the datasheet not clear then? The internal pull ups are enabled in software by writing 1 to the relevant bits of PORT when the bits of DDR are 0. The four binary states of PORT and DDR therefore give:

DDR PORT
 0    0  high-Z input
 0    1  input pulled up with about 50K
 1    0  output driven low
 1    1  output driven high