120 likes | 263 Views
Objectives. Data Representation Binary number system Binary Coded Decimal (BCD) Boolean Values Analogue & Digital data Use of ASCII code Memory addressing. Data Representation. Character coding schemes ASCII, Unicode
E N D
Objectives • Data Representation • Binary number system • Binary Coded Decimal (BCD) • Boolean Values • Analogue & Digital data • Use of ASCII code • Memory addressing
Data Representation • Character coding schemesASCII, Unicode • Unicode – International 16-bit coding system which can represent 65536 different characters • Binary number system • Binary Coded Decimal (BCD)each decimal digit has its own 4-bit binary code • Boolean valuesonly True or False • Digitised soundMIDI • Bit-mapped graphics
Number systems • Denary system • ‘134’ represents one hundred, three tens and four ones. • 100 10 1 • 1 3 4 • = 100 + 30 + 4 = 134 • Binary system • 128 64 32 16 8 4 2 1 • 1 0 0 0 0 1 1 0 • = 128 + 4 + 2 = 134
Binary number system • Numbers can be represented in a computer in a number of different ways, e.g. 25 in ASCII would be: • 0011 0010 0011 0101 • Alternatively in pure binary draw a table of powers of 2. Then find the largest power of 2<=25 (16). Subtract 16 from 25 and repeat • Value 128 64 32 16 8 4 2 1 0 0 0 1 1 0 0 1 16 + 8 + 1 = 25 • To translate from binary to decimal perform same process backwards • Value 128 64 32 16 8 4 2 1 0 1 0 0 0 1 0 1 64 + 4 + 1 = 69
Binary Coded Decimal (BCD) • In the BCD system each decimal represented with own 4-bit binary code. • 3765 is coded as 0011 0111 0110 0101
Advantages & disadvantages of BCD • Advantage - ease of conversion from BCD to decimal and vice versa. • E.g. when binary numbers have to be decoded for a calculator display, a number held in BCD has simply to have each bit converted into decimal. • Another advantage - BCD does not “round” numbers - uses as many bits as reqd. • Disadvantage - calculations with BCD numbers are more complex. E.g adding 1 and 19 • 0000 0001 0001 1001 0001 1010 The first digit 1, is wrong and 1010 is an invalid code • Error occurs because only 10 out of 16 combinations of 4 bits used. Whenever sum greater than 9, 6 has to be added to result in order to skip over codes 0001 1010 0110 0010 0000 i.e. 20 in BCD which is correct
Boolean Values • A Boolean variable can only have one of two values, true or false • Represented by a 1 or a 0 • Useful to be able to use a binary bit to show if something is true or false, e.g: • To show whether a disk drive is connected • To show if the ‘break’ key is pressed’ • Single bits used in this way are called Flags
Analogue & Digital data • Almost everything in the world can be described or represented in one of two forms: analogue or digital. • Principal feature of analogue representations is that they are continuous. • Digital representations consist of values measured at discrete intervals. • Digital watches are digital because they go from one value to the next without displaying all intermediate values. Display a finite number of times of the day. • In contrast, watches with hands are analogue, because hands move continuously around the clock face.
Digitised sound • Sound can be input via microphone, CD or electronic keyboard with MIDI (Musical Interchange Digital Interface) • Since sound waves are continuously variable or Analogue – an analogue to digital converter is needed to transform analogue input into to a digital form, i.e. a binary pattern • Undesirable sounds such as scratches can be edited • Sound in analogue form can be represented by wave forms • Height of wave forms sampled at regular time intervals • Height may be represented by, say, a 16-bit code which is format used for standard audio, 8-bit slightly better than normal AM radio. • More frequently samples taken – better the sound quality
The ASCII code • Binary digit (1 or 0) • known as a ‘bit’, short for BInary digiT • bits generally grouped together in 8-bit bytes • a byte can hold 28 combinations of 0s and 1s • This means that, for example, 256 different characters can be represented.
Memory addressing • The memory of a computer can be thought of as a series of boxes, each containing 8 bits (1 byte), and each with its own unique address, counting from zero upwards. • Memory capacity is measured in thousand byte units Kb, Mb, Gb. • These are all powers of 2 thus although often thought of as being 1000 bytes, actually 1024 bytes. • 210 bytes = 1024 = 1Kb • 220 bytes = 1024 x 1024 = 1Mb • 230 bytes = 1024 x 1024 x 1024 = 1Gb