请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
器件型号:BQ27441-G1 大家好、
我编写了一个 python 代码、如下所示、尝试将设计容量设置为1200mAh、但当我尝试写入地址 0x60时、我收到以下错误消息
"bus.write_byte_data (地址、0x60、0x1f)
IOError:[errno 121] Remote I/O error"(IOError:[errno 121]远程 I/O 错误)
我能够读取0x60;就在我尝试写入它时、我会收到 该消息。 是否有人知道导致此错误的原因?
谢谢!
导入 smbus
导入时间
import struct
bus=smbus.SMBus (1)
address = 0x55
e=bus.read_i2c_block_data (address、0x0a、2)
(full_cap、)=struct.unpackt ('h'、bytearray (e)[0:2])
打印"完全可用容量为"、full_cap、unpackt、 'ma'
#timing to write the Nominal capacity
bus.write_byte_data (address、0x00、0x00)
bus.write_byte_data (address
、0x00b、0x00)
bus.write_byte_data (address、0x00、0x00) bus.write_byte (byte_data
) 0x04、0xbyte_datace.byte (write、0x00、0x42)、byte_datace.byte_datace.byte_datace.byte (write、0x00、0x04、0xbyte_datace.byte_datace.byte (b)、0x00、0x00、0x00、0xbyte_datace.byte_datace.byte_datace.byte_datace.byte_datace.byte.byte.byte_datas.b、0x00、0x00、0x00、0x42、0x00、0x00、写入
(write_datace.byte_datace.byte.byte_datace.byte.byte.byte.byte.b