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
* */
#include <stdio.h>
#include <stdlib.h>
#include "./ftd2xx.h"
int main(int argc, char *argv[])
{
FT_STATUS ftStatus;
FT_HANDLE ftHandle0;
int parametr;
LPVOID pkod;
DWORD nBufferSize = 0x0001;
DWORD dwBytesWritten;
if(argc > 1) {
sscanf(argv[1], "%d", ¶metr);
}
else {
parametr = 0;
}
FT_SetVIDPID(0x5555,0x0001); // id z lsusb
FT_Open(0,&ftHandle0);
FT_SetBitMode(ftHandle0,15,1);
pkod=¶metr;
ftStatus = FT_Write(ftHandle0,pkod,nBufferSize,&dwBytesWritten);
ftStatus = FT_Close(ftHandle0);
}
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 ?
--
View this message in context:
http://libftdi.141977.n3.nabble.com/Read-status-of-FT245RL-pins-tp4026106.html
Sent from the libFTDI mailing list archive at Nabble.com.
--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx
|