Go Down

Topic: Does Arduino Uno have max 8-bit or more resolution? (Read 29124 times) previous topic - next topic

cmd1024

#15
Apr 24, 2013, 10:49 pm Last Edit: Apr 24, 2013, 10:51 pm by cmd1024 Reason: 1
Grumpy_Mike many thanks. I think now I started to understand a bit. So bit thing is as follows:

8-bit micro-controller means the chips inside sending 8-bits to each other at a time. Chunk is meaningful here.

Serial data is "1 bit" at a time.

10-bit is the resolution of the ADC converter.

8-bit also accounts for the resolution of the DAC converter.

Did I pass the exam now??:)


cmd1024

Last question: Is that because analogWrite is not outputting continuous signal and should be smoothed ?
You should write a tutorial btw, your explanations are very clear. 8)

AWOL

The PWM signal output and modified by analogWrite is continuous.
You can smooth it with a low pass filter to produce a DC analogue voltage.

Coding Badly


Grumpy_Mike

Quote
You should write a tutorial btw,

Well I did write to one I linked to plus all the others on that site.

AWOL

Quote
Threads merged

Don't we just hate time-wasting cross-posters?
(Don't bother to answer that, it was a rhetorical question)

Erdin

Exam number two:

The ATmega328 is a 8-bit chip.
Draw a big rectangular on a paper, that is the ATmega328.
Draw an 8-bit data bus inside.
Draw all the parts inside with the number of bits.
Serial port (8-bit register access), serial data going in or out can be 8 or 7 bits.
A single ADC of 10-bit, and a mux to select the analog input.
Three timers, two of 8-bit, one of 16-bit.
EEPROM, 8-bit.
I2C (wire), 8-bit. Serial data going in or out is a number of 8-bit data.
TWI, 8-bit. Serial data going in or out is 8-bit (not always).

Question 1: If the ATmega328 chip is internal 8-bit, how can it do calculations with 16-bit or 32-bit integers, and how with 32-bit floating point numbers ?

Question 2: What is the best way to send the 10-bit ADC value via an serial port ? How many bytes would probably be needed ?

cmd1024

#23
Apr 25, 2013, 12:00 am Last Edit: Apr 25, 2013, 12:04 am by cmd1024 Reason: 1
Erdin, I think I have answer to your 2nd question. I believe that 10 bits will be stored in two 8 bits in computers(16 bits in total for each sample). It seems like 6 bits will be wasted for each sample. 16 bit ADC would be more efficient but more expensive(also slower?). What do u think? My answer is 2 byte. Is that true?

Also regarding 8 bit topic; can we say that 8 pins of ATMEGA chip is sending 8 bits at a time?? If so which pins are they?

Your first question is beyond my knowledge.

KeithRB

Don't confuse what the compiler does with what the underlying chip instructions can do! The compiler works in 2-byte ints. It combines multiple bytes as necessary to make it transparent to you. That is why using bytes can sometimes be faster than using ints on these machines.

Erdin

For the SPI, I2C (called TWI), and Serial pins, see the page about the Uno, http://arduino.cc/en/Main/arduinoBoardUno

Answer to question 1:
Everything beyond 8 bit is done in software. The microcontroller shifts/adds/shuffles the 8-bit data until it finally gets the result. The compiler generates that code.

Answer to question 2:
Yes, 10 bits are stored in two bytes (that is 16 bit).
But....  With the serial port (also called UART), often readable text is used.
So the text "0" or "1023" could be transmitted.
It is easier to use a character to start and to stop. Let's use '<' to start, and '>' indicates a stop. So the text becomes "<0>" or "<1023>".
That is often followed by CarriageReturn and LineFeed.
The result is 5 to 8 byte.
Assuming one startbit and one stopbit per byte for the serial protocol, makes the total is 50 to 80 bits.
The 10 bit of the ADC are transmitted over the serial line as 50 to 80 bits.
And it is perfectly normal.

cmd1024

#26
Apr 25, 2013, 02:09 am Last Edit: Apr 25, 2013, 02:13 am by cmd1024 Reason: 1
Does "32-bit operating system computer" mean that the communication between the ICs inside the computer is actualized with '32-bit information at a time'?  For example:

Let's say we have a computer and its micro-processor's clock rate is 1GHz. What I understand is that: In 1/1000.000.000 of a second (in a billionth of a second) an IC sends out 32-bit information(with its 8 pins) "at a time" to other ICs.

Did I get the big picture?

AWOL

Quote
What I understand is that: In 1/1000.000.000 of a second (in a billionth of a second) an IC sends out 32-bit information(with its 8 pins) "at a time" to other ICs.

No, a 32 bit computer will have datapaths at least 32 bits wide, as well as multilevel caches.

I'm moving this to "General Discussion"

Grumpy_Mike

Quote
Let's say we have a computer and its micro-processor's clock rate is 1GHz.

It depends on the processor, some processors need lots of clock pulses to move stuff about, others can do it in one clock. That is why the simple clock speed is not enough to measure the power of a processor.

MichaelMeissner

#29
Apr 25, 2013, 02:23 pm Last Edit: Apr 25, 2013, 02:34 pm by MichaelMeissner Reason: 1
A simplification that I think is useful to describe how a computer is 8-bit, 16-bit, 32-bit, or 64-bit is as follows:

Remember when you were in grade school and were told to add 23 + 49?  Unless you are a calculation savant, you don't add 23 and 49 in one step.  Instead, you add 3 + 9, which gives you 12.  You put '2' down as the last digit, and then carry the '1'.  You then do 1 + 2 + 4 to give '7', and you put those together as '73'.

Now, an 8-bit computer like the AVR inside of Arduinos (except for the Due) does things in terms of 8-bit buckets.  So a 'short' on the AVR is 16-bits, that means it has two 8-bit parts (called bytes).  When the computer does an add, it loads the bottom byte from each side, and does an add operation that returns the bottom byte of the resultant add, and the 1 bit carry operation.  It stores the bottom byte, and then loads the top bytes, and does an add with carry operation that combines the carry from the previous add along with the two bytes.  If you are adding a long which is a 32-bit data type, it would do 1 normal add, and 3 add with carry operations.  On the AVR, 'int' is 16 bits (like 'short'), but on an ARM, it is 32 bits.

A 32-bit processor like the ARM in the Arduino Due, would be able to do an add of two longs (or ints) in one instruction.  However, in doing two adds of two short values and storing the result in a short value, the ARM would need 3 instructions, because the ARM chip does not have a 16-bit add instruction.  Instead the compiler does the calculation in 32-bits, and then needs to convert the 32-bit long to 16-bit short via shift left 16-bits, and shift right 16-bits with sign extension.

Some chips can be 32-bit or 64-bit like modern x86's.  There is a mode within the hardware that says whether internally things are done in 32-bits or 64-bits.  If you have a new workstation but are running Windows XP on it, you likely are running in 32-bit mode.  If you were running Windows 8, most programs would be run in 64-bit mode, but the operating system can recognize when it is asked to run a 32-bit binary, and arranges when that binary is run, the process is run in 32-bit mode (the operating system still runs in 64-bit mode, and when the control goes back to the OS, it switches mode to 64-bit).

Go Up