Standard Grade Technological Studies - PowerPoint PPT Presentation

Loading...

PPT – Standard Grade Technological Studies PowerPoint presentation | free to download - id: 744acb-YWU1M



Loading


The Adobe Flash plugin is needed to view this content

Get the plugin now

View by Category
About This Presentation
Title:

Standard Grade Technological Studies

Description:

Title: PowerPoint Presentation Author: Pre-installed User Last modified by: stg Created Date: 4/28/2003 10:46:44 AM Document presentation format: A4 Paper (210x297 mm) – PowerPoint PPT presentation

Number of Views:20
Avg rating:3.0/5.0
Slides: 36
Provided by: Preins183
Learn more at: http://www.thursohightechnologies.com
Category:

less

Write a Comment
User Comments (0)
Transcript and Presenter's Notes

Title: Standard Grade Technological Studies


1
Standard Grade Technological Studies Summary
Notes Compiled By Mr. A. Cunningham May
04 An acknowledgement must go to the
authors of the LT Scotland Support Notes for the
Technological Studies course, as some of the
diagrams and text has been used from these notes
in this document.
2
Contents    
3
Standard Grade Technological StudiesSystems
Summary Notes
The Universal System All systems can be analysed
in terms of input, process and output. A diagram
called the universal system diagram consists of
these three basic elements.
Sub-Systems The sub-system diagram shows the
internal detail of the system. Each box, called a
sub-system, can be thought of as a system within
a system and has its own input and output. The
dashed line around the sub-system is called a
system boundary and this marks the area of
interest to us. The real world input and output
are shown as arrows entering and leaving the
sub-system diagram.
Positional control used to control the exact
position of an object/machine. Used in robotic
arms to ensure arm rotates to the correct
place. Sequential Control Systems  Sequential
control is used where the outputs are required to
follow a fixed cycle of events that is to switch
on or off in a particular sequence
Open Closed Loop Control Systems Open loop
systems are the simplest of systems. They take
in an input, process it and produce an output.
They do not use sensors or feedback to try and
alter what the system is doing. Closed-loop
control is a more accurate system of control and
at the same time more expensive. It employs
self-monitoring, where a sensor is used to read
the condition being controlled and adjust the
output if necessary. This monitoring takes place
through a feedback loop. Here an input sensor
checks the output and adjusts it when it does not
meet the requirements.
4
More On Open Closed Loop Control Systems In
closed-loop control the value of the output is
constantly monitored as the system operates and
this value is compared with the set (or
reference) value. If there is any difference
between the actual value and the set value (an
error), then the input to the system is varied in
order to reduce the output error to zero. A
closed-loop system can always be identified by
the presence of a feedback loop.   An open-loop
system never has a feedback loop.
The diagram shows a control diagram for a typical
closed loop system. The error detector takes in
two signals one form the temperature sensor
(feedback sensor) and one from the set level. It
subtracts one from the other. If there is any
difference and error signal is produced. This is
passed to the control sub-system which will
decide how much to turn the heater on. This is
called negative feedback and is typical in closed
loop systems. The graph below shows how the Set
Level and Actual level compare in the system
above.
5
Standard Grade Technological Studies Pneumatic
Systems Summary Sheets
  • Safety
  • Learn all the safety rules, e.g.
  • Wear safety goggles
  • Dont blow air at anyone, not ever yourself
  • Dont let compressed air come in contact with
    your skin
  • Check all connections are secure before turning
    on the air
  • Dont leave pipes trailing along the floor
  • Advantages of Pneumatic System
  • Clean
  • Pneumatic systems are clean because they use
    compressed air. If a pneumatic system develops a
    leak, it will be air that escapes and not oil.  
  • Safe
  • Pneumatic systems are very safe compared to other
    systems. We cannot, for example, use electronics
    for paint spraying because many electronic
    components produce sparks.  
  • Reliable
  • Pneumatic systems are very reliable and can keep
    working for a long time.  
  • Economical
  • If we compare pneumatic systems to other systems,
    we find that they are cheaper to run. This is
    because the components last for a long time.
  • Flexible
  • Once you have bought the basic components, you
    can set them up to carry out different tasks.

6
Describing How A Circuit Works You will be asked
to name components in circuits and describe how
the circuits operate. In the General paper, you
will only be given either AND control or OR
control style circuits. At Credit level you will
usually be given a sequential circuit (one which
follows a particular sequence). A few examples
are shown below
AND CONTROL
OR CONTROL
In order to get the single acting cylinder to
outstroke, you need to actuate valve A AND valve
B.
Shuttle valve
Valve A
Valve B
The cylinder will outstroke if valve A OR valve B
is actuated.
Could you describe how this circuit works?
ANSWER When the push button is pressed, the 5/2
valve changes state and the cylinder outstrokes.
As it outstrokes, it pushes the former together
and the hot plastic sheet is pressed into shape.
As this happens it also actuates the roller. Air
now flows through the restrictor and starts to
fill up the reservoir. Once the reservoir is
full, the 5/2 valve changes state and the
cylinder instrokes, ready for the process to
begin again.
7
Completing Circuits You can be given a pneumatic
circuit and be asked to finish the piping to a
given specification. If you want to do well in
these questions, start by learning where the
pipes go to basic valves. Try adding the piping
to the circuits below.
Exam Questions You must practise answering lots
of Pneumatics questions with circuits to get a
feel for the level of difficulty and the types of
question you could be asked. There is no
substitute for hard work Im afraid!
Air Bleed Circuits They use a diaphragm valve.
When the air tube is blocked the air can no
longer escape and is forced into the diaphragm
valve which changes state and causes the cylinder
to outstroke.
Answers
8
Calculations All the formulas you need for
pneumatics are given in the data booklet. (An
extract is shown below)
  • Force in a single acting cylinder on Outstroke
    (Easiest calculation)
  • You will get the air pressure, P and the piston
    diameter, d.
  • Use d to get the area, a. You can either use
    or use a?r2 and ½ d to get r. Then
    you just use FP x a to find the force.
  • Try these questions
  • Find the force for the pressures and diameters
    given
  • P0.3N/mm2, d12mm
  • P0.5N/mm2, d23mm
  • Force in a double acting cylinder on Outstroke
    Instroke
  • The outstroke calculation is the same as for the
    single acting cylinder.
  • To find the instroke force you need to work out
    effective area of the cylinder. ( remember there
    is less surface area on the instroking side of
    the piston because of the space taken up by the
    piston rod so the force is always less than the
    outstroke force.)
  • Effective area piston area piston rod area
  • Once you work this out simply use it with the FP
    x a formula to find the force.
  • Try these questions
  • Find the instroke force for the pressures and
    diameters given
  • P0.4N/mm2, piston diameter 15mm, piston rod
    diameter 4mm
  • P0.8N/mm2, piston diameter 20mm, piston rod
    diameter 3mm

Answers Single acting 1) 33.9N 2) 208N
Double acting 1) 65.8N 2) 246N
9
Standard Grade Technological StudiesModular
Electronics Summary Notes
  • Analogue and digital signals
  • All components in electrical and electronic
    circuits are either receiving or transmitting
    electrical signals. These signals can be either
    analogue or digital.
  • Analogue devices
  • An analogue signal varies according to the
    physical surroundings. For example, the EL
    light-sensing unit will send out a voltage that
    is proportional to the amount of light falling on
    the LDR.
  • Typical analogue input transducers are
  • input voltage units
  • light-sensing units
  • temperate-sensing units
  • moisture/rain sensor units
  • sound-sensing units.
  • Digital devices
  • A digital signal is one which has only two
    settings, on or off. In electronic terms it has
    only two levels, high or low.
  •  
  • The push switch unit is a typical simple digital
    transducer.

Output transducers  Output transducers take an
electrical signal and change it into a physical
output. They include the output boards in modular
systems or output components in any electronic
system. Examples Bulb Unit, Motor Unit, Solenoid,
Relay Buzzer
Sub-Systems Boards You need to know what the
following boards can be used for and how they can
be linked together to produce a
system. Transducer Driver, Switch unit, light
sensor, temperature sensor, moisture sensor,
latch, comparator, transducer driver, buzzer,
lamp, d.c. motor and solenoid (including
actuating 3/2 valve). AND, OR, INVERTER(NOT),
NAND NOR Remember all systems will start with
an input sensor board (light, temperature,etc)
and end with a transducer driver followed by an
output transducer, e.g. a Motor, Buzzer, etc.
Relays You must be able to complete a diagram
showing a system with a relay, a motor and a
separate power supply.
Remember relays are used to switch on higher
powered circuits using low power control circuits.
10
(No Transcript)
11
(No Transcript)
12
(No Transcript)
13
(No Transcript)
14
Standard Grade Technological StudiesLogic
Electronics Summary Notes
Logic Gates Truth Tables You must learn the
symbols, truth tables and Boolean expressions for
the logic gates shown
NOT
Z



A
Z



A
.
B
AND
Z



A

B
OR
A
.
B
Z



NAND
A

B
Z



NOR

XOR
15
Boolean Expressions from truth tables You must be
able to take a truth table and produce Boolean
expressions from it.
A B C Z
0 0 0 0
0 0 1 0
0 1 0 0
0 1 1 0
1 0 0 0
1 0 1 1
1 1 0 0
1 1 1 1
  • Steps to follow
  • Find the 1s in the Z column
  • Write the Boolean expression for each 1, e.g. Z
    A.B.C
  • Write the expressions out in words, e.g. Z ( A
    AND NOT B AND C) OR (A AND B AND C)
  • Write out the inputs, e.g. A , B C
  • Draw in any NOT gates
  • Draw in the AND gates
  • Finally draw in the OR gates if required

ZA . B . C
ZA . B . C
Z (A AND NOT B AND C) OR (A AND B AND C)
NAND Equivalents
16
Pin-out Diagrams Drawing Circuits You must be
able to select suitable logic ICs (chips) and
draw in the connections for a given logic system.
An example is given below. Dont forget to draw
in the connections for Vcc ( the positive supply
voltage) and 0v.
Vcc

V
c
c

V
c
c
1
4
1
3
1
2
1
1
1
0
9
8
1
4
1
3
1
2
1
1
1
0
9
8
7432
7408
2
1
3
4
5
6
7
2
1
3
4
5
6
7
G
n
d
G
n
d
(
0
V
)
(
0
V
)
Input A
O
U
T
P
U
T
Input B

0v
Remember you dont need to use all the logic
gates in a chip if you only need one, you only
use one!
  • Drawing Logic Diagrams form Written Descriptions
  • You have two choices here to solve this type of
    problem
  • Try to draw a diagram out straight away from what
    you have been told, or
  • Draw a truth table out for the problem and then
    go through the process outlined on the previous
    page for turning a truth table into a logic
    diagram.
  • The choice you make depends on the difficulty of
    the system. See over for an example.

17
  • Logic Diagram from a Written Description
    Example
  • A machine (M) is to start under the following
    conditions
  • The guard is down ( Guard Down G1, Guard Up
    G0)
  • The operator is sitting on the seat ( On seat
    S1, Not on seat S0)
  • Either the fast button or the slow button is
    pressed ( FST Fast, SL Slow)
  • The machine temperature is low ( Temp Low T0,
    Temp High T1)
  • The logic diagram can be produced by simply
    reading the specification. We know that all the
    4 conditions must be true before the machine will
    start so we will need a 4 input AND gate.
    There are 5 inputs in total G, S, FST, SL T.
    The FST SL inputs need to go through an OR gate
    because we are told that only one needs to be
    pressed and the temperature input must go through
    a NOT gate so that we will get a 1 out from it
    when it is low.
  • Diagram
  • Draw the inputs on the LHS first
    Next add in any OR or NOT gates
    And finally add the AND gate
  • G
  • S
  • FST

M
18
Standard Grade Technological Studies Mechanical
Systems Summary Sheets
Types of Motion Rotary Turning in a circle. This
is the most common type of movement, for example
wheels, clock hands, compact discs,
CD-ROMs. Linear Movement in a straight line, for
example movement of a paper trimmer cutting a
straight edge on paper or a lift moving between
floors. Reciprocating Backwards and forwards
movement in a straight line, for example the
needle in a sewing machine or the piston in a car
engine. Oscillating Swinging backwards and
forwards in an arc, for example the pendulum of a
clock, a playground swing or a rocking horse.
Levers Levers can be used as force multipliers or
distance multipliers. A force multiplier allows
you to get a large force out for a small force
in. A distance multiplier allows you to get a
large distance out for a small distance
in. Mechanical Advantage (MA)
Load Effort Velocity Ratio (VR) Distance
Effort is moved Distance Load is
moved Efficiency ? MA X 100 VR
19
Moments A moment is a turning effect. Moment
Force x Distance If a body is in equilibrium the
sum of the clockwise moments must equal the sum
of the anticlockwise moments. Or ?CWM ?ACWM F1?
d1 F2 ? d2 This can apply to straight lever,
angled levers and beams.
Free-body diagrams This is a diagram showing all
the forces acting on a body. Example draw a
free-body diagram representing the forces acting
on the fork-lift truck. R1 R2 are the
reaction forces. They push up to balance the
forces pushing down due to the weight of the
truck and its load. Another condition of
equilibrium is ?upwards forces ?downwards
forces This is used with the principle of moments
to calculate reaction forces in structures.
20
  • Free-body example
  • Draw a free-body diagram for the car
  • Calculate the reaction forces R1 and R2.

9.5kN
1m
1.5m
R2
R1
Take the moments about R1 (just think about it as
being like a pivot) ?CWM ?ACWM F1? d1 F2 ?
d2 9.5k x 1.5 R2 x 2.5 R2 14250 ? 2.5 R2
5700N Now use ?upwards forces ?downwards
forces R1 R2 9.5kN R1 5700 9500 R1 9500
5700 R1 3800N
 
21
Gears Gears are toothed wheels designed to
transmit rotary motion and power from one part of
a mechanism to another. Gears are used to
increase or decrease the output speed of a
mechanism and can also be used to change the
direction of motion of the output. Gear Ratios
In the simple gear train above the gear ratio
would be If gear A is still rotating at 100 rpm
in a clockwise direction then gear B will now
rotate at 50 rpm in an anticlockwise direction.
Idler gears To get the driven gear to rotate in
the same direction as the driver, a third gear is
inserted in the system. This idler gear has no
effect on the gear ratio of the system. The size
of the idler is not important and is normally a
small gear.
22
Ratchet and pawl A wheel with saw-shaped teeth
round its rim is called a ratchet. The ratchet
wheel usually engages with a tooth-shaped lever
called a pawl. The purpose of the pawl is to
allow rotation in one direction only and prevent
rotation in the opposite direction. Ratchet and
pawl gears are used in winches to prevent
slippage.
Gear Trains When 2 or more gears are meshed
together they form a simple gear train. The
overall gear ratio of the train can be worked out
using the first driver gear and the last driven
gear.
The gear train shown includes 4 gears meshed
together. The number of teeth each has is A
50 teeth B 10 teeth C 25 teeth D 120
teeth If A is the input driver the overall gear
ratio is
500rpm
It doesnt matter if you have 2 or 52 gears in a
simple train, the overall gear ratio is still
calculated using the first and last gear in the
train.
23
Compound gears  If gears are required to produce
a very large change in speed, for example if the
multiplier ratio is 1001, then problems can
arise with the size of gear wheels if a simple
gear train is used. This problem can be overcome
by mounting pairs of gears on the same shaft,
this arrangement is called a compound gear system.
Compound Gear Ratio Calculate the gear ratio of
each pair of gears and then multiply the ratios
together.
Worm and wheel Another way of making large speed
reductions is to use a worm gear and wormwheel.
The worm, which looks rather like a screw thread,
is fixed to the driver shaft. It meshes with a
wormwheel, which is fixed to the driven shaft.
The driven shaft runs at 90 degrees to the driver
shaft. When considering the speed changes in most
worm gear systems, you can think of the worm as
if it were a spur gear with one tooth. It is a
single tooth wrapped around a cylinder.
24
Torque Torque is the amount of turning produced
by a force.
Example 1 How much torque is required to tighten
the nut if the force required is 45 N and the
radius of the tool is 200 mm.
Belt-and-chain drives These are used when rotary
motion has to be transmitted over a relatively
long distance and gear trains would be too prone
to losses due to friction. Belt Pulley Drive A
belt is wrapped around two or more pulleys. The
belt is tightened or tensioned by pulling one of
the pulleys out and locking it in place. Pulleys
are thin metal discs with a groove cut into the
circumference of the disc.
V-belt
The tensioned belt transmits the rotary motion
from pulley 2 to pulley 1. The belt is angled as
shown in figure 2 to give better grip to prevent
the belt from slipping. A change in speed can be
accomplished by varying the diameter of the
driver pulley and driven pulley. The driver
pulley will turn in the same direction as the
driven pulley.  
25
Belt Pulley Drive (continued) A change in
direction can be achieved by crossing the belt
over. See diagram below.
Multiplier Ratio Like gears, you can vary the
speed of a pulley system by using different sizes
of pulley. The multiplier ratio is very similar
to the gear ratio and is calculated as follows
Speed Torque When a pulley, belt or chain
system produces an increase in speed, you get a
corresponding decrease in Torque. Likewise, when
a system produces a speed decrease, you get a
corresponding increase in Torque.
Belt tensioning Jockey Wheels One advantage of
a belt system is that it can absorb shock loads
by slipping. Too much slippage is undesirable
however and the inclusion of a small pulley
called a Jockey wheel can ensure that a belt
remains in tension.
26
Toothed belts Belt drives tend to use their
ability to slip to their advantage. However,
where slippage would damage a mechanism, toothed
belts have been developed that retain the
advantages of normal belts but do not slip.
Chain drives Where large forces have to be
transmitted, and there can be no slippage
allowed, chain drives are used. Instead of a
pulley, a toothed wheel known as a sprocket is
used to drive a chain. The chain in turn drives
another toothed wheel. Once again, the speed can
be varied by making the sprockets different sizes.
Chain tension Chain-drive systems must also have
a means to tension the chain. If the chain is
over-tensioned there will be excessive wear on
the chain, sprockets and bearings in the system.
In some bicycles and even motorcycles, the chain
is tensioned by gently pulling the wheel back
until the chain is tight and then tightening the
locking wheel nuts. However, to give better
control, a spring-loaded jockey wheel such as
that used in Derailleur gears on racing bikes and
mountain bikes is used
Spring loaded jockey wheels to maintain the
tension as different sized gear wheels are chosen.
27
Converting Motion
Cams Changes rotary motion into reciprocating
motion.
Crank Slider Changes rotary motion into
reciprocating motion.
Rack Pinion Changes rotary motion into linear
motion.
Worm Nut Changes rotary motion into linear
motion. Every full rotation of the worm results
in the nut moving a distance equal to the pitch
of the worm. Example A worm has a pitch of
2.5mm. If the worm is rotating at 100rpm how
long will it take for the nut to move 1m?
Worm
28
Efficiency Friction No machine is ever 100
efficient. This is because there are always
losses in a system, e.g. energy is lost due to
friction causing heat, or sound or light. Uses of
friction Friction can be useful in some
circumstance, e.g. in car brakes, car tyres or in
belt drive systems where the belt needs to grip
the pulley in order to make it turn.
  • Disadvantages of Friction and ways to reduce it
  • Friction causes unwanted wear on components and
    results in energy losses in machines as energy is
    converted into heat sound. There are a number
    of ways of reducing friction, examples of which
    are given below.
  • We can reduce friction by oiling ("lubricating")
    the surfaces. This means that the surfaces no
    longer rub directly on each other, but slide past
    on a layer of oil. It's now much easier to move
    them. Other methods include
  • using "ball bearings" or "roller bearings", where
    balls or rollers allow the surface to move easily
    without actually touching each other
  • using special materials, for example, Teflon,
    which have a very low coefficient of friction and
    thus slide easily (Teflon is used in "non-stick"
    frying pans for this reason)

29
Compound Levers When you require a large force
multiplication or mechanical advantage, levers
can be linked together (A bit like compound
gears) to produce a compound mechanical
advantage. The example below illustrates this
and shows how to calculate the output force.
Fin
0.6m
The compound lever system shown is used to
control a manual brake on a trolley. If an input
force of 12N is applied what is the output force
at the wheel?
0.25m
LINK
0.15m
Fulcrum
0.08m
Fout
30
Standard Grade Technological Studies Energy
Summary Notes
Forms of energy Non-renewable - finite Oil,
Coal, Natural Gas Nuclear Renewable
infinite Solar, Wind, Wave, Tidal Hydro
electric Advantages of renewable sources Wind
no pollution caused, can be built in remote
locations. Solar again no pollution, allow the
trapping and concentration of the Suns
energy Wave - Wave power systems use kinetic
energy in the waves to turn turbines. No
pollution generated Disadvantages of renewable
sources Wind turbines are noisy and unsightly.
Winds vary and so continual generation of
electricity is not guaranteed. Solar relies on
long periods of sun light to be most effective.
Not so good in Scotland in the winter Wave
expensive to install and prone to a lot of wear
as they have to be out at sea.
Forms of energy Kinetic energy a body has when
moving Potential energy stored in a body when
it is raised up a height, or energy stored when,
for example, a spring is compressed. Electrical
- the most versatile form of energy, it can be
converted into many other forms of energy
easily. Heat - the energy transferred to a body
which causes an increase in its temperature.
The Law of Conservation of Energy The law of
conservation of energy asserts that for a closed
system, where no energy goes in or out, the total
energy within the system must always be the same,
although its form may change.
Formulae Ep mgh potential energy Ek
½mv2 kinetic energy Ee ItV electrical energy Eh
Cm?T heat energy P E/t Power Work Done F x
d Work done Note you dont have to learn
these as they will be given in the data
booklet.
Conserving (Saving energy) Most of the energy we
use comes from non-renewable sources like fossil
fuels. These energy sources will run out
eventually and so it is important that we make
them last as long as possible by limiting their
use. You can save energy by insulating homes
and buildings, using energy saving light bulbs,
driving fuel efficient cars, walking/cycling
rather than driving,etc.
31
Energy transformations You must be able to
examine a diagram of a system (usually a power
generating systems like hydro electric or wind
power) and write down the energy transformations
which take place, e.g. Kinetic ? Potential ?
Kinetic ?Electrical The diagram shown is a
typical example of the type of question you could
be asked.
Kinetic
Potential
Kinetic
Kinetic
Electrical
Electrical
Calculating efficiency The efficiency of an
energy transformation is a measure of how much of
the input energy appears as useful output
energy. The efficiency of any system can be
calculated using the equation Note ? is
the ratio of output to input energy. This can
never be greater than one. In order to convert ?
to a percentage, the efficiency, ?, is multiplied
by 100.
Identify the forms of energy at points A (wind
vane), B (generator), C (pump), D (water tank), E
(water wheel) and F (generator).
Energy Audits An energy audit is a list of all
the energies coming IN and going OUT of a system.
The total for the energies IN must be the same as
the totals for the energies OUT. Once you have
calculated all of the energies in and out you
should construct a systems diagram like the one
shown below.
No machine is 100 Efficient No machine is ever
100 efficient, there are always losses due to
friction, heat loss and a fundamental principle
of physics some energy is always "lost" or
wasted when one form of energy is converted to
another. The "lost" energy is usually in the form
of heat.)
32
Standard Grade Technological Studies Programmable
Control Summary Sheets
  • Uses of Microcontrollers
  • Microcontrollers are single-chip computers
    designed to control specific processes or
    products. They are found in a variety of
    products, e.g. household appliances (for example
    a microwave), alarm systems (for example a fire
    alarm), medical equipment (for example an
    incubator for premature babies) and electronic
    equipment (for example a computer mouse).
  • Advantages of Microcontrollers
  • One microcontroller can often replace a number of
    separate parts, or even a complete electronic
    circuit.
  • increased reliability and reduced quantity of
    stock (as one microcontroller replaces several
    parts)
  • simplified product assembly and smaller end
    products
  • greater product flexibility and adaptability
    since features are programmed into the
    microcontroller and not built into the electronic
    hardware
  • rapid product changes or development by changing
    the program and not the electronic hardware.
  • Disadvantages of Microcontrollers
  • To program a microcontroller you need a computer.
    This can make it more expensive than building an
    electronic circuit.

Parts of the Microcontroller Microcontroller
s contain both ROM (permanent memory) and RAM
(temporary memory). The ROM (Read Only Memory)
contains the operating instructions (that is, the
program) for the microcontroller. The ROM is
programmed before the microcontroller is
installed in the target system, and the memory
retains the information even when the power is
removed. The RAM (Random Access Memory) is
temporary memory used for storing information
whilst the program is running. The ALU
(Arithmetic and Logic unit) is used to perform
calculation and to make logical decisions within
the microcontroller. The clock circuit within the
microcontroller synchronises all the internal
blocks (ALU, ROM, RAM, etc.) so that the whole
system works correctly. Buses Information is
carried between the various blocks of the
microcontroller along groups of wires called
buses. The data bus carries data between the
ALU and RAM, and the program bus carries the
program instructions from the ROM to the ALU.
I/O Port This is the INPUT/OUTPUT port which
connects the microcontroller to real world
inputs and outputs, e.g. from switches and
sensors, motors and lights. The Basic Stamp has
eight I/O ports which can be configured as either
inputs or outputs. EEPROM electrically erasable
programmable read-only memory. This is where
Pbasic programs are stored for use by the
microcontroller. Like ROM this memory is not
lost when the power is cut and like RAM this
memory can also be erased and a new program
stored on it.
RAM
ALU
I/O Port
ROM
BUS
Clock
33
Decimal to Binary Conversion Example 158
Method Draw up the binary place values (see
the table) and put a 1 in the largest place value
which is less than the number, in this case 128.
Subtract this place value from the number,
158-12830, and then put a 1 under the largest
place value which is less than this number, I.e.
16, subtract again to get 30-1614, and so on.
128 64 32 16 8 4 2 1
1 0 0 1 1 1 1 0
Binary to Decimal Conversion This is easy! Just
write the binary number under the place value
table and add up the place values with a 1 under
them. 128643242 230 Easy!
128 64 32 16 8 4 2 1
1 1 1 0 0 1 1 0
Flowcharts these are used to plan out how a
control sequence will work. Different symbols
are used depending on whether the sequence is
testing an input, switching on an output or
pausing. The symbols you have to use are shown
below
Used for outputs, e.g. Switch pin 5 high
Decision, used to test inputs or if a loop has
been completed, e.g. Is switch 1 on?, or have we
looped 5 times?
Line showing the flow of data. Arrows added to
show direction
Entry to or exit from a subprocedure
Process symbol, used to show a pause or a
calculation, e.g. Wait 1sec
Terminator, either START or STOP
34
Programs It isnt easy to summarise programming
as it is something you really have to do.
Instead I have included example of some of the
main concepts you need to know. Switching on
pins High 5 switches on pin 5 Let
pins01100000 switches on pins 6 and 5 and all
the rest off Let pins0 switches all the pins
off Time delays Pause 4000 waits fro 4 seconds
before moving on If, then testing
inputs Loop1 if pin10 then loop1 if pin1 isnt
on then go back to loop1 Loop2 if pin31 then
turn if pin3 is on then go to turn Loops If you
want to repeat a section of program a set number
of times you use a FOR, NEXT loop. You must use
a variable, ie b0,b1,b2 etc in the loop or use
the symbol command to set up a variable
name. Symbol counterb0 sets counter to
represent the variable b0 For counter 1 to
10 start of loop high 5 switch pin 5
on pause 1000 wait 1 second low 5 switch
pin 5 off pause 1000 wait for 1 second Next
counter end of loop (10 times) Continuous
Loops If you want a program to repeat over and
over forever, you should include a goto main at
the end of the program, this will make the
program jump back to the main label which is
usually at the start of a program. Setting up
Input and Output pins Let dirs11110000 sets
pins 4-7 as outputs and 0-3 as inputs
35
Controlling the speed of motors Pulse width
modulation (PWM) is used to control the speed of
d.c. motors. It works by switching the power to
the motor on and off rapidly. The ratio between
the time on and off is called the mark-space
ratio and variation of this allows control over
the speed. The main advantage of this type of
speed control is that it is possible to maintain
a reasonably high torque at low speeds compared
to slowing motors by simply reducing the voltage.
The diagrams below show how it works.
mark
mark
on
off
Sample program using PWM main high 7 ' output
high (mark) pause 5 ' pause for 5 ms low 7 '
output low (space) pause 10 ' pause for 10
ms goto main ' loop
More on programs GOSUB is used if you want to
jump to a sub-procedure in a program.
Sub-procedures start with a label, e.g. left and
end with a RETURN. This sends the program back
to the line just after the sub-procedure was
called using GOSUB. Example Gosub lights jump
to sub procedure lights Gosub flash jump to
sub procedure flash Flash let pins11110000 swi
tch all lights on pause 2000 wait 2
seconds let pins0 switch all pins
off return go back
About PowerShow.com