BINARY

The binary is referred to as BASE 2 because there are 2 numbers (0 and 1)

Normal numbers – or denary numbers – are referred to as BASE 10 because there are 10 numbers (0-9) 

  • Computers use a binary number system consisting of only 0s and 1s
  • Everything that a computer needs to process must be converted into binary format
  • This format is used for storing numbers, text, images, sound, and program instructions
  • 1 bit= a single 0 or 1
  • 1 byte= 8 bits= 1 character of text
  • 1KB= 1024 bytes
  • 1MB= 1024 KB or 1024 x 1024 bytes
  • 1GB= 1024 MB
  • 1TB= 1024 GB
FileSize
One character of text1 byte
A full page of text30 KB
One small digital colour photograph3 MB
Music CD600 MB
A DVD4.5 GB
Hard disk1 TB

When doing a 8-bit binary conversion, your smallest unit will always be on the right- always start from right to left 

Computer registers:

  • A computer register is a small but very fast piece of memory
  • It can have 8,16 or 32 bits
  • All calculations done by the computer are carried out in registers 

Digital displays:

  • A standard numeric display uses 7 or 8 segments 
  • Each segment is given a binary value
  • Based on the binary values, lights are switched on or off to create a recognisable number
  • A register of 8 bits is used to store and determine the state of each sediment (including the decimal point-0)
76543210
11011010

Registers in the industry:

  • Registers can also be used to hold the state of a machine
  • A robotic arm may have eight possible movements
  • The register values below extend and lower the arm whilst opening the claw 
  • An overflow error will occur if the value is greater than 255 in an 8-it register 
  • A computer or device has a predefined limit that it can represent or store, for eg 16 bit
  • An overflow error occurs when a value outside this limit should be returned 

HEXADECIMAL TABLE 

0=012=C6=618=I
1=113=D7=719=J
2=214=E8=820=K
3=315=F9=921=L
4=416=G10=A22=M
5=517=H11=B23=N
  1. Convert to its binary form
  2. Split 8-bit binary digits into 4-bit/ half 
  3. Calculate the denary equivalent for each 4-bit 
  4. Using the hexadecimal values, convert the denary values into hexadecimal 
  5. Eg:  convert 136 into hexadecimal: 
1286432168421
10001000

split into half:

84218421
10001000

8 8 = 88 in hexadecimal

Advantages of hexadecimal are that it is easier to read for humans than binary

Another advantage is that humans are prone to make mistakes. 

ASCII= American Standard Code for Information Interchange

It is a character set that allows machines to represent symbols, text, and numbers using binary code. 

  • ASCII (American Standard Code for Information Interchange) has become the standard code, used worldwide
  • It was originally developed in the 1960s to represent the English alphabet
  • It encodes 128 characters into 7-bit binary codes
  • Characters include numbers 0-9, uppercase and lowercase letters A-Z, a-z, punctuation symbols, and space characters 

Representing characters in binary:

  • Every character on the keyboard is represented by a binary value 
  • Uppercase letters have different values from lowercase characters
  • Punctuation symbols have their own characters

7- and 8-bit ASCII

  • Numerous different codes for representing characters have been invented, but ASCII is commonly used nowadays on PCs
  • Originally only 7 bits were used but now the eighth bit is used to give extra characters such as 

Working with string input”

IN python, two strings can be concatenated or joined together using the + symbol

3 types of errors:

  • The syntax error is grammatical errors in your program 
  • The logical error allows the program to run but you get an unexpected outcome 
  • Run time error displays that your system cannot handle the program you’re creating 

Unicode: It is an extended version of ASCII

Unicode was developed to use 16 bites (instead of 8) giving 65,536 possible combinations- enough to represent every character in every language.

  • Characters are represented using the ASCII code
  • Seven bits is enough to represent all the characters and symbols on an English keyboard
  • The extended 8-bit ASCII code allows for 128 extra special characters
  • You cannot do arithmetic on ASCII characters representing numbers- they must first be converted to pure binary numbers
  • Unicode provides a unique binary code for every character in every language

Still got a question? Leave a comment

Leave a comment

Post as “Anonymous”