Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

FT232RL, FT_Read, reading buffer broken

I would like information about  reading of the FT232RL buffer, I'm having some problems, when I read the buffer it is broken.

Like this

Ex:

 

’01 02 03 04 05 06 07 08’

‘09 0A 0B 0C 0D 0E 0F’

 

I need to read two times to get the whole frame, when the read should come like this:

 

’01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F’

 

When  I have to read the buffer two times, I don’t no why, I can’t  join those frames..

 

Seems like the buffer is not getting the entire data. In some tests i could get the entire data but takes over 500ms,

 

I using the Delphi XE to develop my software and I set the USB device like this:

 

____________________________________________________________________

 

procedure ConectUSB;         

var

  i: Integer;

begin

  i := Open_USB_Device;         

  if (i = 0) or (i = 1 ) then   

  begin

    Set_USB_Device_TimeOuts(20, 20);

    Clr_USB_Device_RTS;

    Get_USB_Device_QueueStatus;

    Set_USB_Device_LatencyTimer(1);

    FT_Current_Baud := 92000;

    Set_USB_Device_BaudRate;

    Set_USB_Device_RTS;

  end;

end;

 

____________________________________________________________________

 

And my reading procedure is like this:

 

____________________________________________________________________

 

 

function Tfrm1.Rx3(bytes : Integer) : string;          //when “bytes” receives the number of bytes that I need 

var

  i, cont : integer;

  resp: string;

 

begin

  frm1.vresp := '';

  resp := '';

  cont := 0;

 

  while cont < bytes do

  begin

    cont := cont + Read_USB_Device_Buffer(bytes);

  end;

 

  for i := 0 to bytes - 1 do

  begin

    Get_USB_Device_QueueStatus;

    resp := resp + Chr(FT_In_Buffer[i]);

  end;

 

  if resp <> '' then 

        Result := AsciiToHex(resp); 

end;

 

____________________________________________________________________

 

 

thaks for the help

0 Kudos
Message 1 of 3
(2,822 Views)

The FT232RL is not NI Digital hardware, not any type of NI hardware. Delphi is no an NI product either. Have you tried a Delphi or FTDI forum?

0 Kudos
Message 2 of 3
(2,809 Views)

sorry, unfortunately i've been looking out a answer to my problem

 

and I just make this post because i've seen many posts on this forum talking about FTDI

 

and i think if could someone help me with this...

 

so i'm sorry if the problem that I have with this FTDI do not fit with this forum

 

=/

0 Kudos
Message 3 of 3
(2,800 Views)