VBA RS232 Class - serial port I/O ReHash

  • In:
    VBA RS232 Class - serial port I/o with modcomm

    Brendan has provided a great service to those of us having to do Serial communications.... still.;(

    I have however found a small bug when a time delay between writes and reads spans midnight. In this case, the application will hang indefinitely waiting for Timer to reach a value greater than 86400 seconds. Since Timer is seconds since midnight, it has values ranging only from 0 to 86400.

    Here is a patch to the Delay subroutine I believe will resolve this issue. I welcome others to make suggestions on improving this workaround. This solution has a downside in that all events are paused up until midnight. At most, this should be a couple of seconds. More typically, this would be nearer 0.1 seconds.

    Note that since the time delay value T is typically much less than one second any new solutions will need more precision in the wait than a single second.

  • I probably don't use same Communication script. Anyway, there is same Delay/Wait algorithm using "Timer". So I'm dealing with same issue.

    I have app that reads values from device on COM port every 15 seconds. And after last read before midnight it reports:

    "COM Error: Error (-1): CommOpen - Port in use."

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!