# Implementing a multiplier circuit on a microcontroller

#### stefan6582

Joined Mar 10, 2016
12
Hi,

Is there any way i can read hex or decimal numbers using a micro-controller and display them on a display? I'm more interested in the part about reading the numbers, as i can't think of a simple way of doing it. I'd appreciate any help on this

#### MrChips

Joined Oct 2, 2009
22,488
This is standard programming exercise and a straight-forward thing to do if you understand and know how to program microcontrollers (MCU).
It does not require a multiplier circuit.

Tell us which MCU chip you have and exactly what you are attempting to do. Knowing your programming knowhow and experience would help us help you.

#### stefan6582

Joined Mar 10, 2016
12
It's an atmega 644p. It's probably a simple thing which i can't figure out. The actual issue is how do you read binary/decima/hex numbers using it. I can sort out everything else i need to do, apart from this as stated.

#### jpanhalt

Joined Jan 18, 2008
10,923
Are you using C or Assembly?

John

PS: I assume C, so I can't help.

#### MrChips

Joined Oct 2, 2009
22,488
Still not clear.

One thing to remember is binary/decimal/hex/text etc are all binary, i.e. ones and zeros as far as the computer is concerned. What the ones and zeros really represent depends on the human interpretation.

Where is the binary/decimal/hex data coming from? Is it serial or parallel data? Is it in a data file, comm port, USB or a parallel bus? So many possible sources. Do tell us please.

#### stefan6582

Joined Mar 10, 2016
12
It's C, unfortunately. I'm more interested in the logic behind it, instead of the code itself. I can write it myself, but i am stuck on this for some reason which i can't explain why. If you'd give me some tips on this it would great.

#### MrChips

Joined Oct 2, 2009
22,488
It doesn't matter what language you program, the concepts are all the same.

#### stefan6582

Joined Mar 10, 2016
12
I'm assuming it's an analogue signal. The multiplication itself, it's done on a separate chip. The actual number which i have to read it's an 8-bit unsigned number.

#### MrChips

Joined Oct 2, 2009
22,488
I wish you could be more specific. I'm not here to play 101 Q & A.

Where is the data coming from?
Where do you want the data to go?
There are over a dozen types of displays. Which one is it, exactly?

#### jpanhalt

Joined Jan 18, 2008
10,923
It's C, unfortunately. I'm more interested in the logic behind it, instead of the code itself. I can write it myself, but i am stuck on this for some reason which i can't explain why. If you'd give me some tips on this it would great.
In that case, this pellucid article on RADIX conversion should answer your question. I am sure there are other discussions.

John

#### John P

Joined Oct 14, 2008
1,858
"Read hex or decimal numbers" meaning they're written on some opaque medium and you read them optically using unspecified scanning equipment? However you do it, that's a job for an expert, with a pretty powerful processor.

If it's just an 8-bit unsigned number then the math is dead easy, but reading the data is the challenge.

#### stefan6582

Joined Mar 10, 2016
12
It's not that complicated, don't worry. Figured the way around it, it's just about reading each individual binary out of the 8-bit sequence and transforming them to hex/decimal and display them on an lcd. Thanks for the replies

#### MrChips

Joined Oct 2, 2009
22,488
Who knows what the TS is really seeking.
Maybe it is a hypothetical question, something such as, read the data from a thermometer and display the results in °C to one decimal place.

Looks like a homework assignment to me.

#### stefan6582

Joined Mar 10, 2016
12
It's not really, it's part of a bigger stuff we are working on, but this basic fact just passed me and i wasn't able to figure it out until i figured i can set pins as inputs and just read them as a digital value. Then i can work around with them. The whole thing is to display the resultant of an already made multiplication on a specialised chip and make it decimal/hex and deduce if the calculation is unsigned/signed and if there's an actual error in the calculation.

#### MrChips

Joined Oct 2, 2009
22,488
What you describe is what a number of us here on AAC, including myself, do on a daily basis.
I do this on a day job. This is our bread and butter stuff and I can do this in my sleep.
The task is simple and straight forward, if only you were more specific we would have been able to help you.

#### atferrari

Joined Jan 6, 2004
4,169
Hi,

Is there any way i can read hex or decimal numbers using a micro-controller and display them on a display? I'm more interested in the part about reading the numbers, as i can't think of a simple way of doing it. I'd appreciate any help on this
Where "are" those numbers? In bytes inside the micro? On a bus as output of from a digital device? Nothing like a block diagram to know what your problem is.

Are those numbers, values in a certain format known to you?