1. Engineering
  2. Electrical Engineering
  3. 1 how many bytes is an unsigned int on an...

Question: 1 how many bytes is an unsigned int on an...

Question details

1. How many bytes is an unsigned int on an 8-bit MCU? and what's the largest value it can store?

------------------------------------------------------------------------

2. Which stdint.h type is equivalent to char for all platforms?

------------------------------------------------------------------------

3. If it takes one ADD instruction to add two 8-bit numbers together on an 8-bit microcontroller, how many ADD instructions does it take to add two 16-bit numbers together? Hint: think about performing long-addition on two-digit decimal numbers by hand.

------------------------------------------------------------------------

4.

uint8_t a = 27;
uint8_t b = 7;
uint8_t* c = &a;
uint8_t* d = (uint8_t*)((uint8_t)c + b);
*d = 100;

then, what is the value of c ?

------------------------------------------------------------------------

5. Why don't we usually modify hard-coded memory locations when writing software for PCs?

a) We could inadvertently write to memory that doesn't belong to us
b) Because only users with administrative privileges can modify memory directly

c) The address space on a desktop computer is too large to access directly

d) Because desktop C compilers will throw an error message if we try

------------------------------------------------------------------------

6. What does a GPIO pin's Latch parameter control?

a) Whether the pin is an input or an output
b) The pin's logic value when it's configured as an output

c) Whether the pin's input value is a 1 or a 0.

d) Whether the pin should lock to a certain value until the MCU resets

------------------------------------------------------------------------

7. Assume I want to drive GPIO pin P0.5 high while driving all other GPIO Port 0 pins low. Which value would I write to P0's output latch register?

a) 0x08
b) 0x04

c) 0x20

d) 0x05

------------------------------------------------------------------------

8. We haven't talked about open-drain pins yet, but consulting the datasheet, what's the name of the register you would you modify to enable open-drain mode on Port A?

a) ODCON
b) ODCONx

c) SLRCONx

d) ODCONA

------------------------------------------------------------------------

9. How are most MCU peripherals — like GPIO, ADC, UART, I2C, SPI, and DAC — accessed and controlled?

a) By using special C commands that compile to peripheral-specific CPU instructions

b) By reading and writing designated memory locations

c) Using low-level assembly routines that have no C equivalent

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution