comp.lang.ada
 help / color / mirror / Atom feed
From: Ted Dennison <dennison@telepath.com>
Subject: Re: Ada Communications
Date: 2000/01/11
Date: 2000-01-11T00:00:00+00:00	[thread overview]
Message-ID: <85foca$cb6$1@nnrp1.deja.com> (raw)
In-Reply-To: 947597144.1660.0.nnrp-09.c2de4527@news.demon.co.uk

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1828 bytes --]

In article <947597144.1660.0.nnrp-09.c2de4527@news.demon.co.uk>,
  "TAMS Team" <tamsteam@rolls-royce-rps.demon.co.uk> wrote:
> How do I read and write to a serial port (e.g. COM2) using Ada?  What
> we intend to do is read serial data coming down an RS422 line
> formatted to RS100 protocol, and also transmit back up using the same
> standards.

The flip answer is that you can do it the same way you'd do it in C.
Just call the appropriate system calls.

However, depending on your OS (and perhaps on your compiler) there may
be an even easier way. But, to quote from the Microsoft documentation,
"Serial communications in Microsoft� Win32� is significantly different
from serial communications in 16-bit Microsoft Windows�." DOS is
different yet agian.

If your needs are simple, you may be able to just open the "COM2:" port
using Ada.Sequential_IO. When I had to do this same thing on WinNT, I
used the CreateFile system call to open the port, so that I could set
the parity etc. from my program and use the blocking, non-blocking I/O,
and timed I/O calls.

So what we get down to is that I'm not really sure what your question
is. I've listed below some possiblities, along with their answers:

Q: Do I need system calls to do this?
A: Maybe, it depends on what OS you are using.

Q: Can an Ada program make system calls?
A: Yes.

Q: What system calls do I need to make to do this?
A: That isn't an Ada question, its an OS question. It also depends on
your exact I/O needs (eg: Blocking or non-blocking? Timeouts or no
timeouts? What does your protocol look like?)

Q: How do I make OS calls in Ada?
A: Check your compiler docs. If you are still confused after that, post
your questions here, making sure to mention your compiler and target OS.

--
T.E.D.


Sent via Deja.com http://www.deja.com/
Before you buy.




      parent reply	other threads:[~2000-01-11  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-01-11  0:00 Ada Communications TAMS Team
2000-01-11  0:00 ` reason67
2000-01-11  0:00 ` Ted Dennison [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox