Kann jemand helfen

Wir benutzen IO-Warrior40 V1.0.0.3 und möchten schreiben und danach lesen den Zustand des Pins (Ausgänge).Aber es kommt Fehler.
Danke im Voraus und hofe mich, dass jemand kann etwas wissen.
Tschuss!
//
// ioblink.cpp - Blinking LEDs sample
//
#include "stdafx.h"
#include "time.h"
#include "iowkit.h"
// Write simple value
BOOLEAN WriteSimple(IOWKIT_HANDLE devHandle, DWORD value)
{
IOWKIT_REPORT rep;
// Init report
rep.ReportID = 0;
rep.Value = 0xFFFFFFFF;
switch (IowKitGetProductId(devHandle))
{
// Write simple value to IOW40
case IOWKIT_PRODUCT_ID_IOW40:
rep.Bytes[3] = (UCHAR) value;
return IowKitWrite(devHandle, IOW_PIPE_IO_PINS,
(PCHAR) &rep, IOWKIT40_IO_REPORT_SIZE) == IOWKIT40_IO_REPORT_SIZE;
// Write simple value to IOW24
case IOWKIT_PRODUCT_ID_IOW24:
rep.Bytes[0] = (UCHAR) value;
return IowKitWrite(devHandle, IOW_PIPE_IO_PINS,
(PCHAR) &rep, IOWKIT24_IO_REPORT_SIZE) == IOWKIT24_IO_REPORT_SIZE;
default:
return FALSE;
}
}
int main(int argc, char* argv[])
{
IOWKIT_HANDLE iows[IOWKIT_MAX_DEVICES];
int i;
DWORD bits;
int numIows;
IOWKIT_REPORT rep;
WCHAR sn[9];
BOOLEAN rc;
DWORD pid;
IOWKIT_HANDLE devHandle;
// Open device
devHandle = IowKitOpenDevice();
if (devHandle == NULL)
{
printf("Failed to open device\n");
goto out;
}
// Get number of IOWs in system
numIows = IowKitGetNumDevs();
printf("%d IOWs in system\n", numIows);
// Get all IOW handles
for (i = 0; i < numIows; i++)
{
// Get device handle and init object
iows = IowKitGetDeviceHandle(i + 1);
// Get serial number
IowKitGetSerialNumber(iows, sn);
pid = IowKitGetProductId(iows);
printf("%d PID %x, S/N \"%ws\"\n", i + 1, pid, sn);
}
// Init report
// Report ID 0 is for writing to 32 input/output pins
printf("set LEDs...\n");
//Set IowKitSetTimeout
rc=IowKitSetTimeout(iows[0],1000);
if (!rc) printf("Cannot set Timeout, err %d\n", GetLastError());
//Set IowKitSetWriteTimeout
rc=IowKitSetWriteTimeout(iows[0],1000);
if (!rc) printf("Cannot set WriteTimeout, err %d\n", GetLastError());
// Set LEDs
rep.ReportID = 0;
rep.Value=0xffffffff;
rc=IowKitWrite(iows[0],0,(PCHAR) &rep,5);
if (!rc) printf("IowKitWrite failed, err %d\n", GetLastError());
rc=IowKitReadImmediate(iows[0], &bits);
if (!rc) printf("IowKitReadImmediate failed, err %d\n", GetLastError());
printf("Read: %x\n",bits);
rc=IowKitReadImmediate(iows[0], &bits);
if (!rc) printf("IowKitReadImmediate failed, err %d\n", GetLastError());
printf("Read: %x\n",bits);
// Write to simple endpoint
// rc = WriteSimple(iows[0], bits);
// Check for error
// if (!rc) printf("Cannot writesimple, err %d\n", GetLastError());
printf("Blinking complete\n");
// Set LEDs off
for (i = 0; i < numIows; i++)
{
// Write to simple endpoint
// WriteSimple(iows, 0xFFFFFFFF);
// WriteSimple(iows, 0xFFFFFFFF);
}
// Read immediate
rc = IowKitReadImmediate(iows[0], &bits);
printf("ReadImm(): rc %d bits %x\n", rc, bits);
// Close device
IowKitCloseDevice(devHandle);
out:
return 0;
}