All Forums
 Microsoft Windows CE
 CE Sample Applications and Utilities
 eVC - SampleDIO.exe
 Forum Locked  Topic Locked
 Send Topic to a Friend
 Printer Friendly
Author Topic  

ctacke

877 Posts

Posted - 21 Jan 2005 :  09:15:22  Show Profile  Email Poster
SampleDIO.exe



Update
We recommend using the graphical C# version of this app, which is posted at topic 2164. The C# app is easier to use and includes features not found in this app.


This sample command line application demonstrates basic use of the Digital I/O (DIO) driver. It can also be used to interactively control the DIO lines for test purposes.

The application presents the user with a console menu of DIO operations (read, write, get and set direction and mask) to execute, as well as a simple bit walking test.

Key APIs Used


CreateFile
ReadFile
WriteFile
DeviceIoControl

Lines of Code: ~350

Source Downloads
Rev 2 - 4/13/2005 (11k zip).
Rev 1 - 1/17/2005 (10k zip)


Edited by ctacke 13-Apr-2005: Added rev 2 download
Edited by akidder 19-Jul-2006: Added link to graphical version of this app

ctacke

877 Posts

Posted - 13 Apr 2005 :  13:52:52  Show Profile  Email Poster
Rev 2 Update

We've updated the sample to include interrupts. The sample will attached to the first available and supported interrupt for the device and outputs text to the console on either rising or falling edge interrupts.
Go to Top of Page

ctacke

877 Posts

Posted - 12 Dec 2006 :  17:03:06  Show Profile  Email Poster
You can make this code a little bit more friendly by updating the header file to prevent name mangling and add a couple method definitions:


#ifndef _DIO_H
#define _DIO_H


#ifdef __cplusplus
extern "C"
{
#endif

BOOL GetMask(HANDLE hDioPort, DWORD *pdwMask);
BOOL SetMask(HANDLE hDioPort, DWORD dwMask);
BOOL ReadDio(HANDLE hDioPort, DWORD *pdwDio);
BOOL WriteDio(HANDLE hDioPort, DWORD dwDio);
BOOL SetDirection(HANDLE hDioPort, DWORD dwDir);
BOOL GetDirection(HANDLE hDioPort, DWORD *pdwDir);
DWORD GetUserDword(const char *szStr);
HANDLE OpenDIO();
BOOL CloseDIO(HANDLE hDioPort);

#ifdef __cplusplus
}
#endif
#endif // _DIO_H


And then add these to the implementation file:

HANDLE OpenDIO()
{
return CreateFile(_T("DIO1:"), GENERIC_WRITE | GENERIC_READ,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, OPEN_EXISTING, 0, NULL);
}

BOOL CloseDIO(HANDLE hDioPort)
{
return CloseHandle(hDioPort);
}

Go to Top of Page
  Topic  
 Forum Locked  Topic Locked
 Send Topic to a Friend
 Printer Friendly
Jump To:
Eurotech Support Forums © Eurotech Inc. Go To Top Of Page
This page was generated in 0.03 seconds. Snitz Forums 2000