Hello,
can I use atmega32 c code in atmel studio to add, subtract, multiply and divide 4-bit number with another 4-bit number and display the result on 7-segment display ?
Hello,
can I use atmega32 c code in atmel studio to add, subtract, multiply and divide 4-bit number with another 4-bit number and display the result on 7-segment display ?
Just use unit8_t then mask to 4 bits.
Use an Intel 4004 emulator -- that is a 4-bit architecture.
4-bit number
So your range of inputs is 0-15, or did you mean BCD values 0-9?
jim
I wondered about 4 bit multiplication. There aren't that many combinations of 4 bits as multiplicands that won't simply overflow a 4 bit result ;-)
I wondered about 4 bit multiplication.
I think the due date for the assignment may have passed.
Is OP perhaps doing a BCD library? Where is that DAA instruction?
4x4 bit certainly fits in 8bit.
AVR does 8bit hw efficiently.Atmega32 has hw multiplication but not division.The compiler will take care anyway
uint8_t x,y; uint8_t result;
result=x*y;//multiply result=x/y;//division
Also to display connect them to the same port if possible and create a mem vector that stores the bit combination in a uint8_t for the respective port.
like:
v[0] has the combination for '0'
v[1] for '1'
.............
where each bit turns on a pin in a port.
I think the due date for the assignment may have passed
A common assignment used to be to emulate a simple 4-function ( + - * / ) calculator on an 8051 + keypad + 7-Seg display.
Maybe they've "upgraded" to AVR ... ?