QuizSet-A on ATmega328/Arduino UNO/IDE

**QuizSet-A(1-15)**QuizSet-A(1-15)

Q(1) After power up reset, the ATmega328 MCU of the Arduino UNO Kit goes to memory location 3C00h. This location is known as Boot Location. The boot location contains an instruction (or a group of instructions); this instruction tells it to do what?

Q(2) Assume that the Conceptual Answer to Q(1) is described by the following segmented Flow Chart, which has created few more questions.

Figure-1: It belongs to Q(2)

Q(3) Is the variable n of Fig-1 a numerical count or time? How much is it?

Q(4) What is the 4-digit value (if there is any) for the Label L3 of Fig-1?

Q(5) What is the 4-digit value (if there is any) for the Label L5 of Fig-1?

Q(6) What is the probable job for the MCU at Label L3?

Q(7) What is the probable job for the MCU at Label L5?

** **Q(8)** **
What is the probable value for the variable MsgX of Fig-1? (Is it a numerical number, or a character constant or a string constant?)

Q(9) In C/C++ Platform, what are the definitions for character constant and string constant?

Q(10) Assume that the ATmega328 chip of the Arduino UNO Kit is replaced by another chip bought from shop, what will be the value of Label L1?

Q(11) After power up reset, the MCU goes to location 3C00h is the textual representation of the followng: After power up reset, the PC (Program Counter) Register of the MCU assumes the value 3C00h. If this is the case, then the question is: What is the size (in bit) of the PC?

Q(12) Assume that the answer of Q(10) differs from the value 3C00h, then the question is: How do we set the initial (power up reset) value of the PC?

Q(13) Assume that the MsgX of Fig-1 has a value of: Burn Application Program. Write C/C++ codes to detect this message and take decision to divert program control either at L2 or L4.

Q(14) Is it possible to test the functionality of the codes of Q(13) using the existing resources of the Arduino UNO Kit?

Q(15) Why do I want (don't want) to agree that the likelihood value of Label L5 would be within (0040h - 3BFF)?

QuizGeneralDisPost24.doc (29 KB)

My Answers to the Questions of QuizSet-A
The Readers may kindly correct/revise/amend my answers along with their own answers.

Q(1) After power up reset, the ATmega328 MCU of the Arduino UNO Kit goes to memory location 3C00h. This location is known as Boot Location. The boot location contains an instruction (or a group of instructions); this instruction tells it to do what?

A(1) The following answer, in the form of machine codes, is taken from: C:\Program Files(x86)\Arduino\hardware\arduino\avr\bootloaders\atmega\AtmegaBOOT_168_atmga329.hex

:107800000C94343C0C94513C0C94513C0C94513CE1
:107810000C94513C0C94513C0C94513C0C94513CB4
:107820000C94513C0C94513C0C94513C0C94513CA4
............................................................................
............................................................................

When the above frames are re-arranged with respect to word-oriented locations of the Flash, we get:

3C00 - 0C94 343C 0C94 513C 0C94 513C 0C94 513C //this frame contains 8 instructions
3C08 - 0C94 513C 0C94 513C 0C94 513C 0C94 513C
3C10 - 0C94 513C 0C94 513C 0C94 513C 0C94 513C
...........................................................................
...........................................................................

There are people, like the British giant who discovered the Flaw of Pentium-I, who can decode the above machine codes for the reconstruction of the original HL Commands!

(2) Assume that the Conceptual Answer to Q(1) is described by the following segmented Flow Chart, which has created few more questions.

Figure-1: It belongs to Q(2)

Q(3) Is the variable n of Fig-1 a numerical count or time? How much is it?

Q(4) What is the 4-digit value (if there is any) for the Label L3 of Fig-1?

Q(5) What is the 4-digit value (if there is any) for the Label L5 of Fig-1?

Q(6) What is the probable job for the MCU at Label L3?

A(6) The Arduino literature says that MCU would be storing the incoming data/code into the application of the flash.

Q(7) What is the probable job for the MCU at Label L5?
The MCU will make a jump to the application area of the Flash, and it will begin execution of the previously loaded program

** **Q(8)** **
What is the probable value for the variable MsgX of Fig-1? (Is it a numerical number, or a character constant or a string constant?)

Q(9) In C/C++ Platform, what are the definitions for character constant and string constant?

A(9)
(1) According to Turbo C Compiler, a character constant is one or two characters surrounded by single quotes; the quote (') is not considered here as a valid character. Whenever, one tries to compile byte x = ''12'; there will be an error.

(2) According to microC Compiler, a string constant is one or more characters surrounded by double quotes; the double quote (") is not considered here as a valid character. Whenever, one tries to compile
byte y[] = ""AB"; there will be an error.

(3) In Arduino C Compiler, the above two definitions are accepted; but, it compiles char x = '1234'; without any error; whereas, Turbo C does not compile it. Syntactically, char x= '1234'; is a wrong declaration! Is the Compiler lying or behaving strangely?

Q(10) Assume that the ATmega328 chip of the Arduino UNO Kit is replaced by another chip bought from shop, what will be the value of Label L1?

A(10) 0000h.

Q(11) After power up reset, the MCU goes to location 3C00h is the textual representation of the followng: After power up reset, the PC (Program Counter) Register of the MCU assumes the value 3C00h. If this is the case, then the question is: What is the size (in bit) of the PC?

A(11) 14-bit.

Q(12) Assume that the answer of Q(10) differs from the value 3C00h, then the question is: How do we set the initial (power up reset) value of the PC?

A(12) We configure the Boot Address by the Fuse Bits of the MCU.

Q(13) Assume that the MsgX of Fig-1 has a value of: Burn Application Program. Write C/C++ codes to detect this message and take decision to divert program control either at L2 or L4.

Q(14) Is it possible to test the functionality of the codes of Q(13) using the existing resources of the Arduino UNO Kit?

Q(15) Why do I want (don't want) to agree that the likelihood value of Label L5 would be within (0040h - 3BFF)?

A(15) I agree because of my understanding that the space 0000h - 003Fh has been reserved for the interrupt vectors of the ATmega328. The last interrupt of the ATmega328 is 'SPM READY'; its interrupt vector is 0032h. 0000h - 003Fh is a round boundary.