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.

Parallel port interfacing

Status
Not open for further replies.

mahaju

Full Member level 2
Joined
Mar 17, 2007
Messages
125
Helped
7
Reputation
14
Reaction score
2
Trophy points
1,298
Activity points
2,252
vb input32.dall

Hi

I need to interface 89s51 uController with the computer using the parallel port for my project. I need 8 bit half duplex communication, both into and out of the PC using the data pins of the parallel port.

Could anyone please direct me to the circuit and the source code for achieving this, preferrably written in Visual C++?

Also I need to do this on a machine with Windows XP, so the trditional inportb() and outportb() functions of C will not do.

Thanks in advance.

:)
 

hwinterface driver

matlab can provide you with an easy way thru which u can send and receive data,,,,moreover it also allows you to manipulate data,,, it is simple also use the instructions parport and putdata
 

visual basic parallel port interfacing

u can't normally use inportb() or outportb() because windows xp do not directly acess port it uses kennel mode i can't do it by C or C++ but if
u use visual basic then i can help u

Added after 6 minutes:

it can be done by inpout32.dall file in visual basic

how Inpout32.dll works ?

Tried the Inpout32.dll..? then Learn how Inpout32.dll does the things. This brief tutorial explains about the working of Inpout32.dll in simple steps, with the help of a flow chart. This could help you much if you want to modify the Inpout32 dll source code

If you don't know what is Inpout32.dll, please read it here and then continue.

How it works

The outstanding feature of Inpout32.dll is , it can work with all the windows versions without any modification in user code or the DLL itself. This tutorial describes how it is achieved, what programming methods used, what are the APIs used, etc.... The Dll will check the operating system version when functions are called, and if the operating system is WIN9X, the DLL will use _inp() and _outp functions for reading/writing the parallel port. On the other hand, if the operating system is WIN NT, 2000 or XP, it will install a kernel mode driver and talk to parallel port through that driver. The user code will not be aware of the OS version on which it is running. This DLL can be used in WIN NT clone operating systems as if it is WIN9X. The flow chart of the program is given below.


The two important building blocks of this program are

1) A kernel mode device driver embedded in the DLL in binary form

2) The DLL itself

Kernel mode driver Hwinterface.sys

The source code of Hwinterface.sys kernel mode driver is located in "kernel_mode_driver_source" directory. Where "hwinterfacedrv.c" is the main application source file. Three functions implemented in the driver are

1) DriverEntry() , Called when driver is loaded. Creates device object and symbolic links.

2) hwinterfaceUnload(), Called when driver is unloaded, performs clean up

3) hwinterfaceDeviceControl(), handles calls made through DeviceIOControl API. Performs reading writing to the parallel port according to the control code passed.

The DLL Inpout32

The functions in the DLL are implemented in two source files, "inpout32drv.cpp" and "osversion.cpp". osversion.cpp checks the version of operating system. "inpout32drv.cpp" does installing the kernel mode driver, loading it , writing/ reading parallel port etc... The two functions exported from inpout32.dll are

1) Inp32(), reads data from a specified parallel port register.

2) Out32(), writes data to specified parallel port register.

the other functions implemented in Inpout32.dll are

1) DllMain(), called when dll is loaded or unloaded. When the dll is loaded , it checks the OS version and loads hwinterface.sys if needed.

2) Closedriver(), close the opened driver handle. called before unloading the driver.

3) Opendriver(), open a handle to hwinterface driver.

4) inst() , Extract 'hwinterface.sys' from binary resource to 'systemroot\drivers' directory and creates a service. This function is called when 'Opendriver' function fails to open a valid handle to 'hwinterface' service.

5) start() , starts the hwinterface service using Service Control Manager APIs.

6) SystemVersion() Checks the OS version and returns appropriate code.

What is hwinterface.ocx ActiveX control

It is an activex control with same features of Inpout32.dll. It can be used either with VC++ or VB. But it gives great convenience when used with VB. Data can be written to parallel port using Outport method and can be read using Inport method.
Download Inpout32.dll and source code here


Useful links

Windows NT/Windows 2000/WDM Driver FAQ by Jamie E. Hanrahan

Programming Windows Driver Model by Walter Oney

Details of all the APIs used is available at MSDN Online
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top