Sei sulla pagina 1di 35

c  




÷ 


 




Resistors are components that have a predetermined resistance. Resistance


determines how much current will flow through a component. Resistors are
used to control voltages and currents. A very high resistance allows very little
current to flow. Air has very high resistance. Current almost never flows
through air. (Sparks and lightning are brief displays of current flow through
air. The light is created as the current burns parts of the air.) A low resistance
allows a large amount of current to flow. Metals have very low resistance.
That is why wires are made of metal. They allow current to flow from one
point to another point without any resistance. Wires are usually covered with
rubber or plastic. This keeps the wire s from coming in contact with other
wires and creating short circuits. High voltage power lines are covered with
thick layers of plastic to make them safe, but they become very dangerous
when the line breaks and the wire is exposed and is no longer separat ed from
other things by insulation.

Resistance is given in units of ohms. (Ohms are named after Mho Ohms who
played with electricity as a young boy in Germany.) Common resistor values
are from 100 ohms to 100,000 ohms. Each resistor is marked with colored
stripes to indicate its resistance.

›  


Variable resistors are also common components. They have a dial or a knob
that allows you to change the resistance. This is very useful for many
situations. Volume controls are variable resistors. When you change the
volume you are changing the resistance which changes the current. Making


c  



the resistance higher will let less current flow so the volume goes down.
Making the resistance lower will let more current flow so the volume goes up.
The value of a variable resistor is given as its highest resistance value. For
example, a 500 ohm variable resistor can have a resistance of anywhere
between 0 ohms and 500 ohms. A variable resistor may also be called a
potentiometer (pot for short).

 
 

Now suppose you want to control how the current in your circuit changes (or
not changes) over time. Now why would you? Well radio signals require very
fast current changes. Robot motors cause current fluctuations in your circuit
which you need to control. What do you do when batteries cannot supply
current as fast as you circuit drains them? How do you prevent sudden
current spikes that could fry your robot circuitry? The solution to this is
capacitors.

Capacitors are like electron storage banks. If y our circuit is running low, it
will deliver electrons to your circuit.

In our water analogy, think of this as a water tank with water always flowing
in, but with drainage valves opening and closing. Since capacitors take time
to charge, and time to dischar ge, they can also be used for timing circuits.
Timing circuits can be used to generate signals such as £  or be used to
turn on/off motors in solar powered BEAM robots.
Quick note, some capacitors are 
 , meaning current can only flow
one direction through them. If a capacitor has a lead that is longer than the
other, assume the 
     


 .

£
       

The problem with using robot components that drain a large amount of power
is sometimes your battery cannot handle the high drain rate , Motors and
servos being perfect examples. This would cause a system wide voltage drop,
often resetting your microcontroller, or at least causing it to not work
properly. Just a side note, it is bad to use the same power source for both
your circuit and your motors. So don't do it.


c  



Or suppose your robot motors are not operating at its full potential because
the battery cannot supply enough current, the capacitor will make up for it.
The solution is to place a large 
 capacitor between the source
and ground of your power source. Get a capacitor that is rated at least twice
the voltage you expect to go through it. Have it rated at   

    . For example, if your 20V motors will use 3 am ps, use
a 3mF-30mF 50V rated capacitor. Exactly how much will depend on how often
you expect your motor to change speed and direction, as well as

  of what you are actuating. Just note that if your capacitor is too
large, it may take a long time to charge up when you first turn your robot on.
If it is too small, it will drain of electrons and your circuit will be left with a
deficit. It is also bad to allow a large capacitor to remain fully charged when
you turn off your robot. Some things could accidentally short and fry. So use
a simple power on LED in your motor circuit to drain the capacitor after your
robot is turned off. If your capacitor is not rated properly for voltage, then
can explode with smoke. Fortunately they do not overheat if given e xcessive
amounts of current. So just make sure your capacitor is rated higher than
your highest expected.

Capacitors can also be used to   


  that could potentially
fry circuitry. Next to any on/off switch or anything that that could affec t
power suddenly should have a capacitor across it?

Capacitors can eliminate  


  . When you flip a mechanical
switch, the switch actually bounces several times within a microsecond range.
Normally this is too small of a time for anyone to care (or even notice), but
note that a microcontroller can take hundreds of readings in a single
microsecond. So if your robot was counting the number of times a switch is
flipped, a single flip can count as dozens. So how do you stop this? Use a
small   capacitor! Just experiment until you find the power
capacitance value.

!


Diodes are components that allow current to flow in only one direction. They
have a positive side (leg) and a negative side. When the voltage on the
positive leg is higher than on the negative leg then current flows through the
diode (the resistance is very low). When the voltage is lower on the positive
leg than on the negative leg then the current does not flow (the resistance is
very high). The negative leg of a diode is the one with the line closest to it. It
is called the cathode. The positive end is c alled the anode.


c  



Usually when current is flowing through a diode, the voltage on the positive
leg is 0.65 volts higher than on the negative leg.

x 

Switches are devices that create a short circuit or an open circuit depending
on the position of the switch. For a light switch, ON means short circuit
(current flows through the switch, and lights light up.) When the switch is
OFF, that means there is an open circuit (no current flows, lights go out.

When the switch is ON it looks and acts like a wire. When the switch is OFF
there is no connection.

" #!

An LED is the device shown above. Besides red, they can also be yellow,
green and blue. The letters LED stand for Light Emitting Diode. The important
thing to remember about diodes (including LEDs) is that current can only flow
in one direction.

" " 




Transistors are basic components in all of today's electronics. They are just
simple switches that we can use to turn things on and off. Even though they
are simple, they are the most important electrical component. For example,
transistors are almost the only components used to build a Pentium
processor. A single Pentium chip has about 3.5 million transistors. The ones in
the Pentium are smaller than the ones we will use but they work the same
way.

Transistors that we will use in projects look lik e this:


c 


„ r s sr s rgs cr()s() d
r(
) 
  s yrbd  s d r s sr „r s srs
ys v r ds d d s d r ds d sc gy
 crg s   sg s   dd d 
r
g s  r g 
 
"   $


„  gsy b ssd c rc dr gs(sc   cs)rprs 


r s sr



     

„ s() s  s c r r s srcrr  s g


 s r bp r  cr() 
r(
) r
crr c („   c  s ) r s crr  g s
   crr c r  cr 
r(„   c  s)

 s bs cc rc  srrr s srs

V  
  
Ê      

3  bdddsys  sspc prpssys   c  c pr s


c py cpsdby dv c c rs  kg rprps
c prsc sprs c pr  bdddsys prr spr
d dskssy  vryspc  crq r  s c sys  s
dd cdspc  cskds g  g rsc p  rdc g 
c  



size and cost of the product. Embedded systems are often mass -produced, so
the cost savings may be multiplied by millions of items.

Handheld computers or PDAs are generally considered embedded devices


because of the nature of the ir hardware design, even though they are more
expandable in software terms. This line of definition continues to blur as
devices expand.

Examples of embedded systems

JY automatic teller machines (ATMs)


JY avionics, such as inertial guidance systems, flight control
hardware/software and other integrated systems in aircraft and
missiles
JY cellular telephones and telephone switches
JY computer equipment such as routers and printers
JY engine controllers and antilock brake controllers for automobiles
JY home automation products, like thermostats, air conditioners,
sprinklers, and security monitoring systems
JY handheld calculators
JY household appliances, including microwave ovens, washing machines,
television sets, DVD players/recorders
JY medical equipment
JY handheld computers
JY videogame consoles

The first recognizably modern embedded system was the Apollo Guidance
Computer, developed by Charles Stark Draper at the MIT Instrumentation
Laboratory. Each flight to the moon had two. They ran the inertial guidance
systems of both the command module and LEM.

At the project's inception, the Apollo guidance computer was considered the
riskiest item in the Apollo project. The use of the then new monolithic
integrated circuits, to reduce the size and weight, increased this risk.

The first mass-produced embedded system was the Autonetics D -17 guidance
computer for the Minuteman missile, released in 1961. It was built from
discrete transistor logic and had a hard disk for main memory. When the
Minuteman II went into production in 1966, the D -17 was replaced with a
new computer that was the first high -volume use of integrated circuits. This
program alone reduced prices on quad nand gate ICs from


c  



 

Embedded systems are designed to do some specific task, rather than be a


general-purpose computer for multiple tasks. Some also have real -time
performance constraints that must be met, for reason such as safety and
usability; others may have low or no performance requirements, allowing the
system hardware to be simplified to reduce costs.

For high volume systems such as portable music players or mobile phones,
minimizing cost is usually the primary design consideration. Engineers
typically select hardware that is just Ơgood enoughơ to implement the
necessary functions. For example, a digital set-top box for satellite television
has to process large amounts of data every second, but most of the
processing is done by custom integrated circuits. The embedded CPU "sets
up" this process, and displays menu graphics, etc. for the set -top's look and
feel.

The software written for embedded systems is often called firmware, and is
stored in ROM or Flash memory chips rather than a disk drive. It often runs
with limited hardware resources: small or no keyboard, screen, and little RAM
memory.

Embedded systems reside in machines that are expected to run continuously


for years without errors and in some cases recover by them if an error occurs.
Therefore the Software is usually developed and tested more carefully than
that for Personal computers, and unreliabl e mechanical moving parts such as
Disk drives, switches or buttons are avoided. Recovery from errors may be
achieved with techniques such as a watchdog timer that resets the computer
unless the software periodically notifies the watchdog.

     

Embedded systems range from no user interface at all - dedicated only to one
task - to full user Interfaces similar to desktop operating systems in devices
such as PDAs. In between are devices with small character - or digit-only
displays and a few buttons. Therefore usability considerations vary widely.

On larger screens, a touch-screen or screen-edge soft buttons also provides


good flexibility while minimizing space used. The advantage of this system is
that the meaning of the buttons can change with the s creen, and selection
can be very close to the natural behavior of pointing at what's desired.


c  



DTMF

WHAT IS DTMF? 

When you press a button in the telephone set keypad, a connection


is made that generates a resultant signal of two tones at the same time.
These two tones are taken from a row frequency and a column
frequency. The resultant frequency signal is called " Dual Tone Multiple
Frequency". These tones are identical and unique. 

A DTMF signal is the algebraic sum of two different audio


frequencies, and can be expressed as follows: 

f(t) = A0 sin(2*Ƿ*fa*t) + B0sin(2*Ƿ*fb*t) + ........... ------->(1)

Where fa and f b are two different audio frequencies with A and B as


their peak amplitudes and f as the resultant DTMF signal. fa belongs to
the low frequency group and fb belongs to the high frequency group. 

Each of the low and high frequency groups comprise fo ur


frequencies from the various keys present on the telephone keypad; two
different frequencies, one from the high frequency group and another
from the low frequency group are used to produce a DTMF signal to
represent the pressed key. 

The amplitudes of the two sine waves should be such that 

(0.7 < (A/B) < 0.9)V -------->(2)

The frequencies are chosen such that they are not the harmonics of
each other. The frequencies associated with various k eys on the keypad
are shown in figure (A). 

When you send these DTMF signals to the telephone exchange


through cables, the servers in the telephone exchange identifies these
signals and makes the connection to the person you are calling. Y 

The row and column frequencies are given below: 

Y 


c  



Fig (A)

YWhen you press the digit 5 in the keypad it generates a resultant


tone signal which is made up of frequencies 770Hz and 1336Hz. Pressing
digit 8 will produce the tone taken from tones 852Hz and 1336Hz. In
both the cases, the column frequency 1336 Hz is the same. These signals
are digital signals which are symmetrical with the sinusoidal wave. 

YA Typical frequency is shown in the figure below: 

Y
Figure (B) 

YAlong with these DTMF generator in our telephone set provides a


set of special purpose groups of tones, which is normally not used in our
keypad. These tones are identified as 'A', 'B', 'C', 'D'. These frequencies
have the same column frequency but uses row frequencies given in the
table in figure (A). These tones are used for communication signaling. 

YThe frequency table is as follows: 

Y
Figure (C) 

Due to its accuracy and uniqueness, these DTMF signals are used in
controlling systems using telephones. By using some DTMF generating
IC¶s (UM91214, UM91214, etc) we can generate DTMF tones without
depending on the telephone set.


c  



CIRCUIT DESCRIPTION: 

This system is divided into two sections, 1: Remote Section 2: Local


Control Section. 

REMOTE SECTION:

This unit consists of telephone set which is present in the remote


place. This may be your workspace (office / school) phone or mobile
phone or a phone in PCO. Signals are sent through this telephone. The
figure (E) shows the circuit diagram of the DTMF encoder which
resembles the telephone set. It uses DTMF encoder integrated circuit,
Chip UM 91214B (click here to download datasheet). This IC produces
DTMF signals. It contains four row frequencies & three column
frequencies. The pins of IC 91214 B from 12 to 14 produces high
frequency column group and pins from 15 to 18 produces the low
frequency row group. By pressing any key in the keyboard corresponding
DTMF signal is available in its ou tput pin at pin no.7. For producing the
appropriate signals it is necessary that a crystal oscillator of 3.58MHz is
connected across its pins 3 & 4 so that it makes a part of its internal
oscillator.


Figure (E). Circuit diagram of the DTMF encoder 

This encoder IC requires a voltage of 3V. For that IC is wired


around 4.5V battery. And 3V backup Vcc for this IC is supplied by using
3.2v zener diode. 

The row and column frequency of this IC is as on the fig. "B". By


pressing the number 5 in t he key pad the output tone is produced which
is the resultant of addition of two frequencies, at pin no. 13 & pin no.16
of the IC and respective tone which represents number '5' in key pad is


c  



produced at pin no.7 of the IC . This signal is sent to the loca l control
system through telephone line via exchange. 

LOCAL CONTROL SECTION: 

This is a control unit through which you can control your


appliances. This contains one telephone line and a Local Control Section.
The appliances to be controlled must be connec ted to telephone line
through control unit. Control unit is kept with a sufficient backup. 

Local Control Section consists of a DTMF decoder, 4 -16 line


decoder/demultiplexer, D-flip-flops, and relay driver circuits. Before
going into detail of the circuit, we will take a brief description about
integrated circuits used in local control section. 

MT 8870 DTMF decoder: 

IC MT8870/KT3170 serves as DTMF decoder (click here to


download datasheet). This IC takes DTMF signal coming via telephone
line and converts that signal into respective BCD number. It uses same
oscillator frequency used in the remote section so same crystal oscillator
with frequency of 3.85M Hz is used in this IC.

Ôorking of IC MT8870:

The MT-8870 is a full DTMF Receiver that integrates both band


split filter and decoder functions into a single 18 -pin DIP. Its filter
section uses switched capacitor technology for both the high and low
group filters and for dial tone rejection. Its decoder uses digital counting
techniques to detect and decode all 16 DTMF tone pairs into a 4 -bit code.
External component count is minimized by provision of an on -
chip differential input amplifier, clock generator, and latched t ri-state
interface bus. Minimal external components required include a low -cost
3.579545 MHz crystal, a timing resistor, and a timing capacitor. The MT -
8870-02 can also inhibit the decoding of fourth column digits. 

MT-8870 operating functions include a ban d split filter that


separates the high and low tones of the received pair, and a digital
decoder that verifies both the frequency and duration of the received
tones before passing the resulting 4 -bit code to the output bus.Y

The low and high group tones are separated by applying the dual -tone
signal to the inputs of two 6 th order switched capacitor band pass filters
with bandwidths that correspond to the bands enclosing the low and high
group tones.


c  




Figure (F).Block diagram of IC MT8870

The filter also incorporates notches at 350 and 440 Hz, providing
excellent dial tone rejection. Each filter output is followed by a single -
order switched capacitor section that smoothes the signals prior to
limiting. Signal limiting is performed by high gain comparators provided
with hysteresis to prevent detection of unwanted low-level signals and
noise.YThe MT-8870 decoder uses a digital counting technique to
determine the frequencies of the limited tones and to verify that they
correspond to standard DTMF frequencies. When the detector recognizes
the simultaneous presence of two valid tones (known as signal
condition), it raises the Early Steering flag (ESt). Any subsequent loss of
signal condition will cause ESt to fall. Before a decoded tone pair is
registered, the receiver checks for valid signal duration (referred to as
character- recognition-condition). This check is performed by an external
RC time constant driven by ESt. A short delay to allow the output latch to
settle, the delayed steering output flag (StD) goes high, signaling that a
received tone pair has been registered. The contents of the output latch
are made available on the 4 -bit output bus by raising the three state
control input (OE) to logic high. Inhibit mode is enabled by a logic high
input to pin 5 (INH). It inhibits the detection of 1633 Hz. 

The output code will remain the same as the previous detected
code. On the M- 8870 models, this pin is tied to ground (logic low). 

The input arrangement of the MT -8870 provides a differential input


operational amplifier as well as a bias source (VREF) to bias the inputs at
mid-rail. Provision is made for connection of a feedback resistor to the
op-amp output (GS) for gain adjustment. 

The internal clock circuit is completed with the addition of a standard


3.579545 MHz crystal. 


c  



The input arrangement of the MT -8870 provides a differential input


operational amplifier as well as a bias source (VREF) to bias the inputs at
mid-rail. Provision is made for connection of a feedback resistor to the
op-amp output (GS) for gain adjustment. 

The internal clock circuit is completed with the addition of a


standard 3.579545 MHz

PIC. SHOWING A DTMF





c  



m Y
Y
Y
YY


Y
Y
‘  
Y
The 8051 family of micro controllers is based on an architecture which is
highly optimized for embedded control systems. It is used in a wide variety of
applications from military equipment to automobiles to the keyboard on your
PC. Second only to the Motorola 68HC11 in eight bit processors sales, the
8051 family of microcontrollers is available in a wide array of variations from
manufacturers such as Intel, Philips, and Siemens. These manufactu rers have
added numerous features and peripherals to the 8051 such as I2C interfaces,
analog to digital converters, watchdog timers, and pulse width modulated
outputs. Variations of the 8051 with clock speeds up to 40MHz and voltage
requirements down to 1.5 volts are available. This wide range of parts based
on one core makes the 8051 family an excellent choice as the base
architecture for a company's entire line of products since it can perform many
functions and developers will only have to learn this one platform.

The basic architecture consists of the following features:

One 8051 processor cycle consists of twelve oscillator periods. Each of the
twelve oscillator periods is used for a special function by the 8051 core such
as op code fetches and sample s of the interrupt daisy chain for pending
interrupts. The time required for any 8051 instruction can be computed by
dividing the clock frequency by 12, inverting that result and multiplying it by
the number of processor cycles required by the instruction in question.
Therefore, if you have a system which is using an 11.059MHz clock, you can
compute the number of instructions per second by dividing this value by 12.
This gives an instruction frequency of 921583 instructions per second.
Inverting this will provide the amount of time taken by each instruction cycle
(1.085 microseconds).

JY an eight bit ALU


JY 32 discrete I/O pins (4 groups of 8) which can be individually accessed
JY two 16 bit timer/counters
JY full duplex UART
JY 6 interrupt sources with 2 priority l evels
JY 128 bytes of on board RAM
JY separate 64K byte address spaces for DATA and CODE memory



%   



c  



The 8051 architecture provides the user with three physically distinct memory
spaces which can be seen in Figure A - 1. Each memory space consists of
contiguous addresses from 0 to the maximum size, in bytes, of the memory
space. Address overlaps are resolved by utilizing instructions which refer
specifically to a given address space. The three memory spaces function as
described below.

Figure A - 1 - 8051 Memory Architecture

„  %!  

The first memory space is the CODE segment in which the executable
program resides. This segment can be up to 64K (since it is addressed by 16
address lines). The processor treats this segment as read only and will
generate signals appropriate to access a memory device such as an EPROM.
However, this does not mean that the CODE segment must be implemented
using an EPROM. Many embedded systems these days are using EEPROM
which allows the memory to be overwritten either by the 8051 itself or by an
external device. This makes upgrades to the product easy to do since new
software can be downloaded into the EEPROM rather than having to
disassemble it and install a new EPROM.
Additionally, battery backed SRAM s can be used in place of an EPROM. This
method offers the same capability to upload new software to the unit as does
an EEPROM, and does not have any sort of read/write cycle limitations such
as an EEPROM has. However, when the battery supplying the RAM e ventually
dies, so does the software in it. Using an SRAM in place of an EPROM in
development systems allows for rapid downloading of new code into the
target system. When this can be done, it helps avoid the cycle of
programming/testing/erasing with EPROMƞs, and can also help avoid hassles


c  



over an in circuit emulator which is usually a rare commodity. In addition to


executable code, it is common practice with the 8051 to store fixed lookup
tables in the CODE segment. To facilitate this, the 8051 provides i nstructions
which allow rapid access to tables via the data pointer (DPTR) or the program
counter with an offset into the table optionally provided by the accumulator.
This means that oftentimes, a table's base address can be loaded in DPTR
and the element of the table to access can be held in the accumulator. The
addition is performed by the 8051 during the execution of the instruction
which can save many cycles depending on the situation.

" !&"&x 



The second memory space is the 128 bytes of internal RAM on the 8051, or
the first 128 bytes of internal RAM on the 8052. This segment is typically
referred to as the DATA segment. The RAM locations in this segment are
accessed in one or two cycles dependi ng on the instruction. This access time
is much quicker than access to the XDATA segment because memory is
addressed directly rather than via a memory pointer such as DPTR which
must first be initialized. Therefore, frequently used variables and temporary
scratch variables are usually assigned to the DATA segment. Such allocation
must be done with care, however, due to the limited amount of memory in
this segment.
Variables stored in the DATA segment can also be accessed indirectly via R0
or R1. The register being used as the memory pointer must contain the
address of the byte to be retrieved or altered. These instructions can take one
or two processor cycles depending on the source/destination data byte.
The DATA segment contains two smaller segments of int erest. The first sub
segment consists of the four sets of register banks which compose the first 32
bytes of RAM. The 8051 can use any of these four groups of eight bytes as its
default register bank. The selection of register banks is changeable at any
time via the RS1 and the RS0 bits in the Processor Status Word (PSW). These
two bits combine into a number from 0 to 3 (with RS1 being the most
significant bit) which indicates the register bank to be used.
Register bank switching allows not only for quick p arameter passing, but also
opens the door for simplifying task switching on the 8051.
The second sub-segment in the DATA space is a bit addressable segment in
which each bit can be individually accessed. This segment is referred to as the
BDATA segment. The bit addressable segment consists of 16 bytes (128 bits)
above the four register banks in memory. The 8051 contains several single bit
instructions which are often very useful in control applications and aid in
replacing external combinatorial logic with software in the 8051 thus reducing
parts count on the target system. It should be noted that these 16 bytes can
also be accessed on a "byte-wide" basis just like any other byte in the DATA
space


c  



£
 Y 
 Y 
Y


       


           
 ! !"  #

 $%c&'    


 !  !   #
%c&( 
     !     
#

Y3(  )*



+'Y c      
(  #
,'Y -(  (        
   !#
.'Y     (  #
/'Y
   !     
      #
0'Y     !   #

YY
! %c&1)*


  2! %c&1)*
+'Y x  %c&)* 3 "    3 
  %c&#
      (  
#
,'Y   %c&)* 3 " (    
 #
  (      3   3
     4!#
.'Y !  %c&)* 3        
 !   "    #
 !         
! !!   3     !    #
/'Y  4 %c&)* 4 !  ! 4 ( 
(    #


c  



Y%c& % )*




       3     %c&3


  !  !3   #
 
    
lY %  )*
   
 !   # 4  #%
      #
lY %   !)*
 %c&((   4  
     "#
   "
 #
lY  )*
     ! 4   
    (  !  4   
#
    ) c3cc3 #
lY )*          
 %c&#
      "  ( 
   #
lY x  ")*  !  ( !
         #
 " !
 *#
lY %)*
      "
       ! ! #%c&
 "    "  ! #
%c&
   !#
lY & *&
)*        
  43         ! 
#
 !( ! #









c 

£ ££

          
c     
      2   )
lY     
 
lY   
 

  V  V
 V  ) 
 
 


      
 
    
     c

 
   
  
  
    
  
      
c
  
 

   
   
)




c  
VcV V  

 



 c 
     V  V
 V  


V  V
 V  
 
 

    

 
 

 

 
) 
lY c V V  V
 V  V
 

  

 
    

lY ›  VV  V
 V  V
 




   

   
 




& 
  
 )

c    


c
› VcV V ›V    ›  

  



   V  V
 V  


  c 
   V  V
 V  




c c 
     


c  
  c





  

 c


      
 c
c
  







 ! " #  $
  cc!

 c %&'(

 cc"




  

    
 




c %&'(



( 
!)

    &(% 












c    

?  

Y
3ry ssy cr c  cdv c  scdby cr c
crr „ crr  g  c rc css p grcs g
  rc rc Rysr kr c rs c s drsd   y
pp c  sbcs  rr vs p c y g  dprv  g 
r b  y„ yrsd  dvr ypp c  s rg  dsry
sc s p  c  gsd g c prs d   sys s


ë     


3rysc  s s g  cr cc  c  sprdby3r
crr    pp dcrr rvgcds rs dv
 c c vs r r c prs  rcs p 
c csrp  csdc cs  pr sspp d c 
g rs g  crc cs s c  c  s „ 
g  crc s cry g c  r  c rc   r
„  rsc rc  scd c rc rc ; sc d scd d
c rc 3ry ssy cr c  cdv c  scdby 
cr ccrr 
„ crr  g  c rc css p grcs g  r
c rc 





c    




"   ?  

„ rrbs ccss  c  srys:

Y
cr c  cRy
Y  d Ry


cr c  crys v v gprs rss dsrys v


 v gprs3dv gs
cr c  crys cdrcs
 s k srq rd  ppsrv b d yc s c 3
r  qs

0 Y       

'  (     :„ g rprpsry srdby   
 crr  s s c  c cs c   d s vrs  s    g r
prps ry v     g  ps  d c  b s g r db  r
„ sr d c prscpy c s d rc s rcr c
q p   dpp  cs






 



(
?  )„ prry scpb  d grgrprds
 !  prsr r
„ yrsys gprdbp s








  
 
:3spc yp g prry "ssd  yc r
g vgs dcrr s  dsr cr cpp c  scs
 s g prrq r  sc crsys vdb k
c cs



 ""
c    

"    ?  :„ c cs g  p rcs  s  


rvr c  sb  rg d„ s scddy pr
y rs  s  c cs r     rcd
ps     s  rvr pr sb r vdr  c 
3 rddy scd rv g csrvr  rr 
ps   spc  c rv r c  sb  rg d
„  g sc  s yb dpr r ryr
d sdbyk b  ry srr yd sd rg  
r c rc 

D Y x  x  ! 











 


„ sc vs c dcrdv css g  sd g  s c
s c „  g c sr  L
r g   gd d  c r
pr s pp d    dv c"s p    g  s r d    d s s
crss p spc

  ds d sspcpr dv cs ss prs c 
 g   d r ggrs  s d s s c      r p s r css   c rc 
 drc r

  s d s rys r sd  r   c rc   dr c r s b
prcdr   rdc  cr c  ss

3dv gs   d  Rys cd 
RF  g    v g
prs c cb c dsrsp s

„ drbcks g s dsry s  c  ycc p s s g
ps c g





 "#
c  







 ,/
c  



unsigned short count1,count2,count3;

int passpnt;

int i;

int dtmf;

char txt[5];

char password[30];

char recharge_100[10]={'1','2','3','4','5','4','3','2'};

char recharge_50[10]={'1','2','3','4','5','6','7','8'};

char recharge_10[10]={'1','2','3','4','8','7','6','5'};

char cmp;

void main()

 ,0
c  



dtmf = 0;

passpnt=0;

i=0;

count1=0;

count2=0;

count3=0;

do

if(PORTC==27)

while(PORTC.f4==1)

Lcd_Cmd(Lcd_CLEAR); // Clear display

Lcd_Cmd(Lcd_CURSOR_OFF);

 ,5
c  



Lcd_Out(1, 1, "CANDIDATE ID");

while(i!=8)

if(PORTC.f4)

while(PORTC.f4)

Delay_ms(1);

dtmf=PORTC;

if(dtmf==12)

goto votecount;

if(dtmf>=1 && dtmf<=9)

i++;

if(dtmf == 1)

 ,6
c  



password[passpnt]='1';

passpnt++;

Lcd_Out(2, i+1, "1");

if(dtmf == 2)

password[passpnt]='2';

passpnt++;

Lcd_Out(2, i+1, "2");

if(dtmf == 3)

password[passpnt]='3';

passpnt++;

Lcd_Out(2, i+1, "3");

 ,7
c  



if(dtmf == 4)

password[passpnt]='4';

passpnt++;

Lcd_Out(2, i+1, "4");

if(dtmf == 5)

password[passpnt]='5';

passpnt++;

Lcd_Out(2, i+1, "5");

if(dtmf == 6)

password[passpnt]='6';

passpnt++;

Lcd_Out(2, i+1, "6");

 ,8
c  



if(dtmf == 7)

password[passpnt]='7';

passpnt++;

Lcd_Out(2, i+1, "7");

if(dtmf == 8)

password[passpnt]='8';

passpnt++;

Lcd_Out(2, i+1, "8");

if(dtmf == 9)

 .9
c  



password[passpnt]='9';

passpnt++;

Lcd_Out(2, i+1, "9");

cmp=strncmp(password,recharge_100,8);

if(cmp==0)

count1=count1+1;

cmp=strncmp(password,recharge_50,8);

if(cmp==0)

count2=count2+1;

cmp=strncmp(password,recharge_10,8);

if(cmp==0)

 .+
c  



count3=count3+1;

passpnt=0;

i=0;

votecount:

Lcd_Cmd(Lcd_CLEAR);

Lcd_Out(1, 1, "VOTE COUNT");

shorttostr(count1,txt);

Lcd_Out(2, 1, txt);

shorttostr(count2,txt);

Lcd_Out(2, 6, txt);

shorttostr(count3,txt);

Lcd_Out(2, 11, txt);

while(PORTC.f4==0)

 .,
c  



Lcd_Init(&PORTB); // Initialize LCD connected to PORTB

Lcd_Cmd(Lcd_CLEAR); // Clear display

Lcd_Cmd(Lcd_CURSOR_OFF); // Turn cursor off

Lcd_Out(1, 1, "TELE VOTING M/C");

Lcd_Out(2, 1, "PRESS * TO VOTE");

Delay_ms(100);

} while (1); // endless loop

 ..
c  



÷Ê÷#%Ê&£

1. www.zarlink.com

2. www.ieee.com

3. Electronics 4 you magazine

4. www.fairchildsemi.com

 ./
c  



Ê VY
+#Basic Electronic Components

2.DTMF

3.Circuit Description

4.Microcontrollers

5.Printed circuit boards

6. Relays

7.Power Supply

8.Coding

9.Bibliography

 .0

Potrebbero piacerti anche