根据 总字节和每次读取的大小来 分段
def getReadCommand():
readByteLen = 100
totalByteLen = 218
p1p2MaxLen = 4
hexForecourt = hex(readByteLen)
hexForecourt = hexForecourt[2:]
count = math.ceil(totalByteLen / readByteLen)
for i in range(count):
comonad = "00B0"
addCount = i * readByteLen
lastCount = totalByteLen - addCount
p1p2 = hex(2 + addCount)
p1p2 = str(p1p2[2:])
p1p2Str = str(p1p2).zfill(p1p2MaxLen)
if lastCount > readByteLen:
commands = comonad+p1p2Str+hexForecourt
else:
commands = comonad + p1p2Str + str(lastCount).zfill(2)
print(commands)