[Networking Series 1/3] Decimal, Binary and Hexadecimal

Various topics with in depth explanation

Moderator: Moderator Group

Forum rules
If you have questions please do not respond to the topics and create a new one on in the Pandoras Box or Widget Designer forums instead. Comments to information given are always welcome, though.

[Networking Series 1/3] Decimal, Binary and Hexadecimal

Postby Dennis Kuypers » Wed Jul 25, 2018 10:11 pm

Decimal system
The system we commonly use to express numeric values is the decimal (Greek déka means ten). It is called the 10-system because we have ten symbols available, namely 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9.

To express values over nine, we simply add a digit and set the current place back to 0 (9 -> 10). Let's apply this principle to another system:

Binary or 2-base
In a binary system (or 2-base) we only have two symbols, namely 1 and 0. We denote the 2-base system by adding a small 2 as subscript: 100011012.

To count we apply the same principle as in the 10-base system. We start with 02, then we got 12. Now we are out of symbols so we have to add another digit and set the first place back to 0: After 12 comes 102 (this is 3 in the decimal system)

We can continue this: 02, 12, 102, 112, 1002, 1012 ...

Hexadecimal or 16-base
The last system that we need to understand is the hexadecimal system. We have 16 symbols. After the numbers 0-9 we use letters A through F: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E and F

Lets count once again - and if we run out of symbols, we again add another digit and set the previous one back to 0. (we start with 8 here)

8 = 816
9 = 916
10 = A16
11 = B16
12 = C16
13 = D16
14 = E16
15 = F16
16 = 1016
17 = 1116

In technical documents you usually see something like 0x2F - here the "0x" prefix denotes that we are using the hexadecimal system. 0x2F = 2F16 = 47

Important
These different systems are just different ways of expressing the same thing.
When sending network messages you are just sending numbers - There is no such thing as "send values as hex" - you are just using a different way to express what values you want to use. The value that is transmitted for either 20, 0x14, 101002 (2-base) is the same.

Note to Widget Designer users
If you want to send a specific byte (for example 20) then you can either use the
a) decimal notation: [d20]
b) hexadecimal notation [h14]
Dennis Kuypers
Product Developer, Software

Online Manual
User avatar
Dennis Kuypers
coolux Germany
 
Posts: 767
Joined: Thu Jul 05, 2012 12:18 pm

Return to Good to know

Who is online

Users browsing this forum: No registered users and 0 guests