Michael Burr: The description of intermittent work is accurate. Often, split signals are sent significantly longer than one character time.
"Break" , - "" . "" , , ( reset ..) , , . "", 8 7- , .
, SetCommBreak, (, 2 9600 ), ClearCommBreak. , , .
, , "break" , ( ): -
procedure SendPacket(CommPort port, Packet packet)
{
SetCommBreak(port)
Sleep(2);
ClearCommBreak(port)
foreach(char in packet)
SendChar(port, char)
}
, API, . . WaitCommEvent, , .
bool ReadCharOrBreak(char *ch); // return TRUE if break, FALSE if ch contains received char
100- "", .
void ReadAndProcessPackets()
{
char buff[100];
int count;
count = 0;
while (true)
{
char ch;
if (ReadcharOrBreak(ch))
count = 0;
else
{
if (count < 100)
{
buff[count++] = ch;
if (count == 100)
ProcessPacket(buff);
}
else
Error("too many bytes rx'd without break")
}
}
- , ...
, Break, DMX-512.
, "" (a ), "Mark After" Break "(MAB). . . 513 .