Trying to wrap my head around ADC's

Thread Starter

gte

Joined Sep 18, 2009
357
I'd like to control (2) 2.5 digit 7 segment LED's with the least amount of microcontroller pins being used as possible

Am I best to use a 4 pin ADC to give me 16 combinations, or (2) 4 pin ADC's? Maybe I could get away with (1) 5 pin ADC to drive both of them?

If I understand the 4 pin LED driver ADC, it does the following, it takes 2^4 different binary combinations as an input and each combination will represent a different output that corresponds to a number on the 7 segment LED, is my understanding correct?
 

kubeek

Joined Sep 20, 2005
5,794
Are you sure you understand what an ADC is? It stands for analog to digital converter. That is a device for converting (measuring) a real voltage like 2.35V into some binary number like 1101001010. Nothing more, nothing less.

It has nothing to do with what you want, the thing I quess you want to use is a BCD to 7seg decoder. For a two digit 7seg you could do with just 5 outputs and some external circuits like the decoder and two transistors.
 

Thread Starter

gte

Joined Sep 18, 2009
357
No I'm not :)

I thought a BCD was a form of an ADC, but apparently not.

Do you happen to have a schematic that has the BCD (LED driver?) and transistors?

Thanks for the reply!
 
I agree with Kubeek -- what you want has nothing to do with ADCs. It's just regular digital output pins from the microcontroller. I think you just got the terms confused.

Anyway, if you are limited for pins, you can also do a lot with shift registers.

You can string together several shift registers and you can control any number of digital outputs, using only 3 microcontroller pins.

With shift registers, you can put in all the different output values in serial, and then switch them all to the new values simultaneously.

I've done this in the past. But usually, if I don't have enough pins, I choose a different microcontroller. They are available with many outputs if you need them, so I figure, why add more chips when you don't need to.

Another way... there is probably a specialized chip out there that can control the LED display that you want, and probably can connect to the microcontroller with an I2C connection, which would be only 2 pins. But that is too complicated for what you want. I2C is a pain in the neck unless you have done it before. It sounds like the best for you is to keep it simple.
 

Thread Starter

gte

Joined Sep 18, 2009
357
I read this and it confirmed what I thought I had understood as far as the BCD's

http://www.egr.msu.edu/classes/ece480/goodman/fall/group01/ApplicationNoteNate.doc (very easy to understand and has great diagrams/explanations)

Once I figure out how to serial them, that will be even better :) for saving pin usage.



I still do need help with the ADC portion of it, I'll be reading Bertus' link today on that. Is there a specific type of ADC that works better with my propeller microcontroller? I saw that some of them work best for speed or resolution, etc, but I'm wondering if the type of microcontroller matters?
 
Once I figure out how to serial them, that will be even better :) for saving pin usage.

I still do need help with the ADC portion of it, I'll be reading Bertus' link today on that. Is there a specific type of ADC that works better with my propeller microcontroller? I saw that some of them work best for speed or resolution, etc, but I'm wondering if the type of microcontroller matters?
You could use an input shift register to serialize the readings from a number of digital inputs, if you need to. But that would best use 3 pins for the input, while to read directly is only 4 pins. I bet you can manage to find 4 pins for the BCD switch.


About the ADC -- define your requirements.
What speed and resolution do you need?
Is power an issue? Cost?

Also important is the interface. Some use SPI, some use I2C. Does the Propeller have a built-in support for I2C communications? If not, it is no easy task to bit-bang that. SPI is a lot easier to bit-bang. (Bit-banging means to write the code to communicate every single part of the input/output, instead of using a built-in peripheral for communications.)
 

Thread Starter

gte

Joined Sep 18, 2009
357
I found this link, and this was also very informative about ADC's

http://www.facstaff.bucknell.edu/mastascu/elessonshtml/Interfaces/ConvAD.html


A savings of 1 pin might not be worth the extra effort for a beginner such as myself, but if I can chain two LEDs off of 4 pins (instead of 1 pin), that would be worth it. What do you think?


I googled the propeller and SPI/IC2, here is what I found. I wasn't sure if you were saying you liked SPI or IC2 better, as I was a little confused about what I read in this part

sage.radachowsky said:
Also important is the interface. Some use SPI, some use I2C. Does the Propeller have a built-in support for I2C communications? If not, it is no easy task to bit-bang that. SPI is a lot easier to bit-bang.

There is also a link with a synopsis of the chip here
http://www.rayslogic.com/propeller/propeller.htm

http://obex.parallax.com/objects/26/


Basic I2C Driver
This is a simple Spin I2C driver intended mostly for accessing I2C serial EEPROMs like the boot EEPROM. There are low level routines included that can be used to access other I2C devices, but the specific routines to do so would have to be written by the user. This somewhat duplicates the I2C Object Library by James Burrows, but is simpler, possibly easier to understand, and focused particularly on EEPROM use.
 

Thread Starter

gte

Joined Sep 18, 2009
357
Bertus,

I've ordered a few of those and I have it up and running, trying to test with it.

I have 5vDC going to VCC and of course ground is connected. When my microcontroller is running through the different binary values, on my output I'm seeing ~9vDC? I'm looking at this data sheet
http://focus.ti.com/lit/ds/symlink/sn74ls47.pdf
and having a hard time finding where it says what the output "high" values should be?

This is the 7 segment I have to use with it
http://www.mouser.com/ProductDetail/Kingbright/SA39-11PBWA-A/?qs=Nv%2bTkrUf9i8jWzA5MQ168w==

Is the 9vDC pulse normal?

Thanks!


Hello,

An 74ls47 is a BCD to 7 segments decoder.
BCD stands for Binairy coded decimal.
http://www.educypedia.be/electronics/digitalcodes.htm
See the attached datasheet for more info.

Bertus
 

Thread Starter

gte

Joined Sep 18, 2009
357
After some research, this appears to be normal. Once I put a 220 ohm resistor in between the output pin and the 3.3 rail voltage on the BCD and then connect them to the cathodes on the 7 segment, it should be fine. Off to try tonight. :D
 
Top