comp.lang.ada
 help / color / mirror / Atom feed
* Ada Communications
@ 2000-01-11  0:00 TAMS Team
  2000-01-11  0:00 ` reason67
  2000-01-11  0:00 ` Ted Dennison
  0 siblings, 2 replies; 3+ messages in thread
From: TAMS Team @ 2000-01-11  0:00 UTC (permalink / raw)


Help, complete novice here!

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.

I'm not sure where to start here - simple answers, please, as I'm trying to
learn at least 3 new things at once here!!!

(Don't say "Use another language", as we have to do it this way, and the
incoming data is fixed to RS422/RS100!)

Thanks!






^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Ada Communications
  2000-01-11  0:00 Ada Communications TAMS Team
@ 2000-01-11  0:00 ` reason67
  2000-01-11  0:00 ` Ted Dennison
  1 sibling, 0 replies; 3+ messages in thread
From: reason67 @ 2000-01-11  0:00 UTC (permalink / raw)


In article <947597144.1660.0.nnrp-09.c2de4527@news.demon.co.uk>,
  "TAMS Team" <tamsteam@rolls-royce-rps.demon.co.uk> wrote:
> Help, complete novice here!
>
> 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.
>
> I'm not sure where to start here - simple answers, please, as I'm
trying to
> learn at least 3 new things at once here!!!

What compiler, what type of machine? This is a hardware specific
question.
---
Jeffrey Blatt


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




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Ada Communications
  2000-01-11  0:00 Ada Communications TAMS Team
  2000-01-11  0:00 ` reason67
@ 2000-01-11  0:00 ` Ted Dennison
  1 sibling, 0 replies; 3+ messages in thread
From: Ted Dennison @ 2000-01-11  0:00 UTC (permalink / raw)


[-- 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.




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2000-01-11  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-01-11  0:00 Ada Communications TAMS Team
2000-01-11  0:00 ` reason67
2000-01-11  0:00 ` Ted Dennison

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