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.

communicating with ports using Pascal language

Status
Not open for further replies.

cutytongy

Newbie level 2
Joined
Feb 18, 2005
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,300
please help me with codes to enable me communicate with my serial and parallel ports using pascal language. pls this is a school project so i need it in a hurry. thanx
 

TheHungry

Full Member level 2
Joined
Mar 6, 2002
Messages
147
Helped
4
Reputation
8
Reaction score
2
Trophy points
1,298
Activity points
999
witch pascal , turbo , delphi ......
 

suromenggolo

Advanced Member level 4
Joined
Feb 25, 2005
Messages
107
Helped
9
Reputation
18
Reaction score
0
Trophy points
1,296
Activity points
2,240
for paralelel port
to output port can use this code with turbo pasacal v.6

procedure output(data_out: byte);
var temp: byte;
begin
temp:=data_out
asm
MOV DX, 387h
MOV AL, temp
OUT DX, AL
end;
end;
 

yo5oqa

Junior Member level 2
Joined
Oct 21, 2004
Messages
20
Helped
8
Reputation
12
Reaction score
4
Trophy points
1,283
Location
Romania
Activity points
188
You have to tell which port do you use:

procedure outport(port:byte;data:byte);
begin
asm
push ax
push dx
mov eax,data
mov edx,port
out dx,ax
pop dx
pop ax
end;
end;


procedure inport(port:byte;var data:byte);
begin
asm
push ax
push dx
mov edx,port
in dx,ax
mov data,eax
pop dx
pop ax
end;
end;

...and you call it like this ($378 = LPT1...):
outport($378,data_out);
inport($378,data_in);

...for input you must change the direction for data bus, first;
 

dirace

Member level 3
Joined
May 12, 2001
Messages
58
Helped
2
Reputation
4
Reaction score
1
Trophy points
1,288
Activity points
409
In Windows NT(XP) You cant access directly the LPT
You have to a driver

take a look here
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top