?
Solved

Paralle port programming, VC++ 6.0, W2K...turning on/off LED's on data out pins D0-D7

Posted on 2006-04-16
19
Medium Priority
?
1,091 Views
Last Modified: 2012-06-21
Hi,
There is alot of info out htere referring to this sort of work, like the famous "Controlling LED's with parallel port article in Codeproject which is years old, and other stuff that is also outdated. Looking around here there are some tidbits of info, but no clear direction for someone like myself who is not an expert. I know about the functions like CreateFile() and DeviceIoControl() , but it'S not obvious for me to know how to use them. Anyone already done small tests with just turning on/off LED's on the port and have some code example? I have theinpout32.dll, but when I try to register it (regsvr32) it tell me it's loaded, but the DLLRegisterServer Entry Point was not found...so the little codeproject example, which looks really like what I need, will not function. Any help out there please? Thanks!
0
Comment
Question by:pigeonbr
  • 11
  • 8
19 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 16465575
>>I have theinpout32.dll, but when I try to register it (regsvr32) it tell me it's loaded, but the
>>DLLRegisterServer Entry Point was not found

It is probably just not a COM DLL, but a regular DLL, so no registration required. See e.g. http://www.logix4u.net/parallelport1.htm ("Parallel port Interfacing Tutorial"), it also refers to using that inpout32.dll on NT and later at http://www.logix4u.net/inpout32.htm
0
 

Author Comment

by:pigeonbr
ID: 16465653
Why doesn't the program work if i don't have to register the .ddl then? Check out this link:
http://www.codeproject.com/csharp/csppleds.asp?msg=792594

Everything would seem to be there that I need, but it won't work....any ideas if it's not because of the .dll? Download the demo project and give it a try...I get a window that opens and the program seems to be looking for a file in c:\c#\LED\off.gif. Any help will greatly be appreciated. :)
0
 
LVL 86

Expert Comment

by:jkr
ID: 16465674
This is a C#(!) managed app, it can only 'talk' to a Win32 DLL via P/Invoke or COM Interop. The DLL (inpout32) is not COM DLL, it only exports two functions ('Inp32()' and 'Out32()'), but no COM functionality that needs to be registered, thus no 'DllRegisterServer()'.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:pigeonbr
ID: 16465683
jkr:
Ok, then..so that's not for me. Can you help with my question by suggesting other options I can try please?
0
 
LVL 86

Expert Comment

by:jkr
ID: 16465730
Err, I thought you wanted to use inpout32.dll? This is not the C# area ;o)
0
 

Author Comment

by:pigeonbr
ID: 16465753
jkr:
No, not necessarily...like i said, I'm no expert...I'm just looking for the easiest way to do this , that's all. I have no preference...just a way out...so, if you have any suggestions, I'm all ears.:) Thanks!
0
 
LVL 86

Accepted Solution

by:
jkr earned 2000 total points
ID: 16465798
I'd go that way, since there aren't too many alternatives. Everythig that MS designed to work with the parallel port on NT et. al. is more addressing the communication with a printer (see e.g. http://support.microsoft.com/kb/138594/EN-US/ - "HOWTO: Send Raw Data to a Printer by Using the Win32 API"). If you want to access the individual pins, the examples at http://www.logix4u.net/parallelport1.htm should be the best solution (not mwntioning other similar approaches like 'direcnt.sys')
0
 

Author Comment

by:pigeonbr
ID: 16465847
Thanks jkr,...I will accept this and take time a little later to check it out...looks very interesting....if need be I will be back :) Thanks for your time!
Bruce
0
 

Author Comment

by:pigeonbr
ID: 16465974
Hi jkr...I'm Back :)

Just tried the sample program, and made sure my inpout32.dll. was right one, and located in WINNT\system32 folder...but I still get errors when I run the commande line ex: partest1 write 888 255, which should light up my 8 LED's. The program give me an app error windoe with an address. Any ideas?
0
 
LVL 86

Expert Comment

by:jkr
ID: 16465988
Are you running it under an admin account? That's necessary so the driver can be loaded.
0
 
LVL 86

Expert Comment

by:jkr
ID: 16466006
Oh, the driver is called 'hwinterface.sys' and comes with http://www.logix4u.net/inpout32_source_and_bins.zip
0
 

Author Comment

by:pigeonbr
ID: 16466293
Yes, I am running under administrator.

I'm trying the code out on another HD i have running W98, and more seems to be working....the LED's are illuminating opposite to what I would think...when I write 888 255, all leds go off, and the first 3 LED's (1,2,4) dont ever light up. Still working on it...when I get it working right in Win98, maybe easier to migrate to W2k.
0
 

Author Comment

by:pigeonbr
ID: 16466297
About the driver 'hwinterface.sys' ,....where do I put i? In the system32 directory?
0
 

Author Comment

by:pigeonbr
ID: 16466350
Maybe my parallel connector is defective, as my D0-D3 lights never go on....but the HEX output for the LED's which is normally 1,2,4,8,16, etc for D0,D1,D2,D3,D4,etc respectively is not in order. I'm scratching my head now :)
0
 

Author Comment

by:pigeonbr
ID: 16466508
I got my wiring staightened out :)...haha...they are all ok now...had my DB 25 soldered backwards...still won't work in w2k...let me know abour the hwinterface.sys file...what do I do with it? Thanks.
0
 

Author Comment

by:pigeonbr
ID: 16466536
All woorks fine now in W98. I can work each bit ....let me know....I will keep trying in W2k. Thanks
0
 
LVL 86

Expert Comment

by:jkr
ID: 16466729
Sorry for the delay, I've been out for a while. Yes, the driver should be put in 'system32' also - that's the component that makes it possible to directly acces I/O ports in the 1st place.
0
 

Author Comment

by:pigeonbr
ID: 16468461
jkr;
Ok...So my console app works now in W2K....thanks to your guidance and a few tests here. Now its to get the thing to work from a VC++ app and not from console application. Thanks for the help...you saved my many days of frustration! I appreciate it! I am now pointed in the right direction!
bruce
Quebec, Canada
0
 
LVL 86

Expert Comment

by:jkr
ID: 16470310
You're most welcome ;o)
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question