From: Rolf <rolf.ebert_nospam_@gmx.net>
Subject: gnat serial communication
Date: Fri, 6 Jan 2012 05:30:32 -0800 (PST)
Date: 2012-01-06T05:30:32-08:00 [thread overview]
Message-ID: <061b218b-3849-447b-b54b-246223cbd028@ck5g2000vbb.googlegroups.com> (raw)
I am having a hard time getting back to programming with GNAT
I installed GNAT GPL 2011 on a windows XP SP3 computer together with
GTK-Ada.
The current task is to simply display the incoming data from a serial
line to the console. The following program always fails displaying the
message:
raised GNAT.SERIAL_COMMUNICATIONS.SERIAL_ERROR : set: cannot get comm
state ( 6)
with GNAT.Serial_Communications; use GNAT.Serial_Communications;
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Streams; use Ada.Streams;
procedure Read_Ser is
P_Voltage : Serial_Port;
Voltage_Buffer : Stream_Element_Array(1..11);
Voltage_Last : Stream_Element_Offset;
begin
Open (P_Voltage, Name (11));
Set (P_Voltage, Rate => B19200);
end Read_Ser;
The corresponding code in GNAT.Serial_Communications is
Success := GetCommState (HANDLE (Port.H.all),
Com_Settings'Access);
if Success = Win32.FALSE then
Success := CloseHandle (HANDLE (Port.H.all));
Port.H.all := 0;
Raise_Error ("set: cannot get comm state");
end if;
Other terminal programs (HTerm, Bry_Terminal, etc.) connect to the
port without problem can display the incoming data. Does anybody know
what might be problem here?
Rolf
reply other threads:[~2012-01-06 13:30 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox