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.
 

tjalps

Full Member level 5
Full Member level 5
Joined
May 28, 2001
Messages
240
Helped
6
Reputation
12
Reaction score
3
Trophy points
1,298
Location
SLOVENIA
Activity points
1,994
lpt1 input

Check this out:

**broken link removed**

It's quite easy.

Regards!
 

cheolim

Full Member level 1
Full Member level 1
Joined
Dec 3, 2002
Messages
97
Helped
3
Reputation
6
Reaction score
3
Trophy points
1,288
Activity points
873
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:
 

sadat007

Full Member level 4
Full Member level 4
Joined
Dec 31, 1999
Messages
235
Helped
13
Reputation
26
Reaction score
7
Trophy points
1,298
Location
Pakistan
Activity points
1,773
www.hi ndi ppric

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

yogi

Full Member level 6
Full Member level 6
Joined
Jan 8, 2005
Messages
336
Helped
22
Reputation
44
Reaction score
5
Trophy points
1,298
Activity points
2,177
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
 

ashad

Full Member level 6
Full Member level 6
Joined
Mar 28, 2006
Messages
393
Helped
40
Reputation
80
Reaction score
28
Trophy points
1,308
Location
Trento, Italy
Activity points
3,296
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
 

budhy

Advanced Member level 3
Advanced Member level 3
Joined
Oct 21, 2006
Messages
823
Helped
218
Reputation
436
Reaction score
32
Trophy points
1,308
Location
Indonesia
Activity points
5,225
lpt ecp receive data

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

ashad

Full Member level 6
Full Member level 6
Joined
Mar 28, 2006
Messages
393
Helped
40
Reputation
80
Reaction score
28
Trophy points
1,308
Location
Trento, Italy
Activity points
3,296
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
 

budhy

Advanced Member level 3
Advanced Member level 3
Joined
Oct 21, 2006
Messages
823
Helped
218
Reputation
436
Reaction score
32
Trophy points
1,308
Location
Indonesia
Activity points
5,225
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 !
 

ashad

Full Member level 6
Full Member level 6
Joined
Mar 28, 2006
Messages
393
Helped
40
Reputation
80
Reaction score
28
Trophy points
1,308
Location
Trento, Italy
Activity points
3,296
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

Top