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 program by assembler connecting 2 PC by using LPT?

Status
Not open for further replies.

caonguyen

Newbie level 2
Joined
Dec 17, 2003
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
15
I'd like to program by assembler connecting 2 PC by using LPT port. Please show me a software or the way to make this software (must be by Assembler).
Thank you.
 

Analyzer

Full Member level 6
Joined
Nov 18, 2001
Messages
374
Helped
3
Reputation
6
Reaction score
3
Trophy points
1,298
Activity points
3,518
It is easy to do, but i can only give pseudo code. Like this

Put accumulator port number like mov ax->378
send bytes to that. Out ax,bytes..
In other hand read, put port num to accu again then read it. In ax
Isnt it so easy to code it eh?

Analyzer.
 

cevitamic

Newbie level 6
Joined
Dec 15, 2003
Messages
13
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,281
Activity points
192
Re: How to program by assembler connecting 2 PC by using LPT

well, its a classic problem in micro-computer and its peripherial.
first of all, you need to be aware that there're several modes in parallel port on pc, e.g. spp, ecp and epp. for any mode, there are 3 ports, data port (in some mode it can be used in one direction only, while in bi-directions in others) , control port (usually for writing only) and state port (usually for reading only), each with a given address which can be set in BIOS.

If you want to establish a communication between 2 PC by using LPT (or COM), you have to design a communication protocol, which defined when to send or receive datum. You can design such a protocol as your wish, however, in general, we use data port to send or receive data packet (8 byte per packet), use control port to send communication command, such as STROBE and ACK, use state port to check whether the sender has finished the preparing for the next packet and the receiver has finished the receiveing of the last packet.

Assuming that we will send some data from PC "A" to PC "B", you have to write a send-program on A and a receive-program on B. At the beginning of the communication PC A check for the BUSY state on PC B, until it find that PC B is not BUSY, then it will send a packet to its data port by using an OUT instruction in assembly, and then it send a STROBE command to B by setting the corresponding bit of its control port with another OUT instruction, now A can check for ACK from B which means that B has finished the receiving of the packet. For B, at the beginning, it sets BUSY bit of its control port to be "Not Busy", which means that "I'm ready for recieving data", and then B checks the STROBE signal from A, once B was strobed, it reads its data port by using an IN instruction, after that, B will send a "ACK" signal to A by setting the corresponding bit of its control port, to tell A that "I have received the last packet, and you can send me the next one."

As described above, its easy to implement a communication between 2 PCs by using LPT.

I hope it's what you want to get.
 

mit

Newbie level 6
Joined
Dec 20, 2003
Messages
12
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
110
You can see the "Parallel Port Completed" book by Jon Axelzon
 

pony

Junior Member level 2
Joined
Mar 12, 2004
Messages
21
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
98
Re: How to program by assembler connecting 2 PC by using LPT

1. Setting bin-direction mode in BIOS for Parallel Port.
2. Use code:
mov ax, 0378h
mov dl, DataByte
out ax, dl
Good luck.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top