From: bicoman on 22 Feb 2005 20:05 I'm having a problem with my serial port routines that does not make any sense to me. I originally wrote the code to use non-overlapped serial port reading and writing. It works great. (the serial port anyway). The problem is the waitcommevent method hangs the program and it quits responding. Now for the weird part. When I go to overlapped io in CreateFile with FILE_FLAG_OVERLAPPED, my serial port stops reading. The program isn't hung anymore, and the connected device is definetly transmitting the appropriate bytes, the waitCommEvent function just quits seeing them. I know that WaitCommEvent is timing out because I checked. I've been fighting with this problem all day and am at my wits end. Has anyone ever had a similar problem?
From: Joseph M. Newcomer on 23 Feb 2005 01:22 You can't do concurrent I/O (input and output) without using FILE_FLAG_OVERLAPPED. End of story. If you need to do both input and output, forget non-overlapped I/O. Define "stops reading". I've never used WaitCommEvent for serial programming (I've written a ton of serial port code), and I've never had problems reading or writing a serial port. I'd suggest rewriting the code to not need this technique. I've posted some overlapped code for input within the last couple days; search back in the archives for this newsgroup. joe On Tue, 22 Feb 2005 17:05:03 -0800, "bicoman" <bicoman(a)discussions.microsoft.com> wrote: >I'm having a problem with my serial port routines that does not make any >sense to me. >I originally wrote the code to use non-overlapped serial port reading and >writing. It works great. (the serial port anyway). The problem is the >waitcommevent method hangs the program and it quits responding. Now for the >weird part. When I go to overlapped io in CreateFile with >FILE_FLAG_OVERLAPPED, my serial port stops reading. The program isn't hung >anymore, and the connected device is definetly transmitting the appropriate >bytes, the waitCommEvent function just quits seeing them. I know that >WaitCommEvent is timing out because I checked. I've been fighting with this >problem all day and am at my wits end. Has anyone ever had a similar problem? Joseph M. Newcomer [MVP] email: newcomer(a)flounder.com Web: http://www.flounder.com MVP Tips: http://www.flounder.com/mvp_tips.htm
From: bicoman on 23 Feb 2005 12:29 "bicoman" wrote: > I'm having a problem with my serial port routines that does not make any > sense to me. > I originally wrote the code to use non-overlapped serial port reading and > writing. It works great. (the serial port anyway). The problem is the > waitcommevent method hangs the program and it quits responding. Now for the > weird part. When I go to overlapped io in CreateFile with > FILE_FLAG_OVERLAPPED, my serial port stops reading. The program isn't hung > anymore, and the connected device is definetly transmitting the appropriate > bytes, the waitCommEvent function just quits seeing them. I know that > WaitCommEvent is timing out because I checked. I've been fighting with this > problem all day and am at my wits end. Has anyone ever had a similar problem? "Stops Reading" means the data is arriving, I can see it on my o'scope. WaitCommEvent never returns true, it just times out. So the loop that grabs the data from the Serial port isa never entered, the program just sits there spinning its wheels until I left click to abort the process. When CreateFile is opened without FILE_FLAG_OVERLAPPED, the data is read properly. However, WaitCommEvent blocks and my controls go dumb.
From: bicoman on 23 Feb 2005 12:29 "bicoman" wrote: > I'm having a problem with my serial port routines that does not make any > sense to me. > I originally wrote the code to use non-overlapped serial port reading and > writing. It works great. (the serial port anyway). The problem is the > waitcommevent method hangs the program and it quits responding. Now for the > weird part. When I go to overlapped io in CreateFile with > FILE_FLAG_OVERLAPPED, my serial port stops reading. The program isn't hung > anymore, and the connected device is definetly transmitting the appropriate > bytes, the waitCommEvent function just quits seeing them. I know that > WaitCommEvent is timing out because I checked. I've been fighting with this > problem all day and am at my wits end. Has anyone ever had a similar problem? "Stops Reading" means the data is arriving, I can see it on my o'scope. WaitCommEvent never returns true, it just times out. So the loop that grabs the data from the Serial port isa never entered, the program just sits there spinning its wheels until I left click to abort the process. When CreateFile is opened without FILE_FLAG_OVERLAPPED, the data is read properly. However, WaitCommEvent blocks and my controls go dumb.
From: bicoman on 23 Feb 2005 12:29 "bicoman" wrote: > I'm having a problem with my serial port routines that does not make any > sense to me. > I originally wrote the code to use non-overlapped serial port reading and > writing. It works great. (the serial port anyway). The problem is the > waitcommevent method hangs the program and it quits responding. Now for the > weird part. When I go to overlapped io in CreateFile with > FILE_FLAG_OVERLAPPED, my serial port stops reading. The program isn't hung > anymore, and the connected device is definetly transmitting the appropriate > bytes, the waitCommEvent function just quits seeing them. I know that > WaitCommEvent is timing out because I checked. I've been fighting with this > problem all day and am at my wits end. Has anyone ever had a similar problem? "Stops Reading" means the data is arriving, I can see it on my o'scope. WaitCommEvent never returns true, it just times out. So the loop that grabs the data from the Serial port isa never entered, the program just sits there spinning its wheels until I left click to abort the process. When CreateFile is opened without FILE_FLAG_OVERLAPPED, the data is read properly. However, WaitCommEvent blocks and my controls go dumb.
|
Next
|
Last
Pages: 1 2 3 Prev: Really simple questions re CSliderCtrl Next: CEdit - Updating without Scrolling |