Chapter I : Data representation

∗Data representation∗

binary-2450188_1280.jpg

Computers cannot use analogue ( datas that our senses can process). However, they use digital data made up of binary digits.



Binary systems

  • Denary uses numbers with a base of 10 (uses ten digits from 0 – 9) and increases using the power of 10
  • Binary uses numbers with a base of 2 (1 and 0, 1 being on and 0 is off)

code-1785541_1280.jpg


How do you convert denary to binary?

  1. You can use a table to change denary to 8-bit binary. We use 1, 2, 4, 8, 16, 32, 64, 128 (increases by the power of 2)
large
8-bit binary table

The numbers below are actually binary.

 0 0 0 0 0 0 0 1 is equal to 1. We need to add all the units that are marked as the digit 1 not 0.

So 00000011 is equal to 3

2. Another method you could use is successive division by 2

Take a number; for example 50.

The first column is the division column where you divide the number by 2 while the second column is the remainder of the first column.

50 is an even number which means when you divide it by 2, there is no remainder. The second step is 25, this is an odd number so when you divide it by 2, it becomes 1

Screen Shot 2560-08-27 at 3.31.11 PM
Successive division table

2.5. Which means there is 1 remainder, you put the 1 next to 12. And you divide it so on until you reach 0.

We read it from top to bottom so it becomes 110010. However, it is still not quite complete, this is not an 8-bit binary, there are 6 bits so you add 2 0s in front. The final outcome becomes 00110010

When you put this in a table it will become:

Screen Shot 2560-08-27 at 3.49.12 PM.png
32+16+2 = 50!

 

 

 


Beyond 8-bit binary

There are tables beyond 8-bit binary for example the 12-bit binary table which is quite long and able to calculate much larger numbers. Screen Shot 2560-08-27 at 3.55.35 PM.png

2048+512+256+32+8+4+1 = 2861

 


Binary controlled robots

Are actually robots that are controlled by binary. Computer are used to program many devices and even robots (vacuum cleaner). Which uses three wheels A, B and C. Wheels B and C are connected with motors. They used to control the movement – forwards and backwards.

robot-2178590_960_720.jpg


Memory size

These are storage (measured in bytes) in most computer systems.

Screen Shot 2560-08-27 at 4.15.41 PM.png
Followed by petabyte

Computer registers

Is a memory location in the CPU.

Found in microprocessors (limited functionality, doesn’t need to have an operating systems which has lots of functions).

board-electronics-computer-data-processing-50711.jpeg



Hexadecimal

We use hexadecimal rather than binary because it is easier to read. Hexadecimal uses numbers with a base of 16. Computer usually convert hexadecimal data to binary before executing a data.

Hexadecimal is used in software to help trace errors e.g. memory dump

Screen Shot 2560-08-27 at 4.26.55 PM.png

This uses 0-9 and A-F (alphanumeric). Each unit increases by the power of 16. The first number of base 16 is 16 to the power of 0 and so on.


How do you convert denary and hexadecimal?

Screen Shot 2560-08-28 at 6.02.44 PM.png

11}0110}1111}0011

and add 00 onto the front to become 0011}0110}1111}0011

We split the binary numbers into 4 bits (a nibble). Now to work out this into a hexadecimal.

Screen Shot 2560-08-31 at 2.45.57 PM.png

Hexadecimal is used in mac address and colours.

-A mac address is a permanent address that identifies a device when connected to the internet. (media access control)

-An IP address is the location/address of the device on an internet



Data storage

Image conversions

In ASCII, each character is made up of 8 bits. It includes capital letters, small case letters, numbers, punctuation.

We use ADC (analogue digital converter) but computers use DAC to understand. Images are made up of pixels, if a picture was just black and white. Computers will convert text, images and sound into binary to process and store them. 1 would be black and 0 would be white.

If we use binary data, we need to know the dimensions of the grid used to produce an image, it is called metadata (tells us how many pixels high/wide and image should be)

pizza.png

Screen Shot 2560-09-14 at 2.41.03 PM.png
Pixelated from a pizza

If we want a picture to have colours, the computer needs further binary data. Most colours are made up of RGB or CMYK.


Sound conversions

Sound is an analogue. Sampling is used to convert analogue sounds to digital. Sample sizes are measured in hertz. 1 hertz = 1 sample per second.

  • Music is sampled at 44100Hz, 32000Hz, 48000Hz . A voice samples at 8000Hz.

Raw analogue sounds will decrease by 90% when converted from analogue to digital.

File size = sampling rate x sample resolution x length of sound

500px-CPT-sound-physical-manifestation.svg.png


Languages

High level language – language similar to ASCII/human

Low level language – language closer to computers

Machine code – binary numbers

Assembly language – language uses mnemonic code to create programs

ASCII codes are used to represent web address (URL). But computers do not understand them so they are programmed using hexadecimal.

Hexadecimal used as a security feature in websites, users can type in the URL using hexadecimal characters, this ensures website address is genuine.

We use A-Z, a-z, % and space.


Compression 

Data compression reduces the file size. File formats are used to store computer

Lossless – used with text files (won’t remove duplicated characters)

Lossy– used with MP4, MP3 files (removes similar sounds or colour)

e.g.

.doc (Microsoft word document/text)

.mp4 (MPEG-4 video file)

.png (portable network graphic/images)

.mp3 (audio file – lossy compression)

.bmp (bitmap file – image file format that contains bitmap graphic data

.mid (Musical Instrument digital interface /MIDI file – raw analog file that has been recorded, normally converter into mp3, compressed around 90%)

CSV (comma separated value – data is separated by commas)

Data dictionary contains a list of files in database, records in each files including names/types.