2. 11 pts total Microcontrollers with the Harvard architecture usually offer spe
ID: 3732535 • Letter: 2
Question
2. 11 pts total Microcontrollers with the Harvard architecture usually offer speed advantages over those categorized as von Neumann. One disadvantage, though, is that data in the separate memory spaces need to be treated differently. This is what this question is intended to direct you to explore. You will need to read AVR LibC documentation to answer some of these questions a) [2 pts] Write a line of C-code that creates a string constant of "Hello" in RAM. b) [I pt] How many bytes of RAM does this take? c) [1 pt] Yes or no: memory space? does the creation of the string in RAM (in (a)) consume any program d) 2 pts] Write a single line of code that uses an AVR LibC function call to send out this string to whatever stream the printf) is connected to. associated with will end up receiving this string 1.e. Whatever the “stdout" is actually e) [2 pts] Next, use AVR LibC macros to create the same string constant of"Hello", but this time in the program memory space. 1 12 pts] Write a single line of code that uses an AVR LibC function call to send out this string. similar to (d) g) 1 pt Yes or no: does this string in program memory space consume any RAM? 23Explanation / Answer
const char *a = “Welcome to C Programming”;
clrscr();
printf(“Value of a = %s”,a);
getch();
-----------------------------------------------------------------------------------------------------------
2.b
Lets say we want to store “Hello”, so we have 5 characters, so that makes Number of characters = 5 .
If we are using ASCII encoding, we need 8 bits to encode each character, so Number of bits used to encode a single character = 8
Total size = ( 5 * 8)/8 = 5 Bytes.
If we are using UNICODE encoding, we need 16 bits to encode each character, so Number of bits used to encode a single character = 16.
Total size = ( 5 * 16)/8 = 10 Bytes.
----------------------------------------------------------------------------------------------------------------------------
2.c
No ,Why bcoz of always contran value take class memory
----------------------------------------------------------------------------------------------------------------------------
2.d
-----------------------------------------------------------------------------------------------------------
2.e
-----------------------------------------------------------------------------------------------------------
2.g
No
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.