comp.lang.ada
 help / color / mirror / Atom feed
* Win NT + Object Ada: serial port I/O
@ 1999-02-03  0:00 lynch
  1999-02-03  0:00 ` news.oxy.com
  1999-02-04  0:00 ` dennison
  0 siblings, 2 replies; 13+ messages in thread
From: lynch @ 1999-02-03  0:00 UTC (permalink / raw)


Hi,

I have been asked to write a DLL which will be used to talk to a display (LCD)
connected via an RS-485 serial line (DIN 66 019 protocol). The card apparently
comes with a driver which makes it act like a standard COM-Port.

Rather than fork out the $XXX for something like Visual C++ (and a new HDD) I
would like to develop using the Object Ada we already have.

Does anyone have any information/experience programming serial ports in Ada on
a Windows platform? I can think of two ways to do this:

1) Use the standard Ada.*.IO routines on the file "COM1:". I tested this with
   a VT420 on the other end and came across two problems:

   a) It seems the port needs to be "initialized" by calling MODE COM1: in a
      console window, even though the settings are exactly the same as those
      in the windows control panel.

   b) I need a timeout capability for the reply from the LCD/Terminal.
      Using Get or Get_Immediate without "Available" blocks indefinitely,
      all attempts to use Get_Immediate with loops and timers have failed.
      (Available seems to be _always_ false!?)

2) Use the Win32Ada binding with CreateFile, SetCommTimeouts etc. however the
 help file provided with Object Ada is utterly useless. I have yet to find 
the section which "describes [...] the transformation rules (from C to Ada)" 
Also the guy who will be using this DLL is worried about all the type 
conversions etc. ("why use an Ada compiler if you're writing C anyway...")

Are there any alternative (higher-level) "COM-Port"-Bindings available?
All I need to do is write a stream of ASCII characters and read characters
with a timeout after x ms, in case somebody pulled the plug or whatever.

If anyone has some sample code that accesses a COM-port using Object Ada
I would be most grateful for a quick peek at it! (This is my second-ever
MS-Windows project, I hope it will be my last...)

Cheers,
Andrew.


-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    




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

* Re: Win NT + Object Ada: serial port I/O
  1999-02-03  0:00 Win NT + Object Ada: serial port I/O lynch
@ 1999-02-03  0:00 ` news.oxy.com
  1999-02-04  0:00   ` lynch
  1999-02-04  0:00 ` dennison
  1 sibling, 1 reply; 13+ messages in thread
From: news.oxy.com @ 1999-02-03  0:00 UTC (permalink / raw)



lynch@cci.de wrote in message <79952r$2t$1@nnrp1.dejanews.com>...
>Hi,
>
>I have been asked to write a DLL which will be used to talk to a display
(LCD)
>connected via an RS-485 serial line (DIN 66 019 protocol). The card
apparently
>comes with a driver which makes it act like a standard COM-Port.


Almost all  Communication boards come with a driver that act like a standard
COM-Port.
One of the examples in industry is multiport DigiBoard product line.

>2) Use the Win32Ada binding with CreateFile, SetCommTimeouts etc. however
the
> help file provided with Object Ada is utterly useless. I have yet to find
>the section which "describes [...] the transformation rules (from C to
Ada)"
>Also the guy who will be using this DLL is worried about all the type
>conversions etc. ("why use an Ada compiler if you're writing C anyway...")


You should use Win32.hlp file instead.  It contains all the needed
information.

>Are there any alternative (higher-level) "COM-Port"-Bindings available?
>All I need to do is write a stream of ASCII characters and read characters
>with a timeout after x ms, in case somebody pulled the plug or whatever.


Probably some time in a future we will have such OO Communication Libraries.
Some time ago I suggested to RR Software (namely to Randall Brukardt) to
think about developing and including high-level OO communication library
into their future CLAW releases (to make it more closer to Delphi). Idea was
that these  OO libraries could use any available communication means (comm
ports, sockets, pipes,mailslots, memory mapped files,NetBios e.tc.) for
programs and equipment intercommunications. There are a lot of needs for
that in a real life (in telecommunications area). May be they will do this.
Maybe some others will be the first.
Later I found that all that was already implemented as Adaptive
Communication Environment (ACE) developed by
Douglas C. Washington University in Saint Louis
(http://siesta.cs.wustl.edu/~schmidt/ACE.html) .
The only problem that it was written in  C++. Maybe someone sometime will
rewrite it totaly in Ada 95.
This toolkit is freely available and may be used as an excellet example.

>If anyone has some sample code that accesses a COM-port using Object Ada
>I would be most grateful for a quick peek at it!

There are many software components for COM ports written for Borland Delphi.
Many of them  can be easily rewritten in Ada 95. It is much more easy to
translate code from Turbo Pascal to Ada 95 than from C++ to Ada.
Also that things are invaluable knowledge base of high-level OOP programming
under Windows NT.
Delphi comes with source code and is very useful in that respect.
There are also many professional communication tools from 3d party
companies.
Just have a look at (http://www.inprise.com/delphi/deltools.html)
Communication Tools section and especially to the "Async Professional"
toolkit from TurboPower Software Company.
(http://www.turbopower.com/products/) .

>(This is my second-ever
>MS-Windows project, I hope it will be my last...)


The Windows NT is not such bad thing at all. When you get grasp of it'
concepts many things will appear very simple. Windows NT programming is
definitely much more complex then DOS-like programming. It requires many
calls to low-level APIs and programmer should know them very well to write
good code. That's why Companies that make this process more easier have a
lot of success.

On the other hand Window NT is designed to make life easier for  the "end
users" and not for the programmer. It is well protected from programmers
errors and badly written applications. It  just shuts down application that
is trying to do something wrong (e.g. directly access some system resources
or other program resources). Only badly written drivers can put WindowsNT on
the knees.
Each system has it's own set of rules. If you do not obey that rules for any
reason (e.g. - you just do not know them) then you may feel frustrated quite
very often. This is just the same as with Ada.

Regards,
Vladimir Olensky
(vladimir_olensky@yahoo.com)
(Vladimir_Olensky@oxy.com)
Telecommunication specialist,
Occidental C.I.S. Service, Inc. ( www.oxy.com )
Moscow,
Russia.









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

* Re: Win NT + Object Ada: serial port I/O
  1999-02-03  0:00 Win NT + Object Ada: serial port I/O lynch
  1999-02-03  0:00 ` news.oxy.com
@ 1999-02-04  0:00 ` dennison
  1999-02-04  0:00   ` Tom Moran
  1999-02-16  0:00   ` lynch
  1 sibling, 2 replies; 13+ messages in thread
From: dennison @ 1999-02-04  0:00 UTC (permalink / raw)


In article <79952r$2t$1@nnrp1.dejanews.com>,
  lynch@cci.de wrote:
> Does anyone have any information/experience programming serial ports in Ada on
> a Windows platform? I can think of two ways to do this:

If you mean a win32 platform, I have done that. I wrote a program to
communicate with another machine via a com port on an NT 3.5 machine using
the old vads Ada83.


> 1) Use the standard Ada.*.IO routines on the file "COM1:". I tested this with
>    a) It seems the port needs to be "initialized" by calling MODE COM1: in a
>       console window, even though the settings are exactly the same as those
>       in the windows control panel.

There's a Win32 system call to do this for you. Check your documentation.

>    b) I need a timeout capability for the reply from the LCD/Terminal.
>       Using Get or Get_Immediate without "Available" blocks indefinitely,
>       all attempts to use Get_Immediate with loops and timers have failed.
>       (Available seems to be _always_ false!?)
>
> 2) Use the Win32Ada binding with CreateFile, SetCommTimeouts etc. however the
>  help file provided with Object Ada is utterly useless. I have yet to find

I created my *own* Win32 bindings to do the job, but those are the routines I
used.

> Are there any alternative (higher-level) "COM-Port"-Bindings available?
> All I need to do is write a stream of ASCII characters and read characters
> with a timeout after x ms, in case somebody pulled the plug or whatever.

Its not quite that simple. Your serial settings have to match the settings the
machine on the other end is using. Since there's no way for a "higer-level"
binding to know that information ahead of time. You *have* to have the mode
call.

As for the writing and reading, the system calls available seem quite adequate
for the purpose.

> If anyone has some sample code that accesses a COM-port using Object Ada
> I would be most grateful for a quick peek at it! (This is my second-ever
> MS-Windows project, I hope it will be my last...)

Unfortunately, I don't have access to that code anymore, and can't transcribe
it from memory. I can tell you that I had horrible problems trying to get
good data from the port at first. The settings on both ends have to be just
right, and of course the cable has to be wired just right. You also have to
make sure no other device is using the port's IRQ (that seems to happen a lot
w/ Win95). Once it works though, its pretty clear sailing.


T.E.D.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    




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

* Re: Win NT + Object Ada: serial port I/O
  1999-02-04  0:00 ` dennison
@ 1999-02-04  0:00   ` Tom Moran
  1999-02-16  0:00   ` lynch
  1 sibling, 0 replies; 13+ messages in thread
From: Tom Moran @ 1999-02-04  0:00 UTC (permalink / raw)


>As for the writing and reading, the system calls available seem quite adequate
>for the purpose.
  Unless, for instance, you want to communicate with X10 where you are
supposed to delay 1 ms at certain points, or you are trying to use
other RS232 pins to control something.  If your problem only needs the
higher level abstraction Windows gives you, then you're OK.




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

* Re: Win NT + Object Ada: serial port I/O
  1999-02-03  0:00 ` news.oxy.com
@ 1999-02-04  0:00   ` lynch
  1999-02-04  0:00     ` news.oxy.com
  0 siblings, 1 reply; 13+ messages in thread
From: lynch @ 1999-02-04  0:00 UTC (permalink / raw)


First of all I would like to thank Martin C. Carlisle, Stephen Leake and
Steve Doiel for providing me with sample code for serial i/o.
It seems using the Win32 API is the "right" way, with all the unchecked
and 'Accesses that go with it. At least now that I know how to convert to
LPCVOID and co. I am making progess ;-)


In article <799g51$p0p$1@remarQ.com>,
  "news.oxy.com" <Vladimir_Olensky@oxy.com> wrote:
>
> lynch@cci.de wrote in message <79952r$2t$1@nnrp1.dejanews.com>...
[...]
> >2) Use the Win32Ada binding with CreateFile, SetCommTimeouts etc. however
> the
> > help file provided with Object Ada is utterly useless. I have yet to find
> >the section which "describes [...] the transformation rules (from C to
> Ada)"
> >Also the guy who will be using this DLL is worried about all the type
> >conversions etc. ("why use an Ada compiler if you're writing C anyway...")
>
> You should use Win32.hlp file instead.  It contains all the needed
> information.
[...]

The Win32.hlp file contains explanations of the various functions in C syntax
which of course are very useful, however the version that comes with Object
Ada has no "Contents" and the Index does not say much about communication.
"Communications Overview" tells me less than I know already. Some people
suggested looking at "Communcations Functions" however this does not appear
in the index. It is available via the "Group" link once you've found a
comms function by some other means. Typical Microsoft :-(

My main problem however is the help file for the Ada binding. After looking
through Win32.hlp I know that CreateFile() takes an LPCTSTR, which according
to Win32Ada.hlp is a "new Win32.PCSTR". I can't find PCSTR anywhere! Some of
the sample code uses LPCSTR (no T) which I can't find - what is the
difference?

ReadFile() takes an LPVOID, WriteFile() an LPCVOID, the help file only ever
specifies PCVOID, and so on...

Based on the names and the fact that the API is in C I can usually make a
good guess as to what the types are, but I would much prefer to have a clear
definition.


> The Windows NT is not such bad thing at all. When you get grasp of it'
> concepts many things will appear very simple. Windows NT programming is
> definitely much more complex then DOS-like programming. It requires many
> calls to low-level APIs and programmer should know them very well to write
> good code. That's why Companies that make this process more easier have a
> lot of success.
[...]
> Each system has it's own set of rules. If you do not obey that rules for any
> reason (e.g. - you just do not know them) then you may feel frustrated quite
> very often. This is just the same as with Ada.
>
[...]

Amen.

One of the reasons I find Windows so frustrating is that I come from a Unix
background with the odd bit of VMS tinkering and I am used to having plenty
of decent (hardcopy) documentation (bookshelfs full of SunOS binders, or the
"grey wall" etc.).

From my experience asking friends and colleagues for help with the Win32-API
the Windows attitute seems to be very much "suck it and see". The number of
times I hear "try this" or "maybe that will do it" drives me up the wall.

Anyway, thanks again to those who provided code, now I can start sucking...
(I've been infected already)

Andrew.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    




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

* Re: Win NT + Object Ada: serial port I/O
  1999-02-04  0:00   ` lynch
@ 1999-02-04  0:00     ` news.oxy.com
  0 siblings, 0 replies; 13+ messages in thread
From: news.oxy.com @ 1999-02-04  0:00 UTC (permalink / raw)


>> You should use Win32.hlp file instead.  It contains all the needed
>> information.

>The Win32.hlp file contains explanations of the various functions in C
syntax
>which of course are very useful, however the version that comes with Object
>Ada has no "Contents" and the Index does not say much about communication.
function by some other means. Typical Microsoft :-(


This is not Microsoft fault. This is Aonix fault.
Content to XXX.hlp in Windows NT is separate file.
The problem is that Aonix for some reason did not provide that separate
Win32 file that contains Win32 Contents.
As for me I am using Windows32 help files that comes with Delphi when I need
Win32 help. It contains everything is needed and it is very easy to navigate
around.  Also Delphi source is very good example of various aspects of
Win32 programming. Sorry that Aonix did not take care about that.

>Based on the names and the fact that the API is in C I can usually make a
>good guess as to what the types are, but I would much prefer to have a
clear
>definition.


When I need to look at definitions I just open correspondent  package
specifications and use text searth to find needed definition. It takes few
seconds.
In your case you can have a look at Win32.ads. It contains all the
definitions you were looking for.

It is a best way to check package specifications to find any needed
information. This is for what thay were designed in Ada (to provide clearly
defined interfaces). Ada bindings to Win32 APIs are very well organised and
it is very easy to find what is needed. You also may download demo of CLAW
high-level OO libraries to Win32 API. This is very good example of Win32
Ada programming ( http://www.rrsoftware.com/html/prodinf/claw/claw.htm ).

Regards,
Vladimir Olensky
(vladimir_olensky@yahoo.com)
(Vladimir_Olensky@oxy.com)
Telecommunication specialist,
Occidental C.I.S. Service, Inc. ( www.oxy.com )
Moscow,
Russia.













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

* Re: Win NT + Object Ada: serial port I/O
  1999-02-16  0:00   ` lynch
                       ` (2 preceding siblings ...)
  1999-02-16  0:00     ` dennison
@ 1999-02-16  0:00     ` Steve Doiel
  3 siblings, 0 replies; 13+ messages in thread
From: Steve Doiel @ 1999-02-16  0:00 UTC (permalink / raw)


>
>Which documentation? As I've mentioned before the "documentation" (ring
binder
>and online help files) that comes with Object Ada is more than useless.


If you have ObjectAda Professional, you will find that the MS SDK is also
included on the distribution CDROM.  If you install the SDK separately you
will find that the Win32 SDK help is quite useful.  A number of other
goodies are also present in the SDK (a profiler for example).

As for the printed documentation... it was a big waste of someones time.
I'd much rather they had invested that time on finishing up the few
significant problems remaining in the debugger.

If you are having trouble getting serial I/O working, send me an email and
I'll send you a copy of my thick binding.

SteveD
steved@pacifier.com







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

* Re: Win NT + Object Ada: serial port I/O
  1999-02-04  0:00 ` dennison
  1999-02-04  0:00   ` Tom Moran
@ 1999-02-16  0:00   ` lynch
  1999-02-16  0:00     ` dennison
                       ` (3 more replies)
  1 sibling, 4 replies; 13+ messages in thread
From: lynch @ 1999-02-16  0:00 UTC (permalink / raw)


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

In article <79cu2a$4iu$1@nnrp1.dejanews.com>,
  dennison@telepath.com wrote:
> In article <79952r$2t$1@nnrp1.dejanews.com>,
>   lynch@cci.de wrote:
> > Does anyone have any information/experience programming serial ports in Ada
on
> > a Windows platform? I can think of two ways to do this:
>
> If you mean a win32 platform, I have done that. I wrote a program to
> communicate with another machine via a com port on an NT 3.5 machine using
> the old vads Ada83.
>
> > 1) Use the standard Ada.*.IO routines on the file "COM1:". I tested this
with
> >    a) It seems the port needs to be "initialized" by calling MODE COM1: in a
> >       console window, even though the settings are exactly the same as those
> >       in the windows control panel.
>
> There's a Win32 system call to do this for you. Check your documentation.

Which documentation? As I've mentioned before the "documentation" (ring binder
and online help files) that comes with Object Ada is more than useless.

I now know of BuildCommDCB() and SetCommState() etc. but only because I have
seen them in the sample code so kindly provided by various people.


> > 2) Use the Win32Ada binding with CreateFile, SetCommTimeouts etc. however
the
> >  help file provided with Object Ada is utterly useless. I have yet to find
[...]
> Its not quite that simple. Your serial settings have to match the settings the
> machine on the other end is using. Since there's no way for a "higer-level"
> binding to know that information ahead of time. You *have* to have the mode
> call.

Well, the device on the other end is fixed at 9600 8N1. The PC will be
running Windows NT 4.0 and our software, nothing else. We had naively assumed
the settings in the Control Panel would be used as defaults, however the
ports always default to 1200 7E1 no matter we set in the Control Panel. I
have no idea what Windows uses those settings for... (I am talking about
Einstellungen- Systemsteuerung-Anschl�sse on German NT, not sure about the
English name)

I know this is off-topic, but if anyone could shed a light onto what NT uses
the serial settings in Control Panel for I would be most grateful...


Back on topic, I created a simple prototype DLL providing open, read and write
functionality. Object Ada compiles this into 400K, which I have been told is
totally unacceptable. I have checked the "remove uncalled code" box, also this
is a Release version with no debugging information.

I was expecting some overhead from the Ada runtime, but 400K is rather a lot.
Most of this is due to a section in the DLL called .av_dbgi, containing
initialized data. What is this and is there any way to reduce its size?

For comparison I tried to create a DLL with Gnat, using dlltool, however the
instructions (building-dlls.txt) only talk about C code. Is it possible to
create DLLs with Gnat? ld fails with missing symbols from the Ada runtime.

Andrew.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    




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

* Re: Win NT + Object Ada: serial port I/O
  1999-02-16  0:00   ` lynch
  1999-02-16  0:00     ` dennison
@ 1999-02-16  0:00     ` David C. Hoos, Sr.
  1999-02-16  0:00       ` dennison
  1999-02-16  0:00     ` dennison
  1999-02-16  0:00     ` Steve Doiel
  3 siblings, 1 reply; 13+ messages in thread
From: David C. Hoos, Sr. @ 1999-02-16  0:00 UTC (permalink / raw)



lynch@cci.de wrote in message <7abh8g$bvh$1@nnrp1.dejanews.com>...
>In article <79cu2a$4iu$1@nnrp1.dejanews.com>,
>  dennison@telepath.com wrote:
>> In article <79952r$2t$1@nnrp1.dejanews.com>,
>>   lynch@cci.de wrote:
>> > Does anyone have any information/experience programming serial ports in
Ada
>on
>> > a Windows platform? I can think of two ways to do this:

On Windows NT, I use Ordinary File IO -- i.e. I open the file "COM2:" (or
whatever),
using  Gnat.Os_Lib.Open_Read_Write to get a file descriptor.

It should be easy to port the Gnat.OS_lib functions needed to compile with
other Ada compilers, for it uses pragma interface to the C library.

To deal with the ports settings, I write a file called _portsu.bat "on the
fly" with parameters supplied by my program.  Here's an example of
_portsu.bat:
@echo off
mode COM2 baud=2400 data=8 parity=N stop=1

I then execute this batch file with a call to the following subprogram:
----------------------------------------------------------------------------
----
with Interfaces.C;
function Execute_Shell_Command (The_Command_String : String)
      return Interfaces.C.Int is
   Rcsid : constant String:=
      "$Id: execute_shell_command.adb,v 1.3 1998/03/30 02:29:50 dave Exp $";
   package C renames Interfaces.C;
   function System (S : C.Char_Array) return C.Int;
   pragma Import (C, System, "system");
begin
   return System (C.To_C (The_Command_String));
end Execute_Shell_Command;
----------------------------------------------------------------------------
----

The call to the subprogram looks like:
The_Command_Status := Execute_Shell_Command ("_portsu > nul");

When doing serial port programming on Unix systems, I use the Florist
bindings to Posix functions for performing these operations, but when I had
to do it for Win NT, I was in a hurry, and needed something I knew how to
do, so I use this "kludge" -- but it works.

One day, I'll figure out how to do it directly.

The mode setting needs to be done before the file is opened.

I hope this helps.

David C. Hoos, Sr.









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

* Re: Win NT + Object Ada: serial port I/O
  1999-02-16  0:00   ` lynch
  1999-02-16  0:00     ` dennison
  1999-02-16  0:00     ` David C. Hoos, Sr.
@ 1999-02-16  0:00     ` dennison
  1999-02-17  0:00       ` Peter Hend�n
  1999-02-16  0:00     ` Steve Doiel
  3 siblings, 1 reply; 13+ messages in thread
From: dennison @ 1999-02-16  0:00 UTC (permalink / raw)


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

In article <7abh8g$bvh$1@nnrp1.dejanews.com>,
  lynch@cci.de wrote:

> Well, the device on the other end is fixed at 9600 8N1. The PC will be
> running Windows NT 4.0 and our software, nothing else. We had naively assumed
> the settings in the Control Panel would be used as defaults, however the
> ports always default to 1200 7E1 no matter we set in the Control Panel. I
> have no idea what Windows uses those settings for... (I am talking about
> Einstellungen- Systemsteuerung-Anschl�sse on German NT, not sure about the
> English name)

I noticed the same behavior in NT 3.51. I'm saddened to see they didn't fix
it.

T.E.D.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    




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

* Re: Win NT + Object Ada: serial port I/O
  1999-02-16  0:00   ` lynch
@ 1999-02-16  0:00     ` dennison
  1999-02-16  0:00     ` David C. Hoos, Sr.
                       ` (2 subsequent siblings)
  3 siblings, 0 replies; 13+ messages in thread
From: dennison @ 1999-02-16  0:00 UTC (permalink / raw)


In article <7abh8g$bvh$1@nnrp1.dejanews.com>,
  lynch@cci.de wrote:
> In article <79cu2a$4iu$1@nnrp1.dejanews.com>,
>   dennison@telepath.com wrote:
> > In article <79952r$2t$1@nnrp1.dejanews.com>,
> > There's a Win32 system call to do this for you. Check your documentation.
>
> Which documentation? As I've mentioned before the "documentation" (ring binder
> and online help files) that comes with Object Ada is more than useless.

Ahh. When I did this I was using the old VADS Ada83 compiler, which required
Visual C++ to be installed. I figured it out from the Visual C++ help files.
Aonix made some sort of deal w/ Microsoft so that you don't need Visual C++. I
guess that deal didn't include licensing Microsoft's help files.

Clearly you are't going to want to be flying blind. So if the Win32
"documentation" you get with Aonix is insufficient, I'd suggest you pick up a
good Win32 programmming reference or two.

T.E.D.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    




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

* Re: Win NT + Object Ada: serial port I/O
  1999-02-16  0:00     ` David C. Hoos, Sr.
@ 1999-02-16  0:00       ` dennison
  0 siblings, 0 replies; 13+ messages in thread
From: dennison @ 1999-02-16  0:00 UTC (permalink / raw)


In article <DDkrrqaW#GA.247@pet.hiwaay.net>,
  "David C. Hoos, Sr." <david.c.hoos.sr@ada95.com> wrote:
>
> lynch@cci.de wrote in message <7abh8g$bvh$1@nnrp1.dejanews.com>...
> >> > Does anyone have any information/experience programming serial ports in
> Ada
> >on
> >> > a Windows platform? I can think of two ways to do this:
>
> On Windows NT, I use Ordinary File IO -- i.e. I open the file "COM2:" (or
> whatever),
> using  Gnat.Os_Lib.Open_Read_Write to get a file descriptor.

That is probably the way to go if your needs are simple. But it's probably not
going to be flexible enough for someone who wants to make use of the Win32
features (eg: buffer timeouts, character timeouts) of serial I/O.

> To deal with the ports settings, I write a file called _portsu.bat "on the
> fly" with parameters supplied by my program.  Here's an example of
> _portsu.bat:
> @echo off
> mode COM2 baud=2400 data=8 parity=N stop=1

Ewww!
:-)

T.E.D.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    




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

* Re: Win NT + Object Ada: serial port I/O
  1999-02-16  0:00     ` dennison
@ 1999-02-17  0:00       ` Peter Hend�n
  0 siblings, 0 replies; 13+ messages in thread
From: Peter Hend�n @ 1999-02-17  0:00 UTC (permalink / raw)


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

The knowledge base article Q112841 (search for it on
http://search.microsoft.com) explains how this is intended
to work (or not:-).

Regards,
Peter

--
Peter Hend�n           http://www.algonet.se/~phenden
ICQ: 14672398
Teknisk Dokumentation AB          http://www.tdab.com
dennison@telepath.com wrote in message <7abvp0$nre$1@nnrp1.dejanews.com>...
>In article <7abh8g$bvh$1@nnrp1.dejanews.com>,
>  lynch@cci.de wrote:
>> Well, the device on the other end is fixed at 9600 8N1. The PC will be
>> running Windows NT 4.0 and our software, nothing else. We had naively
assumed
>> the settings in the Control Panel would be used as defaults, however the
>> ports always default to 1200 7E1 no matter we set in the Control Panel. I
>> have no idea what Windows uses those settings for... (I am talking about
>> Einstellungen- Systemsteuerung-Anschl�sse on German NT, not sure about
the
>> English name)
>I noticed the same behavior in NT 3.51. I'm saddened to see they didn't fix
>it.








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

end of thread, other threads:[~1999-02-17  0:00 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-02-03  0:00 Win NT + Object Ada: serial port I/O lynch
1999-02-03  0:00 ` news.oxy.com
1999-02-04  0:00   ` lynch
1999-02-04  0:00     ` news.oxy.com
1999-02-04  0:00 ` dennison
1999-02-04  0:00   ` Tom Moran
1999-02-16  0:00   ` lynch
1999-02-16  0:00     ` dennison
1999-02-16  0:00     ` David C. Hoos, Sr.
1999-02-16  0:00       ` dennison
1999-02-16  0:00     ` dennison
1999-02-17  0:00       ` Peter Hend�n
1999-02-16  0:00     ` Steve Doiel

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