# Implementing a multiplier circuit on a microcontroller

Discussion in 'Embedded Systems and Microcontrollers' started by stefan6582, Apr 24, 2016.

1. ### stefan6582 Thread Starter New Member

Mar 10, 2016
12
0
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

2. ### MrChips Moderator

Oct 2, 2009
12,625
3,451
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.

3. ### stefan6582 Thread Starter New Member

Mar 10, 2016
12
0
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.

4. ### jpanhalt AAC Fanatic!

Jan 18, 2008
5,699
909
Are you using C or Assembly?

John

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

5. ### MrChips Moderator

Oct 2, 2009
12,625
3,451
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.

6. ### stefan6582 Thread Starter New Member

Mar 10, 2016
12
0
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.

7. ### MrChips Moderator

Oct 2, 2009
12,625
3,451
It doesn't matter what language you program, the concepts are all the same.

8. ### stefan6582 Thread Starter New Member

Mar 10, 2016
12
0
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.

9. ### MrChips Moderator

Oct 2, 2009
12,625
3,451
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?

10. ### jpanhalt AAC Fanatic!

Jan 18, 2008
5,699
909
In that case, this pellucid article on RADIX conversion should answer your question. I am sure there are other discussions.

John

11. ### John P AAC Fanatic!

Oct 14, 2008
1,638
225
"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 likes this.
12. ### stefan6582 Thread Starter New Member

Mar 10, 2016
12
0
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

13. ### MrChips Moderator

Oct 2, 2009
12,625
3,451
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.

14. ### stefan6582 Thread Starter New Member

Mar 10, 2016
12
0
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.

15. ### MrChips Moderator

Oct 2, 2009
12,625
3,451
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.

16. ### atferrari AAC Fanatic!

Jan 6, 2004
2,663
784
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?