freddyokel
New member
Hi,
I'm writing a bit of code to talk to an external serial device (via USB-Serial converter).
This device requires the data line to be pulled low for 25ms and then high for 25ms before serial transmission starts.
Luckily, the SerialPort control has the Breakstate property to facilitate this kind of thing.
However, my problem is accurately timing the break state.
Here's a code fragment:
serPort.BreakState = True
Thread.Sleep(25)
serPort.BreakState = False
Thread.Sleep(25)
However, what the output trace on the logic analyser says is that the low state is 29ms long
and the high state is 30ms.
The 4-5ms which .net seems to be taking to flip the pin state is quite frankly an eternity which
is causing my remote device to go back to sleep again.
Obviously I can't just subtract 5ms from the wait time as this may be different on another machine.
Any ideas?
Ta,
Fredd
I'm writing a bit of code to talk to an external serial device (via USB-Serial converter).
This device requires the data line to be pulled low for 25ms and then high for 25ms before serial transmission starts.
Luckily, the SerialPort control has the Breakstate property to facilitate this kind of thing.
However, my problem is accurately timing the break state.
Here's a code fragment:
serPort.BreakState = True
Thread.Sleep(25)
serPort.BreakState = False
Thread.Sleep(25)
However, what the output trace on the logic analyser says is that the low state is 29ms long
and the high state is 30ms.
The 4-5ms which .net seems to be taking to flip the pin state is quite frankly an eternity which
is causing my remote device to go back to sleep again.
Obviously I can't just subtract 5ms from the wait time as this may be different on another machine.
Any ideas?
Ta,
Fredd