EasyManua.ls Logo

Curtiss-Wright DuraCOR 311 - GPIO Example Code; Building Example Code

Curtiss-Wright DuraCOR 311
72 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
DuraCOR 311
Apendix B GPIO Configuration
MNL-0667-01 Rev B2
ECO-5941
Effective: 17 Mar 20
Page 45 of 72
GPIO Example Code
#include <stdlib.h>
#include <stdio.h>
#include <mpsse.h>
static const int FTDI_DID = 0x6011;
static const int FTDI_INTERFACE = INTERFACE_C;
int main(int argc, char **argv)
{
struct mpsse_context *ctx;
ctx = Open(0x0403, FTDI_DID, BITBANG, 0, 0, FTDI_INTERFACE, NULL, NULL);
// Set direction of GPIO
SetDirection(ctx, 0x15);
// Write the value (all outputs high in this case)
WritePins(ctx, 0x15);
usleep(100000);
printf("Read %x\n", ReadPins(ctx));
Close(ctx);
return 0;
}
Building Example Code
The above code depends on the following three libraries:
1. libUSB
2. libFTDI
3. libMPSSE
Once each of those are install to your system, but the application with:
gcc –o test test.c -lmpsse

Table of Contents