News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

serial port question...

Started by gnewz10, November 29, 2006, 08:50:49 AM

Previous topic - Next topic

gnewz10

gud day all,

i have an application that reads and writes to a COM port... my problem is that when i invoked the waitcommevent, and when the event that i register with it to wait, doesnt happened  then the application waits forever. how can i make it wait for a certain time end abort if no event happened during that time? any other ways?  if you know some links related to this please do let me know... any help i would appreciate. thanks.

PBrennick

gnewz10,
You just need to set a time-out for the event, currently it sounds like the setting is INFINITE which is what is causing the problem, read the following three functions for help:
Quote
Single-object Wait Functions

The SignalObjectAndWait, WaitForSingleObject, and WaitForSingleObjectEx functions require a handle of one synchronization object. These functions return when one of the following occurs:

·   The specified object is in the signaled state.
·   The time-out interval elapses. The time-out interval can be set to INFINITE to specify that the wait will not time out.



The SignalObjectAndWait function enables the calling thread to atomically set the state of an object to signaled and wait for the state of another object to be set to signaled.

Paul
The GeneSys Project is available from:
The Repository or My crappy website

redskull

this is a pretty good reference, written in a not-so-reference like style

http://msdn2.microsoft.com/en-us/library/ms810467.aspx
Strange women, lying in ponds, distributing swords, is no basis for a system of government