I'm trying to read data on a serial communication "COM1", using ADA based on RS 422, as the following.
S_Port : Serial_Port;
Buffer : Ada.Streams.Stream_Element_Array(1..150);
GNAT.Serial_Communications.Open(Port => S_Port,Name => "COM1");
GNAT.Serial_Communications.Set(
Port => S_Port, Parity => Even, Block => False,
TimeOut => 4.0
);
GNAT.Serial_Communications.Read(S_Port,Buffer,Last);
The problem is that although the value of 'Last' changes from 9 to 27, the buffer has much more than 9 or 27 bytes. I thought I can use 'Last' to mark the end of a message, but that is not the case? Also I can't seem to have an unbounded buffer to use the READ function, and must define a certain size?
Thanks in advance.