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.

communicating with ports using Pascal language

Status
Not open for further replies.

cutytongy

Newbie level 2
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
 

witch pascal , turbo , delphi ......
 

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;
 

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;
 

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

Back
Top