104 lines
7.1 KiB
HTML
104 lines
7.1 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<meta name="description" content="Portfolio showcasing projects worked on by Joshua Perry">
|
|
<meta name="keywords" content="HTML, CSS, JavaScript, jpez, jpez-development, home, bio, portfolio">
|
|
<meta name="author" content="Joshua Perry">
|
|
|
|
<base href="../">
|
|
|
|
<title>Blog: J-Pez Development</title>
|
|
<link rel="icon" type="image/svg+xml" href="assets/images/favicon.svg">
|
|
|
|
<link rel="stylesheet" href="style/main.css" media = "screen">
|
|
<link rel="stylesheet" href="blog/blog.css" media="screen">
|
|
<link rel="stylesheet" href="style/mobile.css" media ="screen and (max-width:800px)">
|
|
<link rel="stylesheet" href="blog/blog_mobile.css" media ="screen and (max-width:800px)">
|
|
|
|
</head>
|
|
<body id="clicked">
|
|
|
|
<nav class="navigation">
|
|
<a class="hidenav" href="blog/blog.html#"> X</a>
|
|
<a class="nav link" id="home" href="home/index.html"><h2>J-Pez Development</h2></a>
|
|
<a class="nav link" id="port" href="portfolio/portfolio.html"><h2>Portfolio</h2></a>
|
|
<a class="nav link" id="blog" href="blog/blog.html"><h2>Blog</h2></a>
|
|
<a class="nav link" id="contact" href="contact/contact.html"><h2>Contact</h2></a>
|
|
<a class="arrow right"></a>
|
|
</nav>
|
|
|
|
<main>
|
|
<a class="shownav" href="blog/blog.html#clicked"></a>
|
|
<div class="blog">
|
|
<section class="blog_post" id="first">
|
|
<button class="arrow"></button>
|
|
<h2 class="blog_title">Binary to Denary Conversions</h2>
|
|
<img class="blog_image" src="assets/blog/images/first.png" alt="Binary Conversion Table"/>
|
|
<p class="blog_content">The image above is an example of a table we can use to convert <span class="moreInfo">8-bit binary numbers<span class="extraInfo">referred to as bytes</span></span> to denary.
|
|
Each individual bit is put into each column in the same order as written. Any columns with a 1 should have their values added together.
|
|
The resulting value is the denary conversion.
|
|
|
|
To convert from denary to binary, take the number you wish to convert and starting in the left most column try subtracting the number from
|
|
the one you wish to convert. If it can be done without producing a negative put a 1 in the column, if you cannot, put a 0. Once the remainder is 0,
|
|
add 0s to any remaining columns. The resulting number is the binary conversion.
|
|
|
|
If you want to convert above 8-bit numbers, each column's denary value is calculated as 2 raised to the power of the column starting from the right and at 0.
|
|
</p>
|
|
<p class="blog_details"></p>
|
|
</section>
|
|
<section class="blog_post" id="second">
|
|
<button class="arrow"></button>
|
|
<h2 class="blog_title">Binary Addition</h2>
|
|
<img class="blog_image" src="assets/blog/images/second.jpg" alt="Example of Binary Addition using Long Addition"/>
|
|
<p class="blog_content">In primary school we are taught to use long addition to sum numbers on paper. The practice relies on the concept of carrying digits to
|
|
other columns when the simple addition excedes 10. We can use the same technique to add binary numbers just instead of carrying when
|
|
exceding 10, we do this at 1. The best way to visualise this is with a couple of rules whenn carrying. First, when adding two 1s in a column,
|
|
the answer is 0 carry 1. Secondly, when <span class="moreInfo">adding three 1s in a column<span class="extraInfo">from a previous carry</span></span>, the answer is 1 carry 1.</p>
|
|
<p class="blog_details"></p>
|
|
</section>
|
|
<section class="blog_post" id="third">
|
|
<button class="arrow"></button>
|
|
<h2 class="blog_title">Binary Subtraction Using 2's Complement</h2>
|
|
<img class="blog_image" src="assets/blog/images/third.jpg" alt="Example of 2's Complement"/>
|
|
<p class="blog_content">Subtraction in binary is a little hard as it is not as intuitive as the addition. To subtract two binary numbers we use a method known as
|
|
2's complement. 2's complement is a way of expressing a binary number as a negative. After doing this conversion, you can just add the two
|
|
numbers and it will give the same answer as if the two numbers were subtracted in denary. To find 2's complement, you begin by <span class="moreInfo">inverting
|
|
each bit in the number<span class="extraInfo">if the bit is a 0 it becomes 1, and vice versa</span></span> and then add 1.</p>
|
|
<p class="blog_details"></p>
|
|
|
|
</section>
|
|
<section class="blog_post" id="fourth">
|
|
<button class="arrow"></button>
|
|
<h2 class="blog_title">Binary to Hexadecimal Conversions</h2>
|
|
<img class="blog_image" src="assets/blog/images/fourth.png" alt="Denary to Hexadecimal Conversion Table"/>
|
|
<p class="blog_content">Hexadecimal is another base system used in programming. Just like binary and denary hexadecimal creates a new column when it's
|
|
<span class="moreInfo">limit<span class="extraInfo">15</span></span> is reached. However, as the base system is higher than our <span class="moreInfo">standard system<span class="extraInfo">denary</span></span>, we use <span class="moreInfo">letters<span class="extraInfo">A-F</span></span> to express the
|
|
numbers 10-15 so that they can be single digits.</p>
|
|
|
|
<p class="blog_content">To convert from binary to hexadecimal, split the 8-bit number into two 4 bit numbers and convert these numbers to denary. For any number
|
|
greater than 9 remember to use the letter assignation for hexadecimal. To convert from binary to denary, take the left digit and multiply
|
|
it by 16, then add the second digit. If you want to convert hexadecimal numbers with more than two digits to denary, you take each digit
|
|
and multiply it's denary value by 16 raised to the power of digits left to convert. The easiest way to convert from denary to hexadecimal
|
|
is by first converting to binary, and then hexadecimal.</p>
|
|
<p class="blog_details"></p>
|
|
|
|
</section>
|
|
</div>
|
|
</main>
|
|
|
|
<footer>
|
|
<a href="home/index.html">
|
|
<img src="assets/images/favicon.svg" id="footer_logo" alt="Logo"/>
|
|
<p>©Joshua Perry 2022</p>
|
|
</a>
|
|
<a href="blog/blog.html"><h1>Blog</h1></a>
|
|
<a href="site/report.html"><h1>Site Report</h1></a>
|
|
<a href="site/map.html"><h1>Site Map</h1></a>
|
|
<a href="site/construction.html"><h1>Terms</h1></a>
|
|
<a href="site/construction.html"><h1>Privacy</h1></a>
|
|
</footer>
|
|
</body>
|
|
</html> |