3

I am trying to implement the HDLC frame format type 3 and I have some doubts as regards Octets/Modulo 8 encoding of frames.

  1. Firstly, Is the HDLC frame transmitted entirely in Octets?
  2. What do they mean by a frame is 'n' Octet in length? Please give an example.
  3. I believe that Octet and Modulo is the same, so assuming that we have a frame X of one byte, what then do they mean by the encoding of X shall be modulo 8.

I am getting a little confused with all this, so i need more clarifications. Example and illustration will be of great help.

Thanks in Advance.


Thanks @clifford and @masoud. Your answer was really helpful. But I have to read this Octet String: What is it? (though it sounds funny because it explained in a simple way), and I came back to read your comments, then I understood all you explained. All the same, wish me a happy coding.

Community
  • 1
  • 1
Paul A.
  • 449
  • 1
  • 4
  • 22

2 Answers2

4

In HDLC every field length must be modulo 8 for example:

A frame of HDLC is like below: [FLAG(8bits)|ADDRESS(8bits)|CONTROL(8/16bits)|INFORMATION(n*8bits)|FCS(8bits)|FLAG(8bits)]

each field is modulo 8, even length of INFORMATION must be modulo 8.

It means if you want to send a data with length of 1 bit, you must consume a byte(8 bits).

If you are looking for some HDLC frame sample, look at this link: Click me! and read this: Click me

masoud
  • 55,379
  • 16
  • 141
  • 208
  • Thanks @Masoud, But I still cant place what you mean by ** If you want to send a data with Length of 1 bit, you must consume 1 byte**. To help, can you please explain using the opening Flag of the HDLC frame and maybe the frame type and length as below, illustrating using binary, Hexadecimal and the Octet/Modulo 8. **7E// HDLC frame opening flag A00A// frame type and length**. Thanks once again! – Paul A. Sep 27 '11 at 10:03
  • `7E = (01111110) in binary` : it is a constant value to start and finish the frame, and you must put this value in begin and end of your frames. The second value(`A00A`) depends on your application. Binary, Hexadecimal and Octal are same in value, we use hexadecimal representation due to ease of reading for human. – masoud Sep 27 '11 at 10:50
  • **If you want to send a data with Length of 1 bit, you must consume 1 byte** means: For sending a bit of data, at least you have to use a byte. – masoud Sep 27 '11 at 10:51
  • Okay, I got that clarified. So Secondly, If i want to transmit a character **A** in Modulo 8. What will I be transmitting. I hope I am not mixing things up now. I just want more clarity. For example in the SNRM Frame 7EA00A00020023219318717E, apart from the Opening and closing flags, are all others in Modulo 8 like you said? if so, then where does **A** come from, because I believe Octet is from 0-7. Well, maybe if you show me some example of a frame of about 1 byte and how you encoded it to modulo 8, I believe that will help. Thanks once again. – Paul A. Sep 27 '11 at 13:35
  • Do you mean character `A` with ASCII code (1000001) in binary, or `A` that uses in hexadecimal representation? `7EA00A00020023219318717E` is hexadecimal value of frame not an ASCII string. – masoud Sep 27 '11 at 13:48
  • I mean character **A**. So if the frames are in HEX, then where is the Modulo 8 encoding. – Paul A. Sep 27 '11 at 13:54
2

Firstly, Is the HDLC frame transmitted entirely in Octets?

That simply means that the data length is a multiple of 8 bits. Yes it is.

What do they mean by a frame is 'n' Octet in length?

Who is "they"? Cite your reference material. An octet is simply a group of eight bits. It is a less ambiguous term that byte (which can rarely be used refer to a machine word of length other than eight bits). The term octet is widely used in telecommunications, and is also used in languages other than English to mean "byte" (when a byte is eight bits).

I believe that Octet and Modulo

Not at all, modulo is a mathematical term, used here perhaps inaccurately to mean exactly divisible by (or an exact multiple of) eight.

[...] what then do they mean by the encoding of X shall be modulo 8.[?]

Again who are "they"? If we can see where you are reading this in context, you may get a better explanation.

Edit: I have not gone to the length of referencing ISO 3309 which is the standard defining HDLC frame structure, but the term "Modulo 8" in at least the Wikipedia article is used only in the context of frame sequence numbers, where it simply means that a sequence number increments from 0 to 7, then restarts at 0 (i.e. it is the frame number modulo 8 - or the remainder of frame_num/8 or simple frame_num % 8 in C code. I wonder whether you are confusing terms - again a citation or extract would help.

Clifford
  • 88,407
  • 13
  • 85
  • 165