?MSCOMM - Read Signals From Serial Ports 
Author Message
 ?MSCOMM - Read Signals From Serial Ports

Hi,

Is anybody out there who can tell me how to take the time between two
CommEvents, if they are only some
1/10000 Sec. apart. Everything I tried until now could only count in
m-Seconds. And so, I have different CommEvents from on Pin(e.g. data
carrier detect - pin), but always 10 or 20 of them are written down
together with the same time, cause the spacing seams to be to short.

MfG, Uwe Merkel



Wed, 18 Jun 1902 08:00:00 GMT  
 ?MSCOMM - Read Signals From Serial Ports

Quote:

> Hi,

> Is anybody out there who can tell me how to take the time between two
> CommEvents, if they are only some
> 1/10000 Sec. apart. Everything I tried until now could only count in
> m-Seconds. And so, I have different CommEvents from on Pin(e.g. data
> carrier detect - pin), but always 10 or 20 of them are written down
> together with the same time, cause the spacing seams to be to short.

> MfG, Uwe Merkel

Uwe, the PC timer click on W95 and W98 machines is 18.2 / second,
so you can't get any finer timing than that without manipulating
the system-wide timer interrupt, which would probably
disrupt a bunch of other code.  On Windows/NT systems (at least
the later ones), you have 100 timer interruptes per second.

Here's a cheat that gets me reasonable approximations:

During your program initialization, run some CPU-only code
(in a loop) and count how many of those loops you can do
within one timer interrupt.  Do several timings to get
an average.  Then, while you're waiting for another character
in the input buffer, go through the same loop and take
the ratio of those loop counts against your standard value.
NOTE:  Because in the second loop you'll be testing the
inbuffercount (spelling?), you should also test the
inbuffercount during your establishing loops.  In other
words, the loops you use to create a fine timing constant
during initialization must be as nearly identical to the one
you use when actually receiving the data as you can get them.

This is not an ideal solution by far, but it may work for you.

Regards,
Joe Erhardt
another fine example of Germanic stock  ;-)



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. how to set serial port signals with VB?

2. HELP! reading special port signals in vb4

3. How to loop comm port control to read text files through serial port in VB3

4. reading a signal from the paralell port

5. Reading a 15V+ signal on a COM port from VB

6. mscomm - send/receive from serial port

7. Mscomm, serial port question

8. Using serial port without using MSCOMM

9. Mscomm doesn't hear my serial port

10. MSComm problem with multi-port serial card

11. VB Communications, MSComm, Serial Ports and Modems...

12. Modems, Serial Ports, MSComm and VB

 

 
Powered by phpBB® Forum Software