Installing

  1. Extract all the files (not just this documentation) to C:\Program Files\ACCES\104-DIO-24S\, or to some other known dir. The resulting files should be: C:\Program Files\ACCES\104-DIO-24S\Doc.html C:\Program Files\ACCES\104-DIO-24S\DIO247.dll C:\Program Files\ACCES\104-DIO-24S\DIO247\DIO247.inf C:\Program Files\ACCES\104-DIO-24S\DIO247\DIO247.cat C:\Program Files\ACCES\104-DIO-24S\DIO247\Drivers\NT32\DIO247.sys C:\Program Files\ACCES\104-DIO-24S\DIO247\Drivers\NT64\DIO247.sys C:\Program Files\ACCES\104-DIO-24S\Headers\DIO247.pas C:\Program Files\ACCES\104-DIO-24S\Headers\DIO247.h C:\Program Files\ACCES\104-DIO-24S\C Libraries\VCDIO247.lib
  2. Move DIO247.dll to a suitable dir. Normally this will be the 32-bit system dir, but you may want to instead move it to the same dir as your executable. You should only have one copy of DIO247.dll, to avoid future revision issues.
  3. In Device Manager, install the device by right-clicking on the outermost category, and picking "add Legacy hardware". Pick the "select from a list" option, leave "Show All Devices" selected, and click Have Disk. Point the wizard at C:\Program Files\ACCES\104-DIO-24S\DIO247\DIO247.inf (or equivalent), select "ACCES 104-DIO-24S", and follow the wizard from there to install the device. If it asks whether you want to restart, click No.
  4. Once the device is in Device Manager (in the Data Acquisition category), right-click on it and pick Properties. On the Resources tab, uncheck "Use Automatic Settings", and change the I/O range and IRQ as follows:
    I/O Range320-33F
    IRQ7
  5. If it asks whether you're sure about changing these things, click Yes. If it asks whether you want to restart in the middle of this process, click No. After all changes have been made, you may need to restart.

Client API

DIO247.dll provides this API; it can be placed in C:\Windows\System32\, or in the same dir as the executable.

Headers are provided for C/C++ and Delphi (Object Pascal). C/C++ also requires a library file; one is provided for Microsoft Visual C/C++. Because the names match, it's possible to start with an ACCES32-based sample, and just remove VCACCES.lib and add VCDIO247.lib.

GetNumCards()

function GetNumCards: LongWord; cdecl; external 'DIO247.dll'; __declspec(dllimport) unsigned long GetNumCards(void);

GetNumCards() returns the number of cards installed using DIO247. The first card always has a card number of 0, the next (if any) is 1, etc. Thus if GetNumCards() returns 3, then the cards are numbered 0, 1, and 2.

QueryCardID()

function QueryCardID(CardNum: LongWord; pID: PLongWord): LongWord; cdecl; external 'DIO247.dll'; __declspec(dllimport) unsigned long QueryCardID(unsigned long CardNum, unsigned long *pDeviceID);

QueryCardID() fetches the virtual device ID of a card. The 104-DIO-24S's virtual device ID is 0x10E50. It returns a Windows error code, which will be ERROR_SUCCESS on success.

QueryCardBase()

function QueryCardBase(CardNum: LongWord; pBase: PLongWord): LongWord; cdecl; external 'DIO247.dll'; __declspec(dllimport) unsigned long QueryCardBase(unsigned long CardNum, unsigned long *pBase);

QueryCardBase() fetches the base address of a card. This can be used for non-Rel port I/O. It returns a Windows error code, which will be ERROR_SUCCESS on success.

WaitForIRQ()

function WaitForIRQ(CardNum: LongWord): LongWord; cdecl; external 'DIO247.dll'; __declspec(dllimport) unsigned long WaitForIRQ(unsigned long CardNum);

WaitForIRQ() performs a wait, which will return when the card generates an IRQ. In normal use, spawn a worker thread which calls this function. It returns a Windows error code, which will be ERROR_SUCCESS on success.

An IOCTL with no .DLL wrapper can be called to cancel a pending wait. Contact the factory for details.

WaitForIRQData()

function WaitForIRQData(CardNum: LongWord; DataBytes: LongInt; pData: Pointer): LongWord; cdecl; external 'DIO247.dll'; __declspec(dllimport) unsigned long WaitForIRQData(unsigned long CardNum, signed long DataBytes, void *pData);

WaitForIRQData() performs a wait like WaitForIRQ(); if the wait completes successfully, it fills in the data buffer with bytes read from the card. For the 104-DIO-24S, this is normally 3 bytes, for ports A, B, and C.

Port I/O Functions

InPortB, InPort, InPortL, OutPortB, OutPort, and OutPortL function like their ACCES32 counterparts.

RelInPortB, RelInPort, RelInPortL, RelOutPortB, RelOutPort, and RelOutPortL, are similar, but use a relative offset instead of an absolute address.

For example, if card number 0 has a base address of 0x320, RelOutPortB(0, 1, 0xF0) is equivalent to OutPortB(0x321, 0xF0).

FunctionUse
RelInPortBRead a byte from a relative offset
RelInPortRead a word (2 bytes) from a relative offset
RelInPortLRead a double-word (4 bytes) from a relative offset
RelOutPortBWrite a byte to a relative offset
RelOutPortWrite a word (2 bytes) to a relative offset
RelOutPortLWrite a double-word (4 bytes) to a relative offset

InPortBRead a byte from an absolute address
InPortRead a word (2 bytes) from an absolute address
InPortLRead a double-word (4 bytes) from an absolute address
OutPortBWrite a byte to an absolute address
OutPortWrite a word (2 bytes) to an absolute address
OutPortLWrite a double-word (4 bytes) to an absolute address