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 interface with parallel port in C++/Matlab

Status
Not open for further replies.

linchan

Newbie level 4
Newbie level 4
Joined
Mar 17, 2006
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,319
Hi all.do anyone know how I can interface with parallel port.How I can program for LPT1.
by regards.Im waiting for you response
 

slavko

Member level 2
Member level 2
Joined
Sep 1, 2004
Messages
46
Helped
7
Reputation
14
Reaction score
0
Trophy points
1,286
Activity points
369
outportb($378,0) inportb($379)

try read this:

Interfacing the Standard Parallel Port
**broken link removed**

and "PortTalk - A Windows NT I/O Port Device Driver"
**broken link removed**
 

    linchan

    Points: 2
    Helpful Answer Positive Rating

alijan

Member level 1
Member level 1
Joined
Mar 6, 2006
Messages
37
Helped
8
Reputation
16
Reaction score
0
Trophy points
1,286
Activity points
1,553
lpt programs

In which language?
 

    linchan

    Points: 2
    Helpful Answer Positive Rating

linchan

Newbie level 4
Newbie level 4
Joined
Mar 17, 2006
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,319
Re: LPT programs

I am working with c++ but i want codes for c++, pascal.
 

alijan

Member level 1
Member level 1
Joined
Mar 6, 2006
Messages
37
Helped
8
Reputation
16
Reaction score
0
Trophy points
1,286
Activity points
1,553
Re: LPT programs

C++:
#include<dos.h>
#include<conio.h>
#include<stdio.h>
main()
{
int a,b;
do
{
a=inportb(0x379); //Input a byte from port
b=a&0x10; //Mask
outportb(0x378,0);
}while(b!=0);
outportb(0x378,0xff)
{
Note:for input a word you must use import() for input a word, and outport() for out.
===================================================

Pascal:

Program
Uses crt;
Var
a,b:byte;
begin
clrscr;
repeat
a:=port[$379];
b:=a and $10;
port[$378]:=0;
until b=0;
port[$378]:=$FF;
End.


Note:for a word you must use portw[].
 

    linchan

    Points: 2
    Helpful Answer Positive Rating

linchan

Newbie level 4
Newbie level 4
Joined
Mar 17, 2006
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,319
Re: LPT programs

tnx.
How about Matlab?
Do u know?
 

alijan

Member level 1
Member level 1
Joined
Mar 6, 2006
Messages
37
Helped
8
Reputation
16
Reaction score
0
Trophy points
1,286
Activity points
1,553
Re: LPT programs

Here you are(Communication with parallel port in Matlab) :


Dio=digitalio('parallel',1);
Hwlines=addline(dio,0:7,'out');
Out=getvalue(dio)
 

    linchan

    Points: 2
    Helpful Answer Positive Rating

linchan

Newbie level 4
Newbie level 4
Joined
Mar 17, 2006
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,319
Re: LPT programs

tnx.can you explain abt this code?
bye
 

alijan

Member level 1
Member level 1
Joined
Mar 6, 2006
Messages
37
Helped
8
Reputation
16
Reaction score
0
Trophy points
1,286
Activity points
1,553
Re: LPT programs

If you want to know what kind of devices are connected to Matlab,you must use the following code:

out=daqhwinfo;
out.InstalledAdaptors

after running you can see the lines such as:
Ans+
'parallel'
'winsound'
>>
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top