Peter Smith wrote:
> Hi,
>
> I'm using the Device::FTDI Perl wrapper for libftdi to communicate
> with an FT230X, which in turn is driving 16 cascaded shift registers.
> The communication speed is decent, but I'm hoping for more if
> possible.
>
> Here's my code:
>
> use Device::FTDI;
>
> ## 0x08 CTS - LATCH
> ## 0x01 TX - DATA
> ## 0x02 RX - CLOCK
>
> $dev = Device::FTDI->new('vendor' => 0x0403, 'product' => 0x6015) ||
> print $!;
> $dev->set_bitmode(0xff, 0x01);
>
> for (1...128) {
> $dev->write_data(0x01);
> $dev->write_data(0x03);
> }
>
> $dev->write_data(0x08);
> $dev->write_data(0x00);
Try something like this (untested):
$data = '';
for (1...128) {
$data .= chr(0x01);
$data .= chr(0x03);
}
$data .= chr(0x08);
$data .= chr(0x00);
$dev->write_data($data);
Jim
>
> I appreciate most of you will be using the libftdi C library, but
> Device::FTDI is little more than a wrapper, and hopefully the code
> will make sense to non-Perl programmers.
>
> Anyway, the code works fine but it consistently takes around 250ms to
> run, which means around 1ms per write. That's just about OK for me
> needs, but faster would be better, as it means quarter of a second to
> set every bit on my 128 bit shift register monster.
>
> I'm trying to figure out where the delays are occuring. I've
> experimented with setting the baud rate, latency timer and write chunk
> size, but none of these seemed to have any impact.
>
> I'm running Linux on x86, and the FT chip seems to be using USB 2.
>
> Cheers,
> Peter Smith
>
>
>
>
>
>
> --
> libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
> To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx
--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx
|