0
0
Embedded Cprogramming~10 mins

Why I2C is used in Embedded C - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to initialize I2C communication.

Embedded C
I2C_Init([1]);
Drag options to blanks, or click blank then click option'
A100000
B115200
C9600
D4800
Attempts:
3 left
💡 Hint
Common Mistakes
Using UART baud rates instead of I2C clock speed.
2fill in blank
medium

Complete the code to send data over I2C.

Embedded C
I2C_Start();
I2C_Write([1]);
I2C_Stop();
Drag options to blanks, or click blank then click option'
A9600
B0x50
C0xFF
D100000
Attempts:
3 left
💡 Hint
Common Mistakes
Using baud rates or clock speeds instead of device address.
3fill in blank
hard

Fix the error in the I2C read function call.

Embedded C
uint8_t data = I2C_Read([1]);
Drag options to blanks, or click blank then click option'
A0
B2
C1
D3
Attempts:
3 left
💡 Hint
Common Mistakes
Using 0 which stops reading prematurely.
4fill in blank
hard

Fill both blanks to create a dictionary of device addresses and their names.

Embedded C
const char* devices = {
  [1]: "Sensor",
  [2]: "EEPROM"
};
Drag options to blanks, or click blank then click option'
A0x40
B0x50
C0x60
D0x70
Attempts:
3 left
💡 Hint
Common Mistakes
Using invalid or uncommon addresses.
5fill in blank
hard

Fill all three blanks to complete the I2C communication sequence.

Embedded C
I2C_Start();
I2C_Write([1]);
uint8_t data = I2C_Read([2]);
I2C_Stop();
return [3];
Drag options to blanks, or click blank then click option'
A0x68
B1
Cdata
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Returning 0 instead of the read data.
Using wrong device address.