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
File | Size |
One character of text | 1 byte |
A full page of text | 30 KB |
One small digital colour photograph | 3 MB |
Music CD | 600 MB |
A DVD | 4.5 GB |
Hard disk | 1 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)
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
1 | 1 | 0 | 1 | 1 | 0 | 1 | 0 |
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 | = | 0 | 12 | = | C | 6 | = | 6 | 18 | = | I |
1 | = | 1 | 13 | = | D | 7 | = | 7 | 19 | = | J |
2 | = | 2 | 14 | = | E | 8 | = | 8 | 20 | = | K |
3 | = | 3 | 15 | = | F | 9 | = | 9 | 21 | = | L |
4 | = | 4 | 16 | = | G | 10 | = | A | 22 | = | M |
5 | = | 5 | 17 | = | H | 11 | = | B | 23 | = | N |
- Convert to its binary form
- Split 8-bit binary digits into 4-bit/ half
- Calculate the denary equivalent for each 4-bit
- Using the hexadecimal values, convert the denary values into hexadecimal
- Eg: convert 136 into hexadecimal:
128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 |
split into half:
8 | 4 | 2 | 1 | 8 | 4 | 2 | 1 | |
1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 |
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