Followers

Monday 4 April 2011

Character Coding Schemes

ASCII
- Uses 7 bits so can therefore represent 128 different characters.
- A different binary number is assigned to each character.
Example- The letter A has a binary number assigned to it - 1000001
- Some of the characters are control codes, such as tab.
- The 8th bit is used usually for error checking.
- Extended ASCII uses the 8th bit in a byte to code more than characters, such as symbols like copyright and characters in french.
- Digits have different binary representations when they are stored as text rather than numbers.

Unicode
- Unicode represents characters using 16 bits instead of 8.
- Unicode provides a unique number for every character no matter what program or language.
- Extended ASCII is included in Unicode.
Example- The letter A is coded as 0000000001000001 in binary
                                                                            0041 in Unicode
                                                                                65 in denary

Error Checking and Correction
- Single Parity Bit - Is an extra bit.
                           - It is added to the pattern for error checking
                           - A computer system uses either a ODD bit parity or an EVEN bit parity
                           - In an odd bit parity the number of 1 bits are odd
                           - In an even bit parity the number of 1 bits are even
Example: Odd
  11001100
111001100
Example: Even
  110001000
1110001000

- If an ASCII character is transmitted using an even parity the reciever will check the parity after it has been transmitted.
- If the parity is odd then there has been an error in the transmission.






 

Sunday 27 March 2011

Binary and Hexadecimal Numbers

Bits and Bytes
- Storage locations in digital computers are built using electical circuits that can either have a high voltage or a low voltage.
- 0 represents a low voltage
- 1 represents a high voltage
- A byte is 8 bits together
- A word is a group of bytes

Denary
136 represented in denary is (1x100) + (3x10) + (6x1)

Coverting Binary to Denary
- Create a Binary table
- Write in the binary number from right to left
- Add up the values where a '1' is in the column.

Example:  01110101
128     64     32     16     8     4     2     1
  0        1       1       1      0     1     0     1

= 64+32+16+4+1
= 117

Converting Denary to Binary
- Create a Binary table
- Go from left to right making sure each number in the table is less than the number before
- Fill gaps with '0'

Example: 51
64     32     16     8     4     2     1
0        1       1      0     0     1     1

Adding Binary Numbers
- Put binary numbers into column method

Example:
     10011
     01011
=   11110  = 30

Rules of Adding Binary

0 + 0 = 0 (no carry)
0 + 1 = 1 (no carry)
1 + 0 = 1 (no carry)
1 + 1 = 10 (0 and carry 1)
1 + 1 + 1 = 11 (1 and carry 1)

Multiplying Binary
Example:
 110
x 11
= 1100

Binary Multiplication Method
1.Start on the second row at the left.
2.For each 1 you find you create a row below the bar with the number at the  top followed by the number of places to the right of the 1 you are considering.
3.Finally add all the rows below the bar – using binary addition rules
 
Converting Denary Negatives into Binary
- Find Binary equivalent to denary
- Change 0's to 1's and 1's to 0's
- Add one to the result
 
Example: -13
16     8     4     2     1
0       1     1     0     1 (binary equivalent)
1       0     0     1     0 (change 0's and 1's vice versa)
1       0     0     1     1 (add one)

 Converting Binary Negatives into Denary
- Put into binary table
- Convert 1's to 0's and 0's to 1's
- Add one to the result
-Convert to denary and place a negative sign in front

Example:  0100111
64     32     16     8     4      2     1
0        1       0      0     1      1     1 (binary in table)
1        0       1      1     0      0     0 (change 0's to 1's vice versa)
1        0       1      1     0      0     1 (add one to result)
= -89

Subtracting Binary
- Convert number to be subtracted  into a negative number and add them.

Hexadecimal
- Hexadecimal goes from denary 1 to denary 16.
- Hexadecimal goes from 1,2,3,4,5,6,7,8,9,A,B,C,D,E,F,10

Converting Denary to Hexadecimal
- Convert to binary
- Take each group of 4 and convert into hex

Example: 213
128     64     32     16     8     4     2     1
 1         1       0       1      0     1     0     1
1101 = 13 = D
0101 = 5 = 5
= D5

Decimals
- Create a binary table with a decimal place after 1
e.g.  32      16      8      4      2      1     .     0.5     0.25  etc.
       
Example

48.75
32     16     8     4     2     1     .     0.5      0.25
 1       1      0     0     0     0     .      1          1 

Sunday 13 March 2011

Finite State Machines

- Finite means countable.
- A FSM is a machine that consists of a fixed set of possible states.
- These states can be - Allowable inputs that change the state
                                 - Outputs that change the state back to the original.
- The outputs only depend on the current state.
- The current state depends on the history of the sequence of inputs.
- Many types of digital machines are FSMs.
- Each state is one step towards the solution of the problem.
- Increasing the clock rate of a computer enables it to solve problems more quickly.

State Transition Diagrams
- A ballpoint pen is an example of an FSM.
- It has a finite number of states - Ballpoint extended
                                                - Ballpoint retracted
- It has a set number of allowable inputs - Clicking the pens button
- It has a set of outputs - retracting or extending the ballpoint
-In the diagram it has two states 1 and 0 and two transitions indicated by curved arrows
- State 1 is the ballpoint being exteneded and State 0 is the ballpoint being retracted





State Transition Tables
- We can use a table that shows the state that follows for every state and every input.
Table for ballpoint pen


- One reason FSMs are so useful is that they can recognise sequences.
- An FSM with no outputs is called a Finite State Automaton FSA.
- FSAs have an initial state and one or more acceptingstates, or goal states.
- State transition diagrams use a special arrow to indicate the inital state.
- A double circle is used to indicate the accepting state, or goal state.

Decision Tables
- A decision table is a precise yet compact way to model a complicated logic.
- Decision tables make it easy to observe that all possible conditions are accounted for.

Example
If X is greater than 6 and Y is less than 7 - then output "pass"
                                                              - else output "false"

Tuesday 1 March 2011

The System Life Cycle

The System Life Cycle makes it less likely for a project to fail. There are five stages within the cycle that help to reduce failures. Formal procedures are essential to make sure that everyone involved can contribute and can give a solution to the problem. Any system will eventually cease and the whole process will start again.

Phase One: Analysis
- Specification of the product - what is it's purpose?
                                             - Who will be using it?
- Research - Interviews
                 - Observations
                 - Questionnaires
                 - Examination of Documentation
- The result of the analysis stage is a requirements specification with system objectives.

Phase Two: Design
- A good design will be detailed enough for specialists to produce the system the way that the designer wanted.
- System Components need to be specified within the design
              - Hardware
              - Software
              - Data Files
              - User Interface
              - Required Inputs
              - Required Outputs
              - Manual Procedures
              - Test Plan
- A final specification is produced and a final design is produced.

Phase Three: Implementation
- Involves - Development of Software
                - Installation of Hardware
                - Installation of Software
                - Preparation of Data Files
                - Training people to use interface
                - Writing the system documentation
- This phase is mainly for making sure that people can use the system without and difficulty.

Phase Four: Testing
- During program design and writing a large amount of time is spent of testing the product.
- When the parts are put together and the software is installed; the whole system needs to be tested before it goes live.
- It also makes sure that the people trained to use the product can with the software installed.

Phase Five: Evaluation
- When the system is fully operational, evaluation needs to be carried out to see what can be improved and to see whether the customer is satisfied.
- Some questions that are asked - Does the system meet the specifications?
                                                 - Is it effective for solving the original problem?
                                                 - Can users operate the system without mistakes?
                                                 - Can users work without stressful conditions with the system?

In the future software is updated. This is so that errors and bugs can be fixed as soon as they are discovered. Users may change their requirements so software has to be updated with the new specifications.

Saturday 12 February 2011

Representing Sound

Sound
- Sound is an air pressure wave that is sensed by our ears.
- Can either be analogue or digital.
- Analogue sounds are when pressure waves are captured by a transducer and produces an electrical current which varies with the sound pressure.
- The electrical signal produced can be transmitted by telephone, over the radio and can be preserved on magnetic tape.
- At the other end when being broadcasted or transmitted by telephone the electrical signal is used to re-create sound via vibrations.
- The higher the pitch of the sound the more rapid the vibration.
- A pure tone is a regular sine wave, but when two waves get put together they superpose meaning you then get a pulsating tone.
- Today most sound systems are digital.
- The electrical signal from the transducer is converted in to a digital signal meaning it is represented by binary (1's and 0's)

Analogue to Digital Conversion (ADC) and Digital to Analogue (DAC)
- Converts an anologue signal into an equivalent digital signal.
- A computer may be used to record sound, but first the sound must be converted into digital form.
- The analogue signal is sampled.
- Sampling is when a wave is measured at regular time intervals and then rounded to the nearest binary value.
- To play back sound the signal must be converted back to analogue.
- The technique to do this is called pulse code modulation.

Pulse Code Modulation (PCM)
- Samples of the analogue signal are taken at regular intervals of time.
- The sampling frequency or rate must be at least twice the highest frequency in the anologue signal.
- These samples are represented as narrow pulses of height which are proportional to the value of the original signal.
- This process is known as Pulse Amplitude Modulation (PAM)
- To produce PCM data, the PAM samples are quantised, meaning they are rounded to the nearest whole number.

Nyquist's Theorem
- We Must Sample At A Frequency At Least Twice The Rate Of The Highest Frequency In The Sampled Signal.

Storing Sound In Files
- One of the most notable sound formats is WAV (supported by most Operating Systems)
- WAV requires 2.5 MB of memory for one minute of sound.
- WAV is commonly used when storing music and sound to CDs.
- Most common nowadays is the MPEG format, this can be mp2, mp3 or mp4.
- MPEG compresses the sound file by 10% of what WAV does.
- 1 min in WAV = 2.5 MB   -   1 min of mp3 = 0.25 MB
- MPEG also removes frequencies that the ear and brain cannot detect.

Editing Sound
- When sound is stored digitally on a computer for example, the sound can be modified allowing the user to mix multiple sources and add effects.
- When a sound is edited it can be saved as a single sound file.

Synthesising Sound
- Musical Information Digital Interface does not store sound waves but stores a digital representation of the sound.
- It takes note of the notes to be played, the instrument being played and how long a note and intrument is played for.
- The resulting form is that it is very compact.
- It can easily be transposed and played on different instruments.
- Musical Information Digital Interface is also known as MIDI.

Streaming Audio
- When you stream audio the server sends it bit by bit.
- The client buffers it and plays it when it has enough bits to keep on playing and buffering at the same time.
- Advantages - No need to download the file
                     - Saves harddrive space
                     - Makes copying harder
Disadvantages - Cannot listen when disconnected
                       - Can be affected by bandwidth

Tuesday 1 February 2011

Representing Images

Bitmapped Graphics
- An image is divided into a grid of pixels.
- Each pixel in a grid cell is sampled and is then assigned a Binary Code to represent the average colour of the grid cell.
- The Binary Codes are then used to produce a copy of the original image.

Memory Bitmaps
- The Binary Codes of each pixel are stored in memory when an image is scanned.
- The image is displayed on a Visual Display Unit by transferring the Binary Codes back into the memory.
- Bitmap is used because the pixels of an image are mapped to specific positions in memory

Resolution
- The resolution of a Visual Display Unit is usually expressed by the # of pixels per row x # of pixels per column
- It is not the number of pixels that determines the sharpness of the image but the size of the pixels.
- For a sharper image the pixels need to be smaller.
- A small image size containing a high number of pixels is going to produce the sharpest image.

Colour Depth
- The number of bits used to represent the greyscale value of a pixel is called the image depth.
- The colour of a pixel can be coded using the RGB colour model.
- The RGB model mixes Red, Green and Blue to produce a specific colour.

1-Bit Colour
- A black and white image is known as a monochrome image.
- One bit is allocated to each pixel
- To get a white pixel the binary value is 1
- To get a black pixel the binary value is 0

12-Bit Colour
- 4 bits are allocated to each RGB components
- As 4 bits are allowed then 4096 different colours are available.
- This coulour depth is used most often when there is little colour needed, such as on a mobile phone

True Colour
- 24-Bit true colour images use 8 bits for each RGB component
- Having 8 bits for each component there are 256 different alternate colours
- When the colours are combined they give a total of over 16 million different colours

Vector Graphics
- Instead of dividing a graphic image into pixels a vector graphic identifies the objects that make up the image.
- Vector Graphics record information about these objects to define the image.
- Vector drawing software uses the commands that create objects as the source of information needed to describe the graphic.

Comparing Bitmaps and Vectors
- When a bitmap is scaled it is enlarged.
- As the magnification increases the vixels become more visible.
- Vector graphics avoid distortion because scaling is applied to a line's endpoint.
- Vector graphics do not deal with pixels.
- You do not lose resolution when you enlarge a true vector drawing.

Advantages and Disadvantages
- Geometric images require fewer bytes in vector graphic format than in a bitmap format.
- Images that have continuous areas of colour (such as photographs) take up fewer bytes in bitmap format than in vector.
- Geometric images load faster from secondary storage and download faster over the internet in a vectot graphic format.
- Vector graphics scale without distortion whereas bitmap does.

Compression
Run Length Encoding
-Single Compression technique that takes into account the fact that some images have long runs of pixels.
-If three or more consecutive cells have the same bit pattern then a run of cells has been found and can be encoded by two bytes.
-First byte stores the number of consecutive memory cell bytes and second byte stores the colour code.
-It is a loseless compression technique.
-Decompressing the Run Length Recording image produces an exact original image.

Lossy Compression
-Discards information that is not necessary such as a background scene.
-Decompressing an image with the Lossy technique produces a different image compared to the original.
-As the human eye is not so good at recognising exact strengths of brightness variation allowing it to be possible to highly reduce the information of the high frequency components.