Rupture signal RS 232

I got an RS232 signal capture device. and it works great.

I need help to figure out the data. In fact, we bought it because we are dealing with a machine controller of the late 80s that uses serial communication. We were not lucky, although we knew the parameters of the port.

Based on the data that I reset, the machine control uses an interrupt signal as part of the protocol. I am having trouble duplicating it with VB and MSComm. I know to turn on and off the break signal. But I'm not sure what I should do with this. I have to leave it turned on for every byte of data sent. Or send a byte of data and then switch.

It also bothers me how I should receive any data from the controller. Should I check the box when the gap is on, and then when it is off, read the input?

+4
source share
5 answers

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);  // 2 milliseconds - assuming 9600 baud. Pro-rata for others
    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; // start of packet - reset count
  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 .

+8

. RS-232 , "" ( "1" ) ( , -12 ). , "" ( "0" ) ( ), ( ) , / ( 1) , , ( 1 ).

, , . , , :

1 start bit + however many data bits + a parity bit (if any)

, - , "break" . .

, .

+6

"" , .

, . .

"break" (500 ?), (50 ?), .

+1

- , ( 80- ) . , ( ). 0x00 , 0xFF.

0

, . - , ( USB-) ( HyperTerminal Windows - Vista). ( , , ), . , . , , - ( "" ).

0

Source: https://habr.com/ru/post/1715196/


All Articles