Skip to content

Why the silence_time can affect the roudtrip_time? #98

Open
@billyhuangyr

Description

I'm using minimodbus RTU to communicate with a motor, and the baudrate I set is 115200. In order to test the time the master used to read a specific data from a slave. I write a simple loop which is like:

while True:
       Instrument.read_register(xxxx)
       time.sleep(0.01)

I enabled the debug mode and print the roudtrip_time. I found it's really tricky that if I change the sleep time of time.sleep(), the roudtrip_time will also change. For example:
if I set time.sleep(0.01), then the roudtrip_time is almost 5ms.
if I set time.sleep(0.005), then the roudtrip_time is almost 10ms.
if I set time.sleep(0.002), then the roudtrip_time is almost 13ms.
Seems there is a tricky equation: sleeptime + roudtrip_time = 15ms. I wanna know why? And how to reduce the total time each loop used?

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions