<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>http://www.fsdeveloper.com/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=DoyleChris</id>
	<title>FSDeveloper Wiki - User contributions [en-gb]</title>
	<link rel="self" type="application/atom+xml" href="http://www.fsdeveloper.com/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=DoyleChris"/>
	<link rel="alternate" type="text/html" href="http://www.fsdeveloper.com/wiki/index.php/Special:Contributions/DoyleChris"/>
	<updated>2026-08-25T10:09:48Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.1</generator>
	<entry>
		<id>http://www.fsdeveloper.com/wiki/index.php?title=Variables_-_Formats_-_Encoding_-_Binary&amp;diff=9814</id>
		<title>Variables - Formats - Encoding - Binary</title>
		<link rel="alternate" type="text/html" href="http://www.fsdeveloper.com/wiki/index.php?title=Variables_-_Formats_-_Encoding_-_Binary&amp;diff=9814"/>
		<updated>2015-01-26T23:15:08Z</updated>

		<summary type="html">&lt;p&gt;DoyleChris: /* BCD32 - 4 BYTES */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{:Ambox-Content-WIP}} &lt;br /&gt;
{{Infobox-Applicable-FSVersion&lt;br /&gt;
| FSXI = false&lt;br /&gt;
| FSXA = true&lt;br /&gt;
| FSX = true&lt;br /&gt;
| FS2004 = true&lt;br /&gt;
| FS2002 = true&lt;br /&gt;
| FS2000 = false&lt;br /&gt;
| FS98 = false&lt;br /&gt;
}}&lt;br /&gt;
Placeholder for Variables - Formats - Encoding - Binary related info.&lt;br /&gt;
&lt;br /&gt;
For passing info to gauges, or into missions via SimConnect applets.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Binary-Encoding ==&lt;br /&gt;
In a fixed-width binary code, each letter, digit, or other character, is represented by a sequence of bits of the same length, &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
usually indicated in code tables by the octal, decimal or hexadecimal notation for the value of that sequence of bits interpreted as a binary number.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
i.e. A method of coding data, as sequences of characters.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Binary-coded decimal, (BCD),is a method of storing individual decimal based characters.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Binary-coded octal, (BCO), is the octal equivalent.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Example Legibility ==&lt;br /&gt;
Requires checking - &lt;br /&gt;
&lt;br /&gt;
For legibility purposes only, the examples below include spaces, dots, hyphens, etc. as seperators.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Your code should not include those characters.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Binary-Coded Decimal (BCD) ==&lt;br /&gt;
Used in - ???&lt;br /&gt;
&lt;br /&gt;
A method of storing individual digits for &#039;easy&#039; manipulation.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
The implementation used in FS is actually &amp;quot;Packed BCD&amp;quot;,&lt;br /&gt;
where one BCD digit is stored in each half byte, (aka nibble).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== 1 BYTE ===&lt;br /&gt;
Just for explaining the principle.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
These are the BITs in a 8 bit number with their order value for a BCD encoded number:&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
8 4 2 1 . 8 4 2 1&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Example -&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
0001-0111 is 1-7 which is 1x10 + 7x1 = 17&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
One BCD digit is stored in each half byte, (aka nibble).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Storage Types ===&lt;br /&gt;
BCD 16 or 32 defines the storage type -&lt;br /&gt;
&lt;br /&gt;
typedef VAR16   BCD16, *PBCD16, **PPBCD16;      // 4-digit BCD number (0000-9999)&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
typedef VAR32   BCD32, *PBCD32, **PPBCD32;      // 8-digit BCD number (00000000-99999999)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== BCD16 - 2 BYTES  ===&lt;br /&gt;
Used in - ???&lt;br /&gt;
&lt;br /&gt;
These are the BITs in a 16 bit number with their order value for a BCD encoded number:&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
8 4 2 1 . 8 4 2 1 . 8 4 2 1 . 8 4 2 1&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is 2 bytes and can store a 4 digit BDC16 encoded number, &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
with one BCD digit stored in each half byte, (aka nibble). &lt;br /&gt;
&lt;br /&gt;
Example -&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
0011-0110 0010-0101 is 3-6 2-5 which is 3x100 + 6x10 + 2x1 + 5x0.1 = 362.5 &lt;br /&gt;
&lt;br /&gt;
Useage -&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
FS example required&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Note - ====&lt;br /&gt;
For COM and NAV frequencies there&#039;s a legacy related matter -&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Since the highest order digit in the instrument (gauge) is always 1 (one), &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
it is not recorded in the BCD representation to save space. (now only 4 digits have to be stored)&lt;br /&gt;
&lt;br /&gt;
e.g.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
For a frequency of 136.25 &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
1 is assumed&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
so the recorded BCD is 3625&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== BCD32 - 4 BYTES ===&lt;br /&gt;
Used in - ADF Radios&lt;br /&gt;
&lt;br /&gt;
These are the BITs in a 32 bit number with their order value for a BCD encoded number:&lt;br /&gt;
&amp;lt;PRE&amp;gt;&lt;br /&gt;
8 4 2 1 . 8 4 2 1 . 8 4 2 1 . 8 4 2 1 . 8 4 2 1 . 8 4 2 1 . 8 4 2 1 . 8 4 2 1&lt;br /&gt;
&amp;lt;/PRE&amp;gt;&lt;br /&gt;
&lt;br /&gt;
BCD32 is 4 bytes for an 8 digit BCD encoded number,&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
again with one BCD digit stored in each half byte, (aka nibble). &lt;br /&gt;
&lt;br /&gt;
Example - &lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
THIS EXAMPLE NEEDS CHECKING/CORRECTING&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
0001-0011 1000-0100 0101-0000 0000-0000 is 1-3 8-4 5-0 0-0 which is 1x1000 + 3x100 + 8x10 + 4x1 + 5x0.1 = 1384.5&lt;br /&gt;
&lt;br /&gt;
Useage - ADF Radios&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
FS example required&lt;br /&gt;
&lt;br /&gt;
== Binary-Coded Octal (BCO) ==&lt;br /&gt;
Equivalent for Octal required.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Related ==&lt;br /&gt;
Hex-Decimal-Binary online converter at - http://flor.nl/dec2hex.html&lt;br /&gt;
&lt;br /&gt;
[[category:Aircraft Design]]&lt;br /&gt;
[[category:Panel and Gauge Design]]&lt;/div&gt;</summary>
		<author><name>DoyleChris</name></author>
	</entry>
</feed>