From: Clemens Valens Newsgroups: comp.os.msdos.djgpp Subject: Re: Using the modem control and status registers Organization: http://www.remarq.com: The World's Usenet/Discussions Start Here X-Originating-Host: 195.154.148.69 X-Wren-Trace: cNn+3svZheTfnI37yZWYgpyKmYmGiMiVj4KWi4mUmdmHhsyWhsyYmYSMhZKBwIrNlsPU2suI/fHVxJfUxpzewpKa190= Message-ID: <933079897.24959@www.remarq.com> References: <379CC17D DOT 8BD04B6F AT hotmail DOT com> Lines: 54 Date: Tue, 27 Jul 1999 04:51:32 -0800 NNTP-Posting-Host: 10.0.3.195 X-Complaints-To: wrenabuse AT remarq DOT com X-Trace: WReNphoon3 933080190 10.0.3.195 (Tue, 27 Jul 1999 05:56:30 PDT) NNTP-Posting-Date: Tue, 27 Jul 1999 05:56:30 PDT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com How do you synchronize the transmitter and the receiver? You want something like a software UART. Here the receiver monitors the input (usually through an interrupt) and when it sees a predetermined change in level (the startbit) it starts a sample timer. After half a bitlength the receiver samples the input and that will be the value of the received bit. This is repeated one bitlenght later, etc., until all the bits have been received. For instance: #define word_lenght 12 #define bit_lenght 37 #define half_bit_length (bit_length>>1) int index; serial_word bit[word_length]; void startbit_isr() { index = 0; start_sample_timer(half_bit_length); clear_interrupt(); } void sample_timer_isr() { bit[index++] = sample_input(); if (index