What are BIN files?

Kui soovid välja käia mingi tarkusetera siis postita siia. Vastusteks olgu ainult teema edasiarendused.
Kasutaja avatar
admin
Admin
Postitusi: 594
Liitunud: 15:06, 11 Jaan 2003
Asukoht: Saaremaa
    unknown unknown
On tänanud: 6 korda
On tänatud: 22 korda
Kontakt:

What are BIN files?

PostitusPostitas admin » 21:11, 14 Jaan 2003

With many thanx to Dicky

Sometimes when you download files to load through your programmer, you will find them with a .bin rather than .hex extension. Bin files represent programming data in its purest form. Looked at in text, they will appear only as long lines of '0' and '1'.
The everyday numbers that we all know and love come from the decimal system, which uses '10' as its base. The binary system instead uses a base of '2'.

So this is how we count in binary... we'll do it with with four digits first like this


8 (4) (2) (1) - this row shows what the digits value
0 0 0 0 = 0
0 0 0 1 = 1
0 0 1 0 = 2
0 0 1 1 = 3 (2 + 1)
0 1 0 0 = 4
0 1 0 1 = 5 (4 + 1)
0 1 1 0 = 6 (4 + 2)
0 1 1 1 = 7 (4 + 2 +1)
1 0 0 0 = 8
1 0 0 1 = 9
1 0 1 0 = 10
1 0 1 1 = 11 (8 + 2 + 1 = 11)
1 1 0 0 = 12
1 1 0 1 = 13
1 1 1 0 = 14
1 1 1 1 = 15 (8 + 4 + 2 + 1 = 15)

Bits of binary dat like this are grouped together.
4 bits like above is call a "nibble" and has 16 possible values - 0 to 15.
8 bits (2 nibbles) is called a byte and has 256 possible values, like this:

(128 (64) (32) (16) 8 (4) (2) (1)
0 0 0 0 0 0 0 0 = 0
up to
1 1 1 1 1 1 1 1 = (128+64+32+16+8+4+2+1 = 255

Now imagine if those hex keys were all posted like this
01100111 11000010 10100011..... There would be a lot of scope for making mistakes in writing the data. You could make it less complicated by writing it in decimal numbers with which we are most familiar. Then, all that data would look like this:

245 8 99 32 0 112

But that is messy, so programmers devised a shorthand way to write large numbers in a much smaller amount of space. That shorthand is called hex, and is the subject of the next quick-guide FAQ.

Mine

Kes on foorumil

Kasutajad foorumit lugemas: Registreeritud kasutajaid pole ja 2 külalist