Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a python program to implement Tow and Thich registers (registers 2 and 3, respectively) of an 12C temperature sensor device (TMP 102) using i2eget

image text in transcribed

image text in transcribed

Write a python program to implement Tow and Thich registers (registers 2 and 3, respectively) of an 12C temperature sensor device (TMP 102) using i2eget and iZcset commands. Only support byre read and byte write. You do not have to support word read and word write. Your program will do the following in an infinite loop: Ask the user to enter a command. If it is a write command, update the register. If it is a read command, print the content of the register. If you need reference code, see python code examples Syntax 12caet bus-address chip-address register-address weite-data 12cget bus-address chip-address register address where the bus-address and chip-address for this device are 2 and 0x48, respectively. If any parameters are missing, print an error message but your code should continue to run. Writing to an invalid address will be ignored. Reading from an invalid address will return garbage data. Example Write Oxaa to register 2 at address Ox48 on bus 2 Write to register 2 at address 0x48 on bus 2 bus without write data // missing parameter Write Oxbb to register 3 at address 0x48 on bus 2 Write Ox50 to register 2 at address 0x50 on bus 2 // ignored but should not corrupt the registers Read from register 2 at address 0x49 on bus 3 // reading from invalid addresses Read from register 2 at address 0x48 on bus 2 Read from register 3 at address 0x49 on bus 3 . Enter command:i2cset 20x48 2 Oxaa Enter command: i2cset 2 @x48 2 ERROR: more parameters expected for i2cset Enter command: i2cset 20x48 3 Oxbb Enter command: i2cset 20x50 2 Ox50 Enter command: i2cget 3 @x49 2 Oxff Enter command: i2cget 2 0x48 2 Oxad Enter command: i2cget 2 ex48 3 Oxbb Enter command: Write a python program to implement Tow and Thich registers (registers 2 and 3, respectively) of an 12C temperature sensor device (TMP 102) using i2eget and iZcset commands. Only support byre read and byte write. You do not have to support word read and word write. Your program will do the following in an infinite loop: Ask the user to enter a command. If it is a write command, update the register. If it is a read command, print the content of the register. If you need reference code, see python code examples Syntax 12caet bus-address chip-address register-address weite-data 12cget bus-address chip-address register address where the bus-address and chip-address for this device are 2 and 0x48, respectively. If any parameters are missing, print an error message but your code should continue to run. Writing to an invalid address will be ignored. Reading from an invalid address will return garbage data. Example Write Oxaa to register 2 at address Ox48 on bus 2 Write to register 2 at address 0x48 on bus 2 bus without write data // missing parameter Write Oxbb to register 3 at address 0x48 on bus 2 Write Ox50 to register 2 at address 0x50 on bus 2 // ignored but should not corrupt the registers Read from register 2 at address 0x49 on bus 3 // reading from invalid addresses Read from register 2 at address 0x48 on bus 2 Read from register 3 at address 0x49 on bus 3 . Enter command:i2cset 20x48 2 Oxaa Enter command: i2cset 2 @x48 2 ERROR: more parameters expected for i2cset Enter command: i2cset 20x48 3 Oxbb Enter command: i2cset 20x50 2 Ox50 Enter command: i2cget 3 @x49 2 Oxff Enter command: i2cget 2 0x48 2 Oxad Enter command: i2cget 2 ex48 3 Oxbb Enter command

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

What Is A Database And How Do I Use It

Authors: Matt Anniss

1st Edition

1622750799, 978-1622750795

More Books

Students also viewed these Databases questions

Question

Understanding Group Affiliations?

Answered: 1 week ago

Question

3. You can gain power by making others feel important.

Answered: 1 week ago