From: "Alexei A. Frounze" Newsgroups: comp.os.msdos.djgpp Subject: Re: reading data from the com port Date: Tue, 30 May 2000 19:06:26 +0400 Organization: None Lines: 24 Message-ID: <3933D8F2.9C52939E@the_message_body.com> References: <3933bf3a DOT 1039708432 AT news DOT gatech DOT edu> NNTP-Posting-Host: ppp105-75.dialup.mtu-net.ru Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: 7bit X-Trace: gavrilo.mtu.ru 959699504 99487 212.188.105.75 (30 May 2000 15:11:44 GMT) X-Complaints-To: usenet-abuse AT mtu DOT ru NNTP-Posting-Date: 30 May 2000 15:11:44 GMT X-Mailer: Mozilla 4.72 [en] (Win95; I) X-Accept-Language: ru,en To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Your problem is data integrity and data loss. You need to synchronize your I/O usibg those 254 and 85 bytes as ACK and NAK plus counting number of bytes between these enclosing. This approach works fine. Otherwise you may loose your data (especially under Windows) and be off the synchronization. Good Luck Alexei A. Frounze ----------------------------------------- E-mail: alexfru [AT] chat [DOT] ru Homepage: http://alexfru.chat.ru Mirror: http://members.xoom.com/alexfru Jonathan Swaby wrote: > > I have a ADC chip connected to com1: on my computer. I am using > outportb to configure the port. This works fine. The ADC chip spits > out a 7 byte packet. The first byte is 254 and the last is 85. I have > been able to read the bytes, but only one at a time. How do I go about > reading 7 bytes in on shot? I have used inportb to read on character > at a time. That works fine. It prints that data as it comes in. I need > to make sure that I am getting packets that start with 254 and end > with 85. Since the device is constantly sending data, there are > sometimes when the program gets data out of sequence.