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.

How to connect 6 switches to LPT port and check their states?

Status
Not open for further replies.

Bizum

Junior Member level 2
Junior Member level 2
Joined
Jul 10, 2002
Messages
22
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
112
Hi there
Can someone tell me how to connect 6 switches to lpt port(25 pin or centronics 36 pin) to be able to check their states? What adresses i should use(base adress h378). THX for any help.
 

lpt1 input

Check this out:

**broken link removed**

It's quite easy.

Regards!
 

input lpt

Hello, Bizum

Re. your inquiry, if you need only check port status, it's very simple.
You may do like belows.

#include <dos.h>
#include <bios.h>
#include <stdio.h>
#include <stdlib.h>

#define LPT2 0x379
#define LPT3 0x37A

void main(void)
{
... decalare your variables here;

tmp_dt = inportb(LPT2);
tmp_dat= (tmp_dt & 0x78) >> 3;
tmp_dt = (tmp_dt ^ 0x80) & 0x80;
tmp_dt >>=3;
tmp_dat= tmp_dat + tmp_dt;
tmp_dt = inportb(LPT3);
tmp_dt = (tmp_dt ^ 0x03) & 0x03;
tmp_dt <<= 5;
tmp_dat= tmp_dat + tmp_dt;
tmp_dt = inportb(LPT3);
tmp_dt = (tmp_dt ^ 0x08) & 0x08;
tmp_dt <<= 4;
tmp_dat= tmp_dat + tmp_dt;

... Now you can check 8-pins status;

... Other your codes here;

}

In this point, you'd better to know, there are some pins are Read only
and some are Write only on parallel port of PC.
For detailed information re. this, I attached scanned book image.
Please refer to that, hope to be a useful.

Good luck.
:roll:
 

www.hi ndi ppric

check my post EXPERIMENTS WITH PARALLEL PORT
**broken link removed**
 

lpt data output capturing

first connect switches to the data port. Put data port in bidirectional mode(C5=1), then use lpt.exe to see the status of the input pins

bibin john
www.bibinjohn.tk
 

lpt input freebsd

as u know that in the LPT port there are Data, control and status pins ........ the status pins u can use as the input
 

lpt ecp receive data

ashan wrote :
the status pins u can use as the input
The data port also can use as input port!
 

lpt inputs

there are so three different mode of LPT port

in normal mode the Data port can be use as a output port

but in ECP EPP mode we can take input from the data port

i want to say that if u are using any mode then status pins always can be use as a Input
 

set lpt spp mode

in normal mode the Data port can be use as a output port
in Normal SPP mode, the Data port can be use as a input port !
 

lpt input pins

basically with changing in any Bios i tried to get in the SPP mode to take input from the data port by using C language inport function but i could not get the data but from the status pin i got the correct data ..... i tried it practically then write........

but may be i was making some mistake ........ kindly send me the C code for reference
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top