Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Functions for USB in C#

Status
Not open for further replies.

robokid

Junior Member level 1
Junior Member level 1
Joined
Oct 8, 2006
Messages
18
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,429
It is easy with lpt and C++ to access port
by using some functions and DLL lib
So if we use USB and C# and xp windows
Is there like thos functions?
 

Functions for USB

sure There are atr least with C++
 

Re: Functions for USB

Hi,
For example I use a Dll for parallelport access and this is needed for/in VC++ : (part of the code to get the idea)
Code:
// in Par.h Header:
typedef void (WINAPI *PORTOUT) (short int Port, char Data);
typedef char (WINAPI *PORTIN) (short int Port);
typedef short int (WINAPI *ISDRIVERINSTALLED)();
extern PORTOUT PortOut;
extern PORTIN PortIn;
extern ISDRIVERINSTALLED IsDriverInstalled;
// for loading dll
extern int LoadIODLL();

// in Par.cpp:
PORTOUT PortOut;
PORTIN PortIn;
ISDRIVERINSTALLED IsDriverInstalled;
HMODULE hio;
int LoadIODLL()
{
	hio = LoadLibrary("CS");         // loads CS.dll
	if (hio == NULL) return 1;
        PortOut = (PORTOUT)GetProcAddress(hio, "PortOut");
        PortIn = (PORTIN)GetProcAddress(hio, "PortIn");
        IsDriverInstalled = (ISDRIVERINSTALLED)GetProcAddress(hio, "IsDriverInstalled");
        atexit(FreeLibrary(hio));
}

Your USB dll can be accessed in a likewise way.

(If you want, I can mail you the total working example.)

Hope this helps,
Jeroen
 

Functions for USB

HI JB, CAN YOU UPLOAD THE USB DLL OR YOU CAN EMAIL TO ME?
 

Functions for USB

your certainly will find this web very useful:
http://www.lvr.com/
there, you can find every thing about computer ports (USB, parallel, Serial) including books and codes
His books was free as i remember, if you could not find it let me know to upload it here.
I should emphesize that using USB is not as easy as parallel or serial port. you need an IC for interefece. search on USB ICs as well.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top