Continue to Site

# urgent queries on micro controller

Status
Not open for further replies.

#### choon

##### New Member
hi,

I am currently doing a school project.

Need to purchase some items for the following usage,
but not sure what to purchase.

I have an analog output from an Integated circuit
between 0 to 5 V. Now, I need to divide this number by
a constant 330, and then display on the LED
(7-segment) to 2 decimal places.

Thus,
1)what are the items I would need ?
2) which microcontroller should I purchase ? ( need
something that can work and is cheap )
3) Any sources u can recommend me in this area ?

Anyone who can help. Really appreciate that..

Do hope to hear from u as soon as possible.

Thks.

Meng Choon

The input range is 0-5V and it will be divided by a constant 330. However, 5 divided by 330 equals 0.01515 and so only "0.01" can be displayed. Or do you mean 5000/330 which equals 15.15 and so it requires a 4-digit display?

You may have to sit down and work out the arithmetics first. One thing going for you is that the divisor is a constant. If it does not change during the running time of the controller, you may multiply the AD result to the reciprocal of 330. Multiply is easier than divide.

Right, a couple of things:

Firstly, does your project require you to use LED displays, if not, it's far easier to use an LCD text display - plus you can have it show things like:
"Reading = 3.25V" - which is far nicer.

Secondly, exactly what do you want the display to read - a 10 bit PIC will read 0-1023 over it's full range, which by using the default voltage references will correspond to 0-5V. You obviously have to scale this, but it all depends on what you want it to read.

To give you an idea, assuming you wanted it to read 0-5V, you first divide 5 by 1023 - 5/1023=0.0049 (roughly). So to scale the reading, you simply multiple the reading (0-1023) by 0.0049) to get the voltage. So a reading of 468 would be 468*0.0049=2.2932 volts.

Now this isn't really very good, PIC's don't like floating point numbers, it takes lots of space and is very slow - but there's a much better, simpler, way!.

Using simple 16 bit integer maths routines, multiple the reading by 49 (instead of 0.0049), this uses all integers and is small and fast, so the previous example becomes - 468*49=22932. This is obviously 10,000 times too big, but all you need to do is print a decimal point after the first '2' to make it read 2.2932 volts. The important thing is to keep all possible values integer, and within the permitted range - which for 16 bit maths is 0-65,535. If you need to go larger than that, you could use 24 or 32 bit maths - but you could probably scale it within range anyway.

As for a suitable processor, you need one with an internal analogue to digital converter - the 16F876 is one of my favourites, and gives you plenty of scope for other things.

simple 7-seg

If you are using a 7-seg display, look at a: CD4511 BCD to 7-seg latch/decoder/driver It alows you to latch the data, and let the microcontroler do other things. It is realy simple to interface to.

Have fun
Kent

microcontroller

Hi Motions,

Really thk u for ur reply.

What I have is actually a 0 to 5 V output from an Integrated Circuit. I would need to divide this number by 0.33, and thus the result will be some decimal places. Then, I need to display this on the LED. May use LCD also.

But now, I really got no idea how to start..

Hope that u can give me some advice.

Thks.

Choon

Hi:

Seems to me that you have four main parts to your project:

1. The signal conditioning part. You could use a simple voltage divider, followed by a buffer (the voltage kind, not the digital kind!) if the input impedance to the second part is low.

2. The A/D conversion part. Some uC's have built-in ADC's which are OK if you do not need to to very fast conversions.

3. The data processing part. This is where you take the ADC input, and process it to be displayed.

4. The display part. As Nigel mentioned, there are some text-based LCD's (typically using Hitachi's HD44780 chip) which are fairly cheap, and can be driven by 4 - 8 wires from a typical uC. Also, if you do a Google search, you can easily come across code snippets for popular uC's like the AVR2313 (yes, even PICs :lol: !!!).

Hope this helps,

Jem

It depends upon your budget and how much you are allowed to purchase vs. you have to build yourself. It sounds as if you would be better off buying a microcontroller starter kit rather than try to build everything from scratch. A kit with a 10-bit A/D converter and a 4-digit display should be available online or from mail order.

Once you get hold of a kit then the remaining task would be to write the software to capture the voltage reading, do the arithmetic operation and output it to the LED display. We can discuss how you can do that once you've chosen what kit or design to use and what software is available to program the microcontroller.

Re: microcontroller

choon said:
What I have is actually a 0 to 5 V output from an Integrated Circuit. I would need to divide this number by 0.33, and thus the result will be some decimal places. Then, I need to display this on the LED. May use LCD also.

But now, I really got no idea how to start..

Read my previous reply, you really don't want to use floating point maths, it's easily avoided by a bit of thought - full details in previous post.

Status
Not open for further replies.