Question: 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


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
Get step-by-step solutions from verified subject matter experts
