Computer science
Binary
• Base 2
• 2, 4, 8, 16, 32, etc.
• Goes from right to left
• Each “digit” is a bit
• Each bit has to be 1 (on) or 0 (o )
• Used in computers (transistors)
• Byte = 8 bits
• Nibble = 4 bits
• Converting denary to binary
• Subtract the biggest digit possible which ts in the number
• Example: 12 into Binary:
Adding binary:
• You stack the two binary numbers one on top of the other
• Di erent combinations
• 1, 0 = 1
• 0, 1 = 1
• 0, 0 = 0
• 1, 1 = 0
• You have to transport the remainder to the following bit
• If it is 0, 1 = 0 - remainder 1
• 1, 0 = 0 - remainder 1
• 1, 1 = 1 - remainder 1
• 0, 0 = 1 - remainder 0
ff ff fi
,Hexadecimal
Coverting binary to hexadecimal:
Uses of hexadecimal:
• Error codes
• The Hexadecimal number speci es the memory location of the error
• It is used to shorten the text
• Binary numbers take up almost all the screen
• Easy to convert hexadecimal to binary
• Hard to convert decimal to binary
• MAC Addresses
• Media access control address (MAC)
• Unique code to identify devices to other devices on the same network
• Often referred to as physical address
• MAC address is a 48 bit binary value
• Hexadecimal is used to shorten it 12 values
• IPv6 addresses
• IP (internet protocol) is referred to as internet address
• IPv6 allows data transmission and communication to be done over the internet
• IPv6 is a 128 bit binary code
• Hexadecimal is used to shorten the digit (32 digits)
• IPv6 is the new version of IPv4 (32 bit code)
fi
, • HTML colour codes
• Hyper text markup language (HTML) is used to design webpages
• Can be associated with CSS
• HTML colour codes are written in Hexadecimal
• Each value is a di erent shade
• RGB is used to create the colour
• Red - Green - Blue
Over ow
• Happens when adding two binary numbers (not always)
• When the sum of the two binary numbers is more than their registers
• Ex.
2s Compliment:
• In an 8 bit register the rst bit is -128
• The range is -128 <—> 127
• 1 = negative
• 0 = positive
Logical binary shifts:
• Moving bits left or right
• “<<“ is the symbol to move bits to the left
• “>>” is the symbol to move bits to the right
• Gaps are lled using 0s
• Ex.
flfi ff fi
, Barcodes
• Is a series of black and white lines varying in thickness
• The digits 0 to 9 represent the di erent series of lines
• Each digit is made up of 2 dark and 2 white lines
• Barcodes are divided in two by guard bars
• On the left the sum of dark lines is odd and start with a light line and on the right there is the
opposite
• Process when scanning a barcode
• Red light is shined on the barcode
• Sensors detect light that is being re ected o the barcode (light lines re ect light whilst the
black ones don’t)
• Once it has been scanned the pattern is generated and converted into digital data
• Barcode number (key eld) is looked up in stock database
• Price is immediately found and the number of stock items is reduced by 1
Quick response code (QR)
• Type of barcode
• Consists of a block of small squares (light and dark) known as pixels
• It can hold up to 4296 characters
• Hold much more information than normal barcodes
• Composition of QR code
• Three large squared at the corners -> function for alignment
• The other small square is used for correct angle and size
• Process of scanning QR code
• Phone takes a picture of QR code and processes the squares into readable data
• The user is then sent to any websites automatically
• Advantages in comparison to normal barcodes
• Hold much more information
• Fewer errors
• There is a built-in error checking system
• Easy to read
• Newer QR codes also include the logo of the company at the centre
Digital camera
• Are controlled by an embedded system which can automatically carry out various tasks
• Adjust shutter speed
• Focus the image
• Flash gun
• Process of taking a picture
• The picture is taken when light passes through a lens onto a sensitive cell made by sensors
• Each of the sensors are often referred to as pixels
fi ff fl ff fl
Binary
• Base 2
• 2, 4, 8, 16, 32, etc.
• Goes from right to left
• Each “digit” is a bit
• Each bit has to be 1 (on) or 0 (o )
• Used in computers (transistors)
• Byte = 8 bits
• Nibble = 4 bits
• Converting denary to binary
• Subtract the biggest digit possible which ts in the number
• Example: 12 into Binary:
Adding binary:
• You stack the two binary numbers one on top of the other
• Di erent combinations
• 1, 0 = 1
• 0, 1 = 1
• 0, 0 = 0
• 1, 1 = 0
• You have to transport the remainder to the following bit
• If it is 0, 1 = 0 - remainder 1
• 1, 0 = 0 - remainder 1
• 1, 1 = 1 - remainder 1
• 0, 0 = 1 - remainder 0
ff ff fi
,Hexadecimal
Coverting binary to hexadecimal:
Uses of hexadecimal:
• Error codes
• The Hexadecimal number speci es the memory location of the error
• It is used to shorten the text
• Binary numbers take up almost all the screen
• Easy to convert hexadecimal to binary
• Hard to convert decimal to binary
• MAC Addresses
• Media access control address (MAC)
• Unique code to identify devices to other devices on the same network
• Often referred to as physical address
• MAC address is a 48 bit binary value
• Hexadecimal is used to shorten it 12 values
• IPv6 addresses
• IP (internet protocol) is referred to as internet address
• IPv6 allows data transmission and communication to be done over the internet
• IPv6 is a 128 bit binary code
• Hexadecimal is used to shorten the digit (32 digits)
• IPv6 is the new version of IPv4 (32 bit code)
fi
, • HTML colour codes
• Hyper text markup language (HTML) is used to design webpages
• Can be associated with CSS
• HTML colour codes are written in Hexadecimal
• Each value is a di erent shade
• RGB is used to create the colour
• Red - Green - Blue
Over ow
• Happens when adding two binary numbers (not always)
• When the sum of the two binary numbers is more than their registers
• Ex.
2s Compliment:
• In an 8 bit register the rst bit is -128
• The range is -128 <—> 127
• 1 = negative
• 0 = positive
Logical binary shifts:
• Moving bits left or right
• “<<“ is the symbol to move bits to the left
• “>>” is the symbol to move bits to the right
• Gaps are lled using 0s
• Ex.
flfi ff fi
, Barcodes
• Is a series of black and white lines varying in thickness
• The digits 0 to 9 represent the di erent series of lines
• Each digit is made up of 2 dark and 2 white lines
• Barcodes are divided in two by guard bars
• On the left the sum of dark lines is odd and start with a light line and on the right there is the
opposite
• Process when scanning a barcode
• Red light is shined on the barcode
• Sensors detect light that is being re ected o the barcode (light lines re ect light whilst the
black ones don’t)
• Once it has been scanned the pattern is generated and converted into digital data
• Barcode number (key eld) is looked up in stock database
• Price is immediately found and the number of stock items is reduced by 1
Quick response code (QR)
• Type of barcode
• Consists of a block of small squares (light and dark) known as pixels
• It can hold up to 4296 characters
• Hold much more information than normal barcodes
• Composition of QR code
• Three large squared at the corners -> function for alignment
• The other small square is used for correct angle and size
• Process of scanning QR code
• Phone takes a picture of QR code and processes the squares into readable data
• The user is then sent to any websites automatically
• Advantages in comparison to normal barcodes
• Hold much more information
• Fewer errors
• There is a built-in error checking system
• Easy to read
• Newer QR codes also include the logo of the company at the centre
Digital camera
• Are controlled by an embedded system which can automatically carry out various tasks
• Adjust shutter speed
• Focus the image
• Flash gun
• Process of taking a picture
• The picture is taken when light passes through a lens onto a sensitive cell made by sensors
• Each of the sensors are often referred to as pixels
fi ff fl ff fl