Send a break byte with windows com-port
Here is a copy of the datasheet from a microcontroller:
Break characters are a full character time of logic 0 (including a 0 where the stop bit would be normally).
This is what I want to generate with the windows COM port (Windows SDK). The problem is I don't see a way to have the stop-bit set to zero. Any ideas?`
SetCommBreak() seems a bit like what i want but I don't see a way to have it exactly timed to send onl开发者_Python百科y one byte.
Environment:
- Visual C++ (writing C-Code)
- including window.h
- on Windows XP
Thanks!
SetCommBreak() is indeed what you want here. In most cases it doesn't matter if the break condition lasts too long, as long as it's at least 8 bits of logic "0" - because the receiver won't detect the start of a new byte until it hears at least one "1" bit on the line.
Which microcontroller are you using? With that info it might be possible to confirm whether this would apply to your particular situation.
Does it use the parity bit? If not you might be able to set the parity of the port to SPACEPARITY and send an 8 bit byte, you might also be able to change the number of bits using http://msdn.microsoft.com/en-us/library/aa363143%28VS.85%29.aspx but it might not work, I personally haven't tested.
精彩评论