libftdi Archives

Subject: Re: Read status of FT245RL pins

From: Jim Paris <jim@xxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Sun, 4 Sep 2016 00:13:44 -0400
mackowiakp wrote:
> Sorry for my ignorance but I am very new in FTDI chip software development.
> I have module based on FT245RL chip, programmed to be 4 port output (relays)
> and 4 port opto isolated input unit.
> I found out in Internet program in C to turn on/off relays connected to
> outputs D0 to D3. After compiling it works properly. Below draft of this
> working program:
> 
>     /* switch4.c
>      * # gcc -o switch4 switch4.c -L. -lftd2xx -Wl,-rpath,/usr/local/lib
>      * Usage
>      * # switch4 [0-15], for example # switch4 1
>      * */
...
> My question is. How can I read status of D4 to D7 pins, programmed as
> inputs? I mean about "printf" to stdout the number representing status (zero
> or one) of input pins (or all input/output pins).
> Can anybody help newbie ? 

That code is using the proprietary D2XX driver, not the open-source
libftdi drivers that this mailing list discusses.  Maybe look for
documentation from your vendor.

For libftdi, a "ftdi_read_data" should do the trick, or
"ftdi_read_pins" is probably even simpler:
  
https://www.intra2net.com/en/developer/libftdi/documentation/group__libftdi.html#gab823dd90f2359612b1546ef0ceebdc0e

Jim

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx   

Current Thread