Ora

What is the flag in HDLC?

Published in HDLC Protocol 2 mins read

The flag in HDLC (High-Level Data Link Control) is a unique bit pattern, 01111110 (7E in hexadecimal), that serves to mark the beginning and end of an HDLC frame.

Understanding the HDLC Flag

Here's a breakdown of the HDLC flag's role:

  • Frame Delimitation: The flag signals the start and finish of an HDLC frame, allowing the receiver to identify the boundaries of the data being transmitted. Each frame begins with 7E and ends with 7E.

  • Synchronization: The flag helps the receiver synchronize with the incoming data stream.

  • Inter-Frame Fill: The flag can also act as filler between frames when there is no data to send.

HDLC Frame Structure and the Flag's Position

An HDLC frame typically has the following structure:

Field Description
Flag Start of frame (01111110)
Address Destination address
Control Control information
Data Payload
FCS Frame Check Sequence (Error detection)
Flag End of frame (01111110)

Important Considerations

  • Zero Bit Insertion (Bit Stuffing): To prevent the flag pattern from appearing within the data field, a '0' is inserted after every five consecutive '1's in the data during transmission. The receiver removes these inserted '0's. This process is called bit stuffing or zero insertion.
  • Flag Sharing: The ending flag of one frame can serve as the starting flag of the next frame, improving efficiency. This is especially useful in continuous data transmission.

In essence, the HDLC flag is fundamental for framing, synchronization, and error management within the HDLC protocol.