web analytics

What is handshaking? Write a suitable example for handshaking with necessary assembly codes.


Handshaking is a I/O control method to synchronize I/O devices with the microprocessor. As many I/O devices accepts or release information at a much slower rate than the microprocessor, this method is used to control the microprocessor to work with a I/O device at the I/O devices data transfer rate.


Supposing that we have a printer connected to a system. The printer can print 100 characters/second, but the microprocessor can send much more information to the printer at the same time. That’s why, just when the printer gets it enough data to print it places a logic 1 signal at its Busy pin, indicating that it is busy in printing. The microprocessor now tests the busy bit to decide if the printer is busy or not. When the printer will become free it will change the busy bit and the microprocessor will again send enough amounts of data to be printed. This process of interrogating the printer is called handshaking.

Following is an assembly code that tests the BUSY Flag and sends data to the printer if it is not busy or the busy flag is a logic 0.


IN AL, BUSY ; get busy flag
TEST AL, BUSY_BIT ; test busy bit
JNE PRINT ; if printer busy
MOV AL, BL ; get data from BL
OUT PRINTER, AL ; send data to printer


Free PHP, HTML, CSS, JavaScript editor – CodeLobster IDE

Please follow and like us:
Pin Share

15 thoughts on “What is handshaking? Write a suitable example for handshaking with necessary assembly codes.”

  1. Thank U very much for this explanation of handshaking
    actually my example is Blood Pressure communicate through Temperature device

    many thanks ^^

  2. Sorry I missed your comment and came back after a long time.

    And also sorry as this is not what I practice now a days, these were my class notes which I made 3-4 years ago while studying CSE. I can't step ahead with checking your pseudo-code.

Comments are closed.

Follow by Email
Scroll to Top