Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Forums > General Electronics Chat


General Electronics Chat This forum is for general chat about electronics, eg: Dont know what a part does? Dont know how to read a circuit? Want to get an opinion?

Reply
 
LinkBack Thread Tools Display Modes
Old 14th September 2005, 04:45 PM   (permalink)
Default inpout.dll and Visual C++

hi, just got a problem that's buggin' me for a while now. I'm trying to access the parallel port and downloaded the inpout32.dll and tried to access the ports after I placed the inpout32.dll in C:\windows\system, but there is still a problem and an error occurs, the exact link of the code i'm trying to do is this

http://www.logix4u.net/parallelport1.htm
gastonanthony is offline  
Old 14th September 2005, 06:21 PM   (permalink)
Default Re: inpout.dll and Visual C++

Quote:
Originally Posted by gastonanthony
hi, just got a problem that's buggin' me for a while now. I'm trying to access the parallel port and downloaded the inpout32.dll and tried to access the ports after I placed the inpout32.dll in C:\windows\system, but there is still a problem and an error occurs, the exact link of the code i'm trying to do is this
Can't help you on that DLL, but if you download the driver DLL that I use with WinPicProg it comes with examples in C.

BTW, did you install the program?, the one I use requires installing.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline  
Old 14th September 2005, 06:26 PM   (permalink)
Default Re: inpout.dll and Visual C++

Quote:
Originally Posted by gastonanthony
I'm trying to access the parallel port and downloaded the inpout32.dll and tried to access the ports after I placed the inpout32.dll in C:\windows\system, but there is still a problem and an error occurs
What's the error you get?
__________________
Time is nature\'s way of keeping everything from happening at once.
http://membres.lycos.fr/jrainville/
Joel Rainville is offline  
Old 15th September 2005, 01:56 AM   (permalink)
Default Re: inpout.dll and Visual C++

Quote:
Originally Posted by gastonanthony
hi, just got a problem that's buggin' me for a while now. I'm trying to access the parallel port and downloaded the inpout32.dll and tried to access the ports after I placed the inpout32.dll in C:\windows\system, but there is still a problem and an error occurs, the exact link of the code i'm trying to do is this

http://www.logix4u.net/parallelport1.htm
Try putting it in either c:\windows or c:\windows\system32 instead. we normally dun put driver in C:\windows\system. If problem still persist, try putting that driver in the same directory where you run your program.
__________________
InfinityCreation - Where creations goes to infinity!
ym2k is offline  
Old 15th September 2005, 02:23 AM   (permalink)
Default

the instructions only told me to put the inpout32.dll in the C:\windows\system folder, it doesn't need to be installed (i think), it is located here [url]http://www.logix4u.net
I already put the inpout32.dll in C:\ (the same directory as the exe file, and C:\windows\system, and C:\windows\system32, but doesn't work,
A window appeared an asked me to send an error report to microsoft, I attached the details of the error
Attached Images
File Type: gif xperror.gif (20.7 KB, 911 views)
gastonanthony is offline  
Old 15th September 2005, 02:29 AM   (permalink)
Default

I'm trying to do camera that follows a moving object (it must be pc based), so i'll need to experiment on the parallel port, after the program sees where the object is going, the motor beneath the camera must rotate in order for the camera to catch up.
Nigel, can the driver you mentioned be used in this project?
gastonanthony is offline  
Old 15th September 2005, 03:50 AM   (permalink)
Default

Quote:
Originally Posted by gastonanthony
the instructions only told me to put the inpout32.dll in the C:\windows\system folder, it doesn't need to be installed (i think), it is located here [url]http://www.logix4u.net
I already put the inpout32.dll in C:\ (the same directory as the exe file, and C:\windows\system, and C:\windows\system32, but doesn't work,
A window appeared an asked me to send an error report to microsoft, I attached the details of the error
Did you try C:\windows\ ? Or could it be your programming error? I had use that driver before with VB6 running under XP sp2 envioriment. The results are great i must say. To narrow down the problem, i suggest you run the existing example provide in the archieve with your system. If it runs without error, most prob your error come from programming.
__________________
InfinityCreation - Where creations goes to infinity!
ym2k is offline  
Old 15th September 2005, 05:48 AM   (permalink)
Default

i've already tried it with visual basic and it went fine, got it running in VB6 a few months ago. but my project needs to be done in visual C++ right now because the image processing will be done in C++, and I would like to have a uniform language in my project so as not to have problems with the delay in processing instructions, etc...I chose C++ for the speed of image processing. The problem is, I have no experience in using inpout32.dll for visual C++.
gastonanthony is offline  
Old 15th September 2005, 07:01 AM   (permalink)
Default

Quote:
Originally Posted by gastonanthony
i've already tried it with visual basic and it went fine, got it running in VB6 a few months ago. but my project needs to be done in visual C++ right now because the image processing will be done in C++, and I would like to have a uniform language in my project so as not to have problems with the delay in processing instructions, etc...I chose C++ for the speed of image processing. The problem is, I have no experience in using inpout32.dll for visual C++.
Well, i just went and download the package again. It include a VC6++ source code inside. I compile it and run. It went fine without any crash. Here is the source

Code:
// InpoutTest.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "stdio.h"
#include "string.h"
#include "stdlib.h"
/* ----Prototypes of Inp and Outp--- */

short _stdcall Inp32(short PortAddress);
void _stdcall Out32(short PortAddress, short data);

/*--------------------------------*/

int main(int argc, char* argv[])
{

	int data;

	if(argc<3)
	{
		//too few command line arguments, show usage
		printf("Error : too few arguments\n\n***** Usage *****\n\nInpoutTest read <ADDRESS> \nor \nInpoutTest write <ADDRESS> <DATA>\n\n\n\n\n");
	} 
	else if(!strcmp(argv[1],"read"))
	{

		data = Inp32(atoi(argv[2]));

		printf("Data read from address %s is %d \n\n\n\n",argv[2],data);
	
	}
	else if(!strcmp(argv[1],"write"))
	{
		if(argc<4)
		{
			printf("Error in arguments supplied");
			printf("\n***** Usage *****\n\nInpoutTest read <ADDRESS> \nor \nInpoutTest write <ADDRESS> <DATA>\n\n\n\n\n");
		}
		else
		{
		Out32(atoi(argv[2]),atoi(argv[3]));
		printf("data written to %s\n\n\n",argv[2]);
		}
	}



	return 0;
}
Remember to include stdafx.h & stdafx.cpp in your project. I believe wat u need is only 2 function, "Inp32()" & "Out32()". Run the example again. If you can run VB6 example fine, i see no reason why you cannot do the same for VC6++
__________________
InfinityCreation - Where creations goes to infinity!
ym2k is offline  
Old 15th September 2005, 07:29 PM   (permalink)
Default

you need to inport the dll to the project! and the lib file.
__________________
when you post that reply, im just kidding.
danielsmusic is offline  
Old 15th September 2005, 08:31 PM   (permalink)
Default

what operating system are you using? I'm using windows XP and I had a problem talking to my parallel port because there was something in the O.S. that blocked me from accessing it.

I dunno if this is your problem or not, but I thought I'd throw it out there.

....edit: Nevermind, just scrolled through your link there and saw that the problem was fixed inside that DLL file.
__________________
Jeff
To the optimist, the glass is half full.
To the pessimist, the glass is half empty.
To the engineer, the glass is twice as big as it needs to be.
jrz126 is offline  
Old 16th September 2005, 02:46 PM   (permalink)
Default

I still don't understand, may someone please tell me what a dll does and what inpout32.dll does?I really have no clue yet
gastonanthony is offline  
Old 16th September 2005, 02:59 PM   (permalink)
Default

a DLL is the windows equivelent of a .so file for Linux

basically a shared libary of functions
say you write a program and in that program you want to have a dialog box for choosing a file you can do two things

1) write one from scratch yourself
2) use the one provided by your operating system/Desktop manager

number 2 is perfered since it simplifies your code by re-using someone elses code/function


So you want to write a program that accesses the parallel port (linux this would be very easy btw).
So you can do two things

1) write a low-level access to the BIOS to access and enumerate the parallel port
2) take advantage of someone elses hardwork and use their functions

now this inpout32.dll will do this, it provides the nessacary fucntions to use the parallel port easily.
To use it you need a header file (probably call inpout32.h) and do a #include at the start of your code

This will give your code access to the functions contained within the DLL.

Shared libaries aid in keeping things simple, why bother re-inventing/re-coding something that someone else has done


I am a python programmer and the equiv is the import declaration to load in the ability to use functions that other ppl have written
__________________
Nothing is impossible.
Once a problem is realised, the rest is just details


Styx is offline  
Old 16th September 2005, 03:26 PM   (permalink)
Default

Quote:
Originally Posted by Styx

1) write a low-level access to the BIOS to access and enumerate the parallel port
This isn't quite true, you can't use low level access to ports under Win32 (NT and above), the OS prevents you doing it. What the port drivers do is allow you to access the ports in a 'legal' way by using a Windows driver.

If you want to see more about it, have a look at http://www.logix4u.net/inpout_theory.htm for details, including a link to the source code.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline  
Old 16th September 2005, 04:06 PM   (permalink)
Default

Quote:
Originally Posted by Nigel Goodwin
Quote:
Originally Posted by Styx

1) write a low-level access to the BIOS to access and enumerate the parallel port
This isn't quite true, you can't use low level access to ports under Win32 (NT and above), the OS prevents you doing it. What the port drivers do is allow you to access the ports in a 'legal' way by using a Windows driver.

If you want to see more about it, have a look at http://www.logix4u.net/inpout_theory.htm for details, including a link to the source code.
Fair enough I am a linux-head and it is easy really, we access the kernel-driver to enable full kernel control of a port, or just access the /dev/ps0 for direct access.

Been a while since coding for windows and low-level (windows 3.1)

So sounds like you need to have kernel-access to code one yourself (very hard from what I have heard with the NT kernel) so use the code someone else has done
__________________
Nothing is impossible.
Once a problem is realised, the rest is just details


Styx is offline  
Reply

Bookmarks

Thread Tools
Display Modes





All times are GMT. The time now is 06:30 AM.


Electronic Circuits  |  Learning Electronics
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.

eXTReMe Tracker