Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
CHAPTER 1 INTRODUCTION
1.1 INTRODUCTION
In this world of knowledge everything around us is run by Computing Systems. The technical Brilliance and Developments in different fields has led to a drastic change in our lives especially in the communications field. Due to various changes in technologies many systems have come up with breathtaking developments. ne amongst them is the !mbedded Systems. It Its applications provide
tremendous opportunities for creative use of computer technology. "lmost every new system introduced in the market is an e#ample of !mbedded System. "n embedded system is a combination of computer circuitry and software that is built into a product for purposes such as control$ monitoring and communication without human intervention. !mbedded systems are at the core of every modern electronic product$ ranging from toys to medical e%uipment to aircraft control systems. In contrast to general&purpose computers$ embedded systems perform a narrow range of pre&defined tasks. Thus$ they usually do not have any of the typical computer peripheral devices such as a keyboard$ display monitor$ serial connections$ mass storage 'e.g.$ hard disk drives($ etc. or any kind of user interface software$ unless re%uired by the product in which they are used in. This can make it possible to greatly reduce the comple#ity$ si)e and cost and increase the robustness of embedded systems as compared with general purpose systems.
1.2 RF MODULE:
System is instantly updated&&lag time between the physical movement of the product and the pdate to the system is removed$ thus reducing errors and allowing for *real&time* ad+ustments. ,ith this level of data communication$ "ccuplus -. allows for cross docking of products that don/t stay in the warehouse for more than a few hours.
1.3 SYSTEMS
" system is something that maintains its e#istence and functions as a whole through the interaction of its parts. !.g. Body$ 1ankind$ "ccess Control$ etc. " system is a part of the world that a person or a group of persons during some time interval and for some purpose choose to regard as a whole$ consisting of interrelated components$ each component characteri)ed by properties that are selected as being relevant to the purpose.
SYSTEM CONSTITUENTS:
HARDWARE
SOFTWARE
HUMANWARE
,e can define an embedded system as 4a computing device built into a device that is not a computer$ and meant for doing specific computing tasks5.
"n embedded system is a special purpose computer system usually built into an environment connected to systems through sensors$ actuators and other I6 interfaces.
!mbedded system must meet timing and other constraints imposed on it by environment. In this we can use "T78S91 1icro controller.
"utomatic teller machines '"T1s( Cellular telephones and telephone switches :andheld calculators :andheld computers :ousehold appliances$ including microwave ovens$ washing machines$ television sets$ D;D players and recorders
1edical e%uipment <ersonal digital assistant ;ideogame consoles Computer peripherals such as routers and printers
OR'ANISATION OF THESIS:
The following will be a brief description of the contents of the report. Chapter 1 deals with the block diagram of message circular system and brief introduction about hardware components. Chapter 3 gives a detailed e#planation about the hardware components that are used in the pro+ect. Chapter3 gives a brief description about >CD. Chapter9 describes Serial Communication. Chapter? describes the Software/s we used in the pro+ect.
CHAPTER 2
2. #(o)* %i+g,+m o- Em$e%%e% $+se% )!stomi.e% /i,e(ess mess+ge )i,)!(+, system -o, )o((ege0 i %!st,ies. 2.1.1 TRANSMIT #LOC1 DIA'RAM:
!@C D!-
-. -!C!I;! 1 D2>!
MICRO 5 CONTROLLER:
"tmel6<hillips 78S91$ 7 bit 1icro controller from MCS561 Intel family$ 7F bytes of .lash$ 09? bytes of -"1.It has =G pins configuration and other components interfaced to its ports. In addition$ the "T78S91 is designed with static logic for operation down to )ero fre%uency and supports two software selectable power saving modes. The Idle 1ode stops the C<2 while allowing the -"1$ timer6counters$ serial port$ and interrupt system to continue functioning. The "tmel "T78S91 is a powerful microcontroller which provides a highly&fle#ible and cost&effective solution to many embedded control applications.
PO4ER SUPPLY:
The <ower Supply unit is used to provide a constant 9 volts -egulated Supply to different IC/s this is standard circuits using e#ternal 10 ;DC adapter and fi#ed 3&pin voltage regulator. Diode is added in series to avoid -everse ;oltage <rotection
ENCODER:
"n encoder is a device$ circuit$ transducer$ software program$ algorithm or person that converts information from one format or code to another$ for the purposes of standardi)ation$ speed$ secrecy$ security$ or saving space by shrinking si)e.
DECODER:
" decoder is a device which does the reverse of an encoder$ undoing the encoding so that the original information can be retrieved. The same method used to encode is usually +ust reversed in order to decode. In digital electronics$ a decoder can take the form of a multiple&input$ multiple&output logic circuit that converts coded inputs into coded outputs$ where the input and output codes are different. e.g. n&to&0n$ binary&coded decimal decoders. !nable inputs must be on for the decoder to function$ otherwise its outputs assume a single *disabled* output code word.
#LOC1 DIA'RAM:
Fig: 3.1 #(o)* %i+g,+m o- Po/e, S!99(y 3.1.1 STEP DO4N TRANSFORMER:
,hen "C is applied to the primary winding of the power transformer it can either be stepped down or up depending on the value of DC needed. In our circuit the transformer of 03Gv619&G&19v is used to perform the step down operation where a 03G; "C appears as 19; "C 8
positive and the bottom negative. The ne#t alteration will temporarily cause the reverse. The current rating of the transformer used in our pro+ect is 0". "part from stepping down "C voltages$ it gives isolation between the power source and power supply circuitries.
1G
1GGGf609v 1Gf609v 1 f
L for the reduction of ripples from the pulsating. L for maintaining the stability of the voltage at the load side. $ L for bypassing the high fre%uency disturbances.
regulation$ eliminating the distribution problems associated with single point regulation. The voltages available allow these regulators to be used in logic systems$ instrumentation$ :i.i$ and other solid state electronic e%uipment. "lthough designed primarily as fi#ed voltage regulators these devices can be used with e#ternal components to obtain ad+ustable voltages and currents. The >1E7BB series is available in an aluminum T &3 package which will allow over 1.G" load current if ade%uate heat sinking is provided. Current limiting is included to limit the peak output current to a safe value. Safe area protection for the output transistor is provided to limit internal power dissipation. If internal power dissipation becomes too high for the heat sinking provided$ the thermal shutdown circuit takes over preventing the IC from overheating. Considerable effort was e#panded to make the >1E7BB series of regulators easy to use and minimi)e the number of e#ternal components. It is not necessary to bypass the output$ although this does improve transient response. Input bypassing is needed only if the regulator is located far from the filter capacitor of the power supply. .or output voltage other than 9;$ 10; and 19; the >111E series provides an output voltage range from 1.0; to 9E;.
Fe+t!,es:
utput current in e#cess of 1" Internal thermal overload protection @o e#ternal components re%uired utput transistor safe area protection Internal short circuit current limit "vailable in the aluminum T &3 package
11
Fig: 3.2 9(+sti) P+)*+ge o- 2o(t+ge Reg!(+to, 3.1.6 THREE TERMINAL POSITI2E 2OLTA'E RE'ULATOR:
These voltage regulators are monolithic integrated circuits designed as fi#edMvoltage regulators for a wide variety of applications including local$ onMcard regulation. These regulators employ internal current limiting$ thermal shutdown$ and safeMarea compensation. ,ith ade%uate heat sinking they can deliver output currents in e#cess of 1.G ". "lthough designed primarily as a fi#ed voltage regulator$ these devices can be used with e#ternal components to obtain ad+ustable voltages and currents. utput Current in !#cess of 1.G " @o !#ternal Components -e%uired Internal Thermal verload <rotection Internal Short Circuit Current >imiting utput Transistor SafeM"rea Compensation utput ;oltage ffered in 0H and =H Tolerance "vailable in Surface 1ount D0<"F and Standard 3M>ead Transistor
10
" common ground is re%uired between the input and the output voltages. The input voltage must remain typically 0.G ; above the output voltage even during the low point on the input ripple voltage. BB& These two digits of the type number indicate nominal voltage. Cin& is re%uired if regulator is located an appreciable distance from power supply filter. C & is not needed for stabilityN however$ it does improve transient response. ;alues of less than G.1 m. could cause instability.
3.1.: TRANSFORMER:
Transformers convert "C electricity from one voltage to another with little loss of power. Transformers work only with "C and this is one of the reasons why mains electricity is "C. Step&up transformers increase voltage$ step&down transformers reduce voltage. 1ost power supplies use a step&down transformer to reduce the dangerously high mains voltage '03G; in 2F( to a safer low voltage.
13
The input coil is called the 9,im+,y and the output coil is called the se)o %+,y. There is no electrical connection between the two coils$ instead they are linked by an alternating magnetic field created in the soft&iron core of the transformer. The two lines in the middle of the circuit symbol represent the core.
The ratio of the number of turns on each coil$ called the t!, >s ,+tio$ determines the ratio of the voltages. " step&down transformer has a large number of turns on its primary 'input( coil which is connected to the high voltage mains supply$ and a small number of turns on its secondary 'output( coil to give a low output voltage.
1=
CIRCUIT DIA'RAM:
19
The 1GQf and .G1Qf capacitors serve to help keep the power supply output voltage constant when load conditions change. The electrolytic capacitor smooths out any long&term or low fre%uency variations. :owever$ at high fre%uencies this capacitor is not very efficient. Therefore$ the .G1Qf is included to bypass high&fre%uency changes$ such as digital IC switching effects$ to ground. The >!D and its series resistor serve as a pilot light to indicate when the power supply is on. I like to use a miniature >!D here$ so it will serve that function without being obtrusive or distracting while IPm performing an e#periment. I also use this >!D to tell me when the reservoir capacitor is completely discharged after power is turned off. Then I know itPs safe to remove or install components for the ne#t e#periment.
1?
1E
=.G; to 9.9; perating -ange .ully Static peration Speed up to 33 1:) Three&level <rogram 1emory >ock 09? # 7&bit Internal -"1 30 <rogrammable I6 >ines Three 1?&bit Timer6Counters !ight Interrupt Sources .ull Duple# 2"-T Serial Channel .raming error detection "utomatic address recognition
>ow&power Idle and <ower&down 1odes Interrupt -ecovery from <ower&down 1ode Dual Data <ointer <ower&off .lag
17
ALU
The ">2 performs arithmetic and logic functions on 7&bit variables. The ">2 can perform addition$ subtraction$ multiplication and division and the logic unit can perform logical operations. "n important and uni%ue feature of the microcontroller architecture is that the ">2 can also manipulate one bit as well as 7&bit data types. Individual bits may be set$ cleared$ complemented$ moved$ tested and used in logic computation.
ACCUMULATOR:
It is written as register " or "cc. It is an 7bit -egister the "ccumulator$ as its name suggests$ is used as a general register to accumulate the results of a large number of instructions. It can hold an 7&bit '1&byte( value and stores the result of the arithmetic operations such as addition$ subtraction$ multiplication and division and the logic unit can perform logical operations. The "ccumulator can be the source or destination register for logical operations. The "ccumulator has several e#clusive functions such as rotate$ parity computationN testing for G$ sign acceptor etc. and so on.
18
Carry .lag. "u#iliary Carry .lag. .lag G available to the user for general purpose. -egister Bank selector bit 1. -egister Bank selector bit G. verflow .lag. 2sable as a general purpose flag. <arity flag. Set6cleared by hardware each instruction cycle to indicate an odd6even number of K1/ bus in the accumulator.
0G
'ND:
Around.
PORT <
<ort G is an 7&bit open drain bidirectional I6 port. "s an output port$ each pin can sink eight TT> inputs. ,hen 1s are written to port G pins$ the pins can be used as high impedance inputs. <ort G can also be configured to be the multiple#ed low order address6data bus during accesses to e#ternal program and data memory. In this mode$ <G has internal pullups. <ort G also receives the code bytes during .lash programming and outputs the code bytes during program verification. !#ternal pullups are re%uired during program verification.
PORT 1
<ort 1 is an 7&bit bidirectional I6 port with internal pullups. The <ort 1 output buffers can sink6source four TT> inputs. ,hen 1s are written to <ort 1 pins$ they are pulled high by the internal pullups and can be used as inputs. "s inputs$ <ort 1 pins that are e#ternally being pulled low will source current 'II>( because of the internal pullups. In addition$ <1.G and <1.1 can be configured to be the timer6counter 0 e#ternal count input '<1.G6T0( and the timer6counter 0 trigger input '<1.16T0!B($ respectively$ as shown in the following table. <ort 1 also receives the low&order address bytes during .lash programming and verification.
00
PORT 3
<ort 3 is an 7&bit bidirectional I6 port with internal pullups. The <ort 3 output buffers can sink6source four TT> inputs. ,hen 1s are written to <ort 3 pins$ they are pulled high by the internal pullups and can be used as inputs. "s inputs$ <ort 3 pins that are e#ternally being pulled low will source current 'II>( because of the pullups. <ort 3 also serves the functions of various special features of the "T78S91$ as shown in the following table. <ort 3 also receives some control signals for .lash programming and verification.
03
RST
-eset input. " high on this pin for two machine cycles while the oscillator is running resets the device. This pin drives :igh for 8? oscillator periods after the ,atchdog times out. The DIS-T bit in S.- "2B- 'address 7!:( can be used to disable this feature. In the default state of bit DIS-T $ the -!S!T :IA: out feature is enabled.
ALE@PRO'
"ddress >atch !nable '">!( is an output pulse for latching the low byte of the address during accesses to e#ternal memory. This pin is also the program pulse input '<- A( during .lash programming. In normal operation$ ">! is emitted at a constant rate of 16? the oscillator fre%uency and may be used for e#ternal timing or clocking purposes. @ote$ however$ that one ">! pulse is skipped during each access to e#ternal data memory. If desired$ ">! operation can be disabled by setting bit G of S.- location 7!:. ,ith the bit set$ ">! is active only during a 1 ;B or 1 ;C instruction. therwise$ the pin is weakly pulled high. Setting the ">!&disable bit has no effect if the microcontroller is in e#ternal e#ecution mode.
PSEN:
<rogram Store !nable '<S!@( is the read strobe to e#ternal program memory. ,hen the "T78S91 is e#ecuting code from e#ternal program memory$ <S!@ is activated twice each
0=
machine cycle$ e#cept that two <S!@ activations are skipped during each access to e#ternal data memory.
EA@2PP:
!#ternal "ccess !nable. !" must be strapped to A@D in order to enable the device to fetch code from e#ternal program memory locations starting at GGGG: up to ....:. @ote$ however$ that if lock bit 1 is programmed$ !" will be internally latched on reset. !" should be strapped to ;CC for internal program e#ecutions. This pin also receives the 10&volt programming enable voltage ';<<( during .lash programming.
&TAL1:
Input to the inverting oscillator amplifier and input to the internal clock operating circuit.
&TAL2:
utput from the inverting oscillator amplifier.
09
0?
OSCILLATOR CONNECTIONS:
e)tio
0E
Fig: 3.11 #ASIC #LOC1 DIA'RAM OF AT;?S61 O 5CAi9 Memo,y refers to any memory 'Code$ -"1$ or other( that physically e#ists on the microcontroller itself. n&chip memory can be of several types$ but wePll get into that shortly. EBte, +( Co%e Memo,y is code 'or program( memory that resides off&chip. This is often in the form of an e#ternal !<- 1. EBte, +( RAM is -"1 memory that resides off&chip. This is often in the form of standard static -"1 or flash -"1. Co%e Memo,y is the memory that holds the actual 78S91 program that is to be run. This memory is limited to ?=F and comes in many shapes and si)esL Codememory may be found on& chip$ either burned into the microcontroller as - 1 or !<- 1. Code may also be stored completely off&chip in an e#ternal - 1 or$ more commonly$ an e#ternal !<- 1. .lash -"1
07
is also another popular method of storing a program. ;arious combinations of these memory types may also be used&&that is to say$ it is possible to have =F of code memory on&chip and ?=k of code memory off&chip in an !<- 1.,hen the program is stored on&chip the ?=F ma#imum is often reduced to =k$ 7k$ or 1?k. This varies depending on the version of the chip that is being used. !ach version offers specific capabilities and one of the distinguishing factors from chip to chip is how much - 16!<- 1 space the chip has.
08
"s is illustrated in above map$ the 78S91 has a bank of 107 bytes of Internal -"1. This Internal -"1 is found on&chip on the 78S91 so it is the fastest -"1 available$ and it is also the most fle#ible in terms of reading$ writing$ and modifying it/s contents. Internal -"1 is volatile$ so when the 78S91 is reset this memory is cleared. 3.3.= RE'ISTER #AN1S: The 78S91 uses 7 *-* registers which are used in many of its instructions. These *-* registers are numbered from G through E '-G$ -1$ -0$ -3$ -=$ -9$ -?$ and -E(. These registers are generally used to assist in manipulating values and moving data from one memory location to another the "ccumulator. Thus if the "ccumulator '"( contained the value ? and -= contained the value 3$ the "ccumulator would contain the value 8 after this instruction was e#ecuted.:owever$ as the memory map shows$ the *-* -egister -= is really part of Internal -"1. Specifically$ -= is address G=h. This can be see in the bright green section of the memory map.But$ the 78S91 has four distinct register banks. ,hen the 78S91 is first booted up$ register bank G 'addresses GGh through GEh( is used by default. :owever$ your program may instruct the 78S91 to use one of the alternate register banksN i.e.$ register banks 1$ 0$ or 3. In this case$ -=
3G
will no longer be the same as Internal -"1 address G=h. .or e#ample$ if your program instructs the 78S91 to use register bank 3$ *-* register -= will now be synonomous with Internal -"1 address 1Ch. The concept of register banks adds a great level of fle#ibility to the 78S91$ especially when dealing with interrupts 'wePll talk about interrupts later(. :owever$ always remember that the register banks really reside in the first 30 bytes of Internal -"1.
31
CRC RE'ISTERS:
The *-* registers are a set of eight registers that are named -G$ -1$ etc. up to and including -E.These registers are used as au#illary registers in many operations. To continue with the above e#ample$ perhaps you are adding 1G and 0G. The original number 1G may be stored in the "ccumulator whereas the value 0G may be stored in$ say$ register -=. To process the addition you would e#ecute the command
C#C RE'ISTER:
The *B* register is very similar to the "ccumulator in the sense that it may hold an 7&bit '1&byte( value.The *B* register is only used by two 78S91 instructionsL 12> "B and DI; "B. Thus$ if you want to %uickly and easily multiply or divide " by another number$ you may store the other number in *B* and make use of these two instructions. "side from the 12> and DI; instructions$ the *B* register is often used as yet another temporary storage register much like a ninth *-* register.
30
the address indicated by D<T-.,hile D<T- is most often used to point to data in e#ternal memory$ many programmers often take advantge of the fact that it/s the only true 1?®ister available. It is often used to store 0&byte values which have nothing to do with memory locations.
33
A"T!L ,hen set$ start and stop of timer by hardware ,hen reset$ start and stop of timer by software
C6TL
M1
M<
MODE
OPERATIN' MODE
T.1
T-1
T.G
T-G
I!1
IT1
I!G
ITG
3=
T.L
Timer overflow flag. Set by hardware when the timer6counter overflows. It is cleared by hardware$ as the processor vectors to the interrupt service routine.
T-L I!L
Timer run control bit. Set or cleared by software to turn timer or counter on6off. Set by C<2 when the e#ternal interrupt edge ':&to&> transition( is detected. It is cleared by C<2 when the interrupt is processed.
ITL
39
FEATURES
perating voltageL 0.=;U10; >ow power and high noise immunity C1 S technology >ow standby current Three words transmission Built&in oscillator needs only 9H resistor !asy interface with an -. or infrared transmission media 1inimal e#ternal components
Fig: 3.12 #ASIC #LOC1 DIA'RAM OF ENCODER The 317encoders are a series of C1 S >SIs for remote control system applications. They are capable of encoding 17 bits of information which consists of @ address bits and 17V@ data bits. !ach address6data input is e#ternally trinary programmable if bonded out. It is otherwise set 3?
floating internally. ;arious packages of the 317 encoders offer fle#ible combinations of programmable address6data to meet various application needs. The programmable address6 data is transmitted together with the header bits via an -. or an infrared transmission medium upon receipt of a trigger signal. The capability to select a T! trigger type or a D"T" trigger type further enhances the application fle#ibility of the 317 series of encoders.
PIN ASSI'NMENT
TE T,igge, Ty9e
3E
Notes:
D10UD1E
are
data T!
input is
and the
transmission transmission
enable enable
pins pin
of of
the the
:T?17E6:T?0GE6:T?0=E. :T?GG6:T?=G6:T?7G.
37
3.6 DECODER
" decoder is a device which does the reverse of an encoder$ undoing the encoding so that the original information can be retrieved. The same method used to encode is usually +ust reversed in order to decode. In digital electronics$ a decoder can take the form of a multiple&input$ multiple& output logic circuit that converts coded inputs into coded outputs$ where the input and output codes are different. e.g. n&to&0n$ binary&coded decimal decoders. !nable inputs must be on for the decoder to function$ otherwise its outputs assume a single *disabled* output code word.
A99(i)+tio s
Burglar alarm system Smoke and fire alarm system Aarage door controllers Car door controllers Car alarm system Security system Cordless telephones ther remote control systems
Fe+t!,es
perating voltageL 0.=;U10; >ow power and high noise immunity C1 S technology >ow standby current Capable of decoding 17 bits of information <airs with : >T!F/s 317 series of encoders 7U17 address pins GU7 data pins Trinary address setting Two times of receiving check Built&in oscillator needs only a 9H resistor ;alid transmission indictor !asily interface with an -. or an infrared transmission medium 38
=G
Pi Des),i9tio :
=1
A99(i)+tio s:
Burglar alarm system Smoke and fire alarm system Aarage door controllers Car door controllers Car alarm system Security system Cordless telephones ther remote control systems
create a conductive path through air. This property is e#ploited by Phigh fre%uencyP units used in electric arc welding. "nother special property is an electromagnetic force that drives the -. current to the surface of conductors$ known as the skin effect. "nother property is the ability to appear to flow through paths that contain insulating material$ like the dielectric insulator of a capacitor. The degree of effect of these properties depends on the fre%uency of the signals. N+me !#tremely low fre%uency !>. Sym$o( R+ ge 3 to 3G :) 4+3e(e gtA 1G$GGG km to 1GG$GGG km A99(i)+tio s audible 0GO :)$ communication with submarines
=0
Super low fre%uency 2ltra low fre%uency ;ery low fre%uency >ow fre%uency 1edium fre%uency :igh fre%uency ;ery high fre%uency 2ltra high fre%uency Super high fre%uency !#tremely high fre%uency
S>.
3G to 3GG :) 3GG :) to 3 k:) 3 to 3G k:) 3G to 3GG k:) 3GG to 3GGG k:) 3 to 3G 1:) 3G to 3GG 1:) 3GG to
audible$ "C power grids '9G hert) and ?G hert)( audible$ communication with mines audible range 0G :) to 0G k:) 'to
2>.
;>.
1G to 1GG km
>.
1 to 1G km
1.
1GG m to 1 km broadcasting$ maritime and aviation communication 1G to 1GG m shortwave$ citi)ensP band radio .1 broadcasting$ broadcast television$ aviation broadcast television$ mobile 1G to 1GG cm telephones$ wireless networking$ microwave ovens 1 to 1G cm wireless networking$ radar$ satellite links. microwave data links$ radio
:.
;:.
1 to 1G m
2:.
3GGG 1:)
S:.
3 to 3G A:)
!:.
3G to 3GG A:)
1 to 1G mm
3.= Table for fre%uency of -. The T,S&=3= and -,S&=3= are e#tremely small$ and are e#cellent for applications re%uiring short&range -. remote controls. The transmitter module is only 163 the si)e of a standard postage stamp$ and can easily be placed inside a small plastic enclosure.
=3
T,S&=3=L The transmitter output is up to 7m, at =33.801:) with a range of appro#imately =GG foot 'open area( outdoors. Indoors$ the range is appro#imately 0GG foot$ and will go through most walls....
. T,S&=3=" The T,S&=3= transmitter accepts both linear and digital inputs$ can operate from 1.9 to 10 ;olts&DC$ and makes building a miniature hand&held -. transmitter very easy. The T,S&=3= is appro#imately the si)e of a standard postage stamp.
==
Fig: 3.1= CIRCUIT DIA'RAM OF T4S "3" -,S&=3=L The receiver also operates at =33.801:)$ and has a sensitivity of 3u;. The -,S&=3= receiver operates from =.9 to 9.9 volts&DC$ and has both linear and digital outputs.
Date -ateL =7GG bps SelectivityL &1G? dB Channel SpacingL 11:W Supply ;oltageL 9; :igh Sensitivity <assive Design. Simple To "pply with >ow !#ternal Count.
-,S&=3= -eceiver
Fig:3.1: R4S5"3" Pi Di+g,+m Note: .or ma#imum range$ the recommended antenna should be appro#imately 39cm long. To convert from centimeters to inches && multiply by G.383E. .or 39cm$ the length in inches will be appro#imately 39cm # G.383E J 13.EE89 inches long. ,e
=?
tested these modules using a 1=*$ solid$ 0= gauge hobby type wire$ and reached a range of over =GG foot. Dour results may vary depending on your surroundings.
=E
=7
PIN DESCRIPTION:
"s you would probably guess from this description$ the interface is a parallel bus$ allowing simple and fast reading6writing of data to and from the >CD.
Des),i9tio
*-6S* VInstruction6-egister Select *-6,* V-ead6,rite >CD -egisters *!* Clock Data I6 <ins
"bove is the %uite simple schematic pin diagram. The >CD panelPs !nable and Register Select is connected to the Control <ort. The Control <ort is an open collector 6 open drain output. ,hile most <arallel <orts have internal pull&up resistors$ there are a few which donPt. Therefore by incorporating the two 1GF e#ternal pull up resistors$ the circuit is more portable for a wider range of computers$ some of which may have no internal pull up resistors. ,e make no effort to place the Data bus into reverse direction. Therefore we hard wire the R/W line of the >CD panel$ into write mode. This will cause no bus conflicts on the data lines. "s a result we cannot read back the >CDPs internal Busy .lag$ which tells us if the >CD has accepted and finished processing the last instruction. This problem is overcome by inserting known delays into our program.
=8
The 1Gk <otentiometer controls the contrast of the >CD panel. @othing fancy here. Dou can use a bench power supply set to 9v or use a onboard O9 regulator. The 0 line # 1? character >CD modules are available from a wide range of manufacturers and should all be compatible with the :D==E7G. The diagram to the right$ shows the pin numbers for these devices. ,hen viewed from the front$ the left pin is pin 1= and the right pin is pin 1. >CDs can be added %uite easily to an application and use as few as three digital output pins for control. "s for cost$ >CDs can be often pulled out of old devices or found in surplus stores for less than a dollar. The most common connector used for the ==E7G&based >CDs is 1= pins in a row$ with pin centers G.1GG* apart.
=.1 wave form of >CD Data "s you would probably guess from this description$ the interface is a parallel bus$ allowing simple and fast reading6writing of data to and from the >CD. This waveform will write an "SCII Byte out to the >CDPs screen. The "SCII code to be displayed is eight bits long and is sent to the >CD either four or eight bits at a time. If four&bit mode is used$ two *nibbles* of data 'Sent high four bits and then low four bits with an *!* Clock pulse with each nibble( are sent to make up a full eight&bit transfer. The *!* Clock is used to initiate the data transfer within the >CD.
9G
Sending parallel data$ as either four or eight bits are the two primary modes of operation. ,hile there are secondary considerations and modes$ deciding how to send the data to the >CD is most critical decision to be made for an >CD interface application. !ight&bit mode is best used when speed is re%uired in an application and at least ten I6 pins are available. .our&bit mode re%uires a minimum of si# bits. To wire a microcontroller to an >CD in four&bit mode$ +ust the top four bits 'DB=&E( are written to. The *-6S* bit is used to select whether data or an instruction is being transferred between the microcontroller and the >CD. If the Bit is set$ then the byte at the current >CD *Cursor* <osition can be read or written. ,hen the Bit is reset$ either an instruction is being sent to the >CD or the e#ecution status of the last instruction is read back 'whether or not it has completed(. The different instructions available for use with the ==E7G are shown in the table belowL R@S R@4 D: D= D6 D" D3 D2 D1 D< = G G G G G G G G G 1 1 9 G G G G G G G G 1 G 1 1= 13 10 11 1G 8 G G G G G G G G G G G G G G G G G G G G G G G G G 1 G G 7 G 1 E <ins 1 Clear Display C -eturn Cursor and >CD to :ome <osition I st,!)tio @Des),i9tio
1 ID S Set Cursor 1ove Direction D C B !nable Display6Cursor C 1ove Cursor6Shift Display C Set Interface >ength
1 SC -> C C
1 D> @ .
1 " " " " " " 1ove Cursor into CA-"1
1 " " " " " " " 1ove Cursor to Display B. C C C C C C C <oll the *Busy .lag* ,rite a Character to the Display at the Current Cursor <osition
D D D D D D D D
91
*C* & @ot 2sed6Ignored. This bit can be either *1* or *G* Set Cursor 1ove DirectionL ID & Increment the Cursor "fter !ach Byte ,ritten to Display if Set S & Shift Display when Byte ,ritten to Display !nable Display6Cursor D & Turn Display n '1(6 ff 'G( C & Turn Cursor n '1(6 ff 'G( B & Cursor Blink n '1(6 ff 'G( 1ove Cursor6Shift Display SC & Display Shift n '1(6 ff 'G( -> & Direction of Shift -ight '1(6>eft 'G( Set Interface >ength D> & Set Data Interface >ength 7'1(6='G( @ & @umber of Display >ines 1'G(60'1( . & Character .ont 9#1G'1(69#E'G( <oll the *Busy .lag* B. & This bit is set while the >CD is processing 1ove Cursor to CA-"16Display " & "ddress -ead6,rite "SCII to the Display D & Data -eading Data back is best used in applications$ which re%uired data to be moved back and forth on the >CD 'such as in applications which scroll data between lines(. The *Busy .lag* can be polled to determine when the last instruction that has been sent has completed processing. This simplifies the application because when data is read back$ the microcontroller I6 pins have to be alternated between input and output modes.
90
.or most applications$ there really is no reason to read from the >CD. "s well as making my application software simpler$ it also frees up a microcontroller pin for other uses. Different >CDs e#ecute instructions at different rates. In terms of options$ it is seen that a 9#1G >CD display. This means that the *.* bit in the *Set Interface Instruction* should always be reset 'e%ual to *G*(. Before you can send commands or data to the >CD module$ the 1odule must be initiali)ed. .or eight&bit mode$ this is done using the following series of operationsL 1. ,ait more than 19 msecs after power is applied. 0. ,rite G#G3G to >CD and wait 9 msecs for the instruction to complete 3. ,rite G#G3G to >CD and wait 1?G usecs for instruction to complete =. ,rite G#G3G "A"I@ to >CD and wait 1?G usecs or <oll the Busy .lag 9. Set the perating Characteristics of the >CD ,rite *Set Interface >ength* ,rite G#G1G to turn off the Display ,rite G#GG1 to Clear the Display ,rite *Set Cursor 1ove Direction* Setting Cursor Behavior Bits ,rite *!nable Display6Cursor* I enable Display and ptional Cursor In describing how the >CD should be initiali)ed in four bit mode$ will specify writing to the >CD in terms of nibbles. This is because initially$ +ust single nibbles are sent 'and not two$ which make up a byte and a full instruction(. "s mentioned above$ when a byte is sent$ the high nibble is sent before the low nibble and the *!* pin is toggled each time four bits is sent to the >CD. To initiali)e in four bit modeL 1. ,ait more than 19 msecs after power is applied. 0. ,rite G#G3 to >CD and wait 9 msecs for the instruction to complete 3. ,rite G#G3 to >CD and wait 1?G usecs for instruction to complete =. ,rite G#G3 "A"I@ to >CD and wait 1?G usecs 'or poll the Busy .lag( 9. Set the perating Characteristics of the >CD
93
?. ,rite G#G0 to the >CD to !nable .our Bit 1ode "ll following instruction6Data ,rites re%uire two nibble writesL ,rite *Set Interface >ength* ,rite G#G16G#GG to turn off the Display ,rite G#GG6G#G1 to Clear the Display ,rite *Set Cursor 1ove Direction* Setting Cursor Behavior Bits ,rite *!nable Display6Cursor* I enable Display and ptional Cursor nce the initiali)ation is complete$ the >CD can be written to with data or instructions as re%uired. !ach character to display is written like the control bytes$ e#cept that the *-6S* line is set. During initiali)ation$ by setting the *S6C* bit during the *1ove Cursor6Shift Display* command$ after each character is sent to the >CD$ the cursor built into the >CD will increment to the ne#t position 'either right or left(. @ormally$ the *S6C* bit is set 'e%ual to *1*( along with the *-6>* bit in the *1ove Cursor6Shift Display* command for characters to be written from left to right 'as with a *Teletype* video display(. 1ost >CD displays have a ==E7G and support chip to control the operation of the >CD. The ==E7G is responsible for the e#ternal interface and provides sufficient control lines for si#teen characters on the >CD. The support chip enhances the I6 of
the ==E7G to support up to 107 characters on an >CD. .rom the table above$ it should be noted that the first two entries '*7#1*$ *1?#1*( only have the ==E7G and not the support chip. This is why the ninth character in the 1?#1 does not *appear* at address 7 and shows up at the address that is common for a two line >CD. It includes the =G characters by = line '*=G#=*( >CD because it is %uite common. @ormally$ the >CD is wired as two =G#0 displays. The actual connector is normally si#teen bits wide with all the fourteen connections of the ==E7G in common$ e#cept for the *!* 'Strobe( pins. The *!* strobes are used to address between the areas of the display used by the two devices. The actual pin outs and character addresses for this type of display can vary between manufacturers and display part numbers.
9=
Fig: ".2 MO2IN' CURSOR LCD DISPLAY @ote that when using any kind of multiple ==E7G >CD display$ you should probably only display one ==E7GPs Cursor at a time. Cursors for the ==E7G can be turned on as a simple underscore at any time using the *!nable Display6Cursor* >CD instruction and setting the *C* bit. donPt recommend using the *B* '*Block 1ode*( bit as this causes a flashing full character s%uare to be displayed and it really isnPt that attractive. The >CD can be thought of as a *Teletype* display because in normal operation$ after a character has been sent to the >CD$ the internal *Cursor* is moved one character to the right. The *Clear Display* and *-eturn Cursor and >CD to :ome <osition* instructions are used to reset the CursorPs position to the top right character on the display. To move the Cursor$ the *1ove Cursor to Display* instruction is used. .or this instruction$ bit E of the instruction byte is set with the remaining seven bits used as the address of the character on the >CD the cursor is to move to. These seven bits provide 107 addresses$ which matches the ma#imum number of >CD character addresses available. The table above should be used to determine the address of a character offset on a particular line of an >CD display.
99
The last aspect of the >CD to discuss is how to specify a contrast voltage to the Display. I typically use a potentiometer wired as a voltage divider. This will provide an easily variable voltage between Around and ;cc$ which will be used to specify the contrast 'or *darkness*( of the characters on the >CD screen. Dou may find that different >CDs work differently with lower voltages providing darker characters in some and higher voltages do the same thing in others. There are a variety of different ways of wiring up an >CD. "bove$ I noted that the ==E7G could interface with four or eight bits. To simplify the demands in microcontrollers$ a shift register is often used 'as is shown in the diagram below( to reduce the number of I6 pins to three.
.igL=.3 Shift -egister >CD Data ,rite This can be further reduced by using the circuit shown below in which the serial data is combined with the contents of the shift register to produce the *!* strobe at the appropriate interval. This circuit *"@Ds* 'using the 1F resistor and I@81= diode( the output of the si#th *D&.lip .lop* of the E=>S1E= and the *Data* bit from the device writing to the >CD to form the *!* Strobe. This method re%uires one less pin than the three wire interface and a few more instructions of code.
9?
.igL=.0 >CD Shift -egister >CD Data ,rite ! normally use a E=>S1E= wired as a shift register 'as is shown in the schematic
diagram( instead of a serial&in6parallel&out shift register. This circuit should work without any problems with a dedicated serial&in6parallel&out shift register chip$ but the timings6clock polarities may be different. ,hen the E=>S1E= is used$ note that the data is latched on the rising 'from logic *low* to *high*( edge of the clock signal..
9E
In the diagram to the right$ It is shown that how the shift register is written to for this circuit to work. Before data can be written to it$ the shift register is cleared by loading every latch with )eros. @e#t$ a *1* 'to provide the *!* Aate( is written followed by the *-6S* bit and the four data bits. nce the is loaded in correctly$ the
*Data* line is pulsed to Strobe the *!* bit. The biggest difference between the three wire and two wire interface is that the shift register has to be cleared before it can be loaded and the two wire operation re%uires more than twice the number of clock cycles to load four bits into the >CD. 2sing this circuit with the <IC 1icro$ 7G91 and ";- and it really makes the wiring of an >CD to a microcontroller very simple. " significant advantage of using a shift register$ like the two circuits shown here$ data to the >CD is the lack of timing sensitivity that will be encountered. The biggest issue to watch for is to make sure the *!* StrobePs timing is within specification 'ie greater than =9G nsecs($ the shift register loads can be interrupted without affecting the actual write. This circuit will not work with pen&Drain only outputs ne note about the >CDPs *!* Strobe is that in some
documentation it is specified as *high* level active while in others$ it is specified as falling edge active.
97
98
into a 2"-T. The pulse length however was cut down to 361?th of a -S030 bit length to conserve power considering these devices are mainly used on diaries$ laptops and palmtops. =. 1icrocontrollerPs have also proven to be %uite popular recently. 1any of these have in built SCI 'Serial Communications Interfaces( which can be used to talk to the outside world. Serial Communication reduces the pin count of these 1<2Ps. nly two pins are commonly used$ Transmit Data 'TBD( and -eceive Data '-BD( compared with at least 7 pins if you use a 7 bit <arallel method 'Dou may also re%uire a Strobe(.
1. " *Space* 'logic G( will be between O3 and O09 ;olts. 0. " *1ark* '>ogic 1( will be between &3 and &09 ;olts. 3. The region between O3 and &3 volts is undefined. =. "n open circuit voltage should never e#ceed 09 volts. 'In -eference to A@D( 9. " short circuit current should not e#ceed 9GGm". The driver should be able to handle this without damage. 'Take note of this oneT(
?G
Fig:6.2 DB9: View looking into female connector "bove is no where near a complete list of the !I" standard. >ine Capacitance$ 1a#imum Baud -ates etc are also included. .or more information please consult the !I" -S030&C standard. It is interesting to note however$ that the -S030C standard specifies a ma#imum baud rate of 0G$GGG B<ST$ which is rather slow by todayPs standards. " new standard$ -S&030D has been recently released. Serial <orts come in two *si)es*$ There are the D&Type 09 pin connector and the D&Type 8 pin connector both of which are male on the back of the <C$ thus you will re%uire a female connector on your device. Below is a table of pin connections for the 8 pin and 09 pin D&Type connectors.
6.3 MA&232:
The 1"B030 is a dual driver6receiver that includes a capacitive voltage generator to supply !I"&030 '!lectronic Industries "ssociation( voltage levels from a single 9&; supply. !ach receiver converts !I"&030 inputs to 9&; TT>6C1 S levels. These receivers have a typical threshold of 1.3 ; and a typical hysteresis of G.9 ;$ and can accept Y3G&; inputs. !ach driver converts TT>6C1 S input levels into !I"&
?1
030 levels. The driver$ receiver$ and voltage&generator functions are available as cells in the Te#as Instruments >in"SIC. >ibrary.
6." RS232:
Information being transferred between data processing e%uipment and peripherals is in the form of digital data which is transmitted in either a serial or parallel mode. <arallel communications are used mainly for connections between test instruments or computers and printers$ while serial is often used between computers and other peripherals. Serial transmission involves the sending of data one bit at a time$ over a single communications line. In contrast$ parallel communications re%uire at least as many lines as there are bits in a word being transmitted 'for an 7&bit word$ a minimum of 7 lines are needed(. Serial transmission is beneficial for long distance communications$ whereas parallel is designed for short distances or when very high transmission rates are re%uired.
St+ %+,%s
ne of the advantages of a serial system is that it lends itself to transmission over telephone lines The serial digital data can be converted by modem$ placed onto a standard voice&grade telephone line$ and converted back to serial digital data at the receiving end of the line by another modem. fficially$ -S&030 is defined as the
4Interface between data terminal e%uipment and data communications e%uipment using serial binary data e#change.5 This definition defines data terminal e%uipment 'DT!( as the computer$ while data communications e%uipment 'DC!( is the modem. " modem cable has pin&to&pin connections$ and is designed to connect a DT! device to a DC! device.
6.6 INTERRUPT
" single micro M controller can serve several devices. In the inturrpt menthod$ when ever any device needs its service the device notifies the microcontroller by sending it an interrupt signal. 2nit receiving an interrupt signal$ the microcontroller interrupts what ever it is doing and serves the devices. The program associated with the interrupt is called the interrupt service routine 'IS-(.The advantage of interrupts is that the microcontroller can serve many devices based on the priority assigned to it.
?0
?3
=.1.1 INTRODUCTION:
This chapter introduces the Feil C compiler for the Cygnal C7G91.G0G board. ,e assume some familiarity with the C programming language to the level covered by most first courses in the C language. !#perienced C programmers who have little e#perience with the C7G91.G0G architecture should become familiar with the system. The differences in programming the C7G91.G0G in C compared to a standard C program are almost all related to architectural issues. These e#planations will have little meaning to those without an understanding of the C7G91.G0G chip. The Feil C compiler provided with the Cygnal C7G91.G0G board does not come with a floating point library and so the floating point variables and functions should not be used. :owever if you re%uire floating point variables a full license for the Feil C compiler can be purchased.
The standard initiali)ation and startup procedures for the C7G91.G0G are contained in
?=
st+,t!9.+61. This file is included in your pro+ect and will be assembled together with the compiled output of your C program. .or custom applications$ this start up file might need modification. Fi )(!%e G,eg61.AH Fi )(!%e Z );<61-<2<.A [
?9
The default memory model re%uired is selected using the 9,+gm+ compiler control directiveL"ny variable declared in this file 'such as the variable X above( will be stored in the internal memory of the C7G91.G0G. The choice of which memory model to use depends on the program$ the anticipated stack si)e and the si)e of data. If the stack and the data cannot fit in the 107 Bytes of nternal memory then the default memory model should be >"-A!$ otherwise S1">> should be used.Det another memory model is the C 1<"CT memory model. This memory model is not discussed in this chapter. 1ore information on the compact model can be found in the document Cx51 Compiler Users Guide for eil!" #oftware. Dou can test the different memory models with
the Cygnal ID! connected to the C7G91.G0G TB development board. >ook at the symbol view after downloading your program and see in which memory addresses the compiler has stored your variables.
??
access to the internal memory is the fastest$ so fre%uently used data should be stored here while less fre%uently used data should be stored on the e#ternal memory. The memory storage related language e#tensions$ $%+t+0 and associated data types $it$ s$it$ s-, and s-,1= will be discussed in the following sections. "dditional memory storage language e#tensions including$ 9%+t+ and i%+t+0 are not discussed in this chapterN refer to the document Cx51 Compiler Users Guide for eil!" #oftware for information on this.
?E
$%+t+ &K s$it &:-(+g J &M:K @N $it : o- &N@ @N #YTE Registe, N@ s-, P< J <B;<K s-, P1 J <B?<K s-,1= TMR3RL J <B?2K@@ Time,3 ,e(o+% 3+(!e s-,1= TMR3 J <B?"K@@ Time,3 )o! te,
"n assembly program has three constituent partsL 1. 1achine instructions 0. "ssembler directives 3. "ssembler controls " m+)Ai e i st,!)tio is a machine code that can be e#ecuted by the
machine. Detailed discussion of the machine instructions can be found in the hardware manuals of the 7G91 or derivative microcontroller.
?7
Assem$(e, %i,e)ti3es are used to define the program structure and symbols$ and generate non&e#ecutable code 'data$ messages$ etc.(. "ssembler directives instruct the assembler how to process subse%uent assembly language instructions. Directives also provide a way for you to define program constants and reserve space for variables. Assem$(e, )o t,o(s set the assembly modes and direct the assembly flow. "ssembler controls direct the operation of the assembler when generating a listing file or ob+ect file. Typically$ controls do not impact the code that is generated by the assembler. Controls can be specified on the command line or within an assembler source file.
#SE' 111 BS!A \"T absolute address] Define an absolute segment within the Bit address space.
CODE 11= symbols C D! code address "ssign a symbol name to a specific "ddress in the code space.
CSE' 111 CS!A \"T absolute address] Define an absolute segment within the Code addresses space.
?8
DATA 11= symbol D"T" data address assign a symbol name to a specific n&chip data address.
DD 101 \labelL] DD expression \, expr ...] Aenerate a list of double word values . DS 103 \labelL] DS expression -eserve space in byte units.
DSD 10? \labelL] DSD expression -eserve space in double word units . DSE' 111 DS!A \"T absolute address] Define an absolute segment within the Indirect internal data space. Shaded directives and options are available only in "B91 and "091.
DS4 109 \labelL] DS, expression -eserve space in word unitsN "dvances the location counter of the current segment.
D4 10G \labelL] D, expression \$ expr. ...] Aenerate a list of word values. END 13? !@D Indicate end of program.
E&TRN 131
E&TERN !BT-@ class \L type] 'symbol \...]( Defines symbols referenced in the current module that are defined in other modules. .
EG
Several new variants of the 7G91 e#tend the code and6or #data space of the classic 7G91 with address e#tension registers. The following table shows the memory classes used for programming the e#tended 7G91 devices. These memory classes are available for classic 7G91 devices when you are using memory banking with the >B91 linker6locater. In addition to the code banking known from the B>91 linker6locater$ the >B91 linker6locator supports also data banking for Bdata and code areas with standard 7G91 devices.
Table ?.1 The memory prefi#es DL IL BL CL BGL .. B31L cannot be used at "#91 assembler level. The memory prefi# is only listed for better understanding. The LB61 linker6locater and several Debugging tools$ for e#ample the Q;ision0 Debugger$ are using memory prefi#es to identify the memory class of the address. If you are using
E1
the Dallas 38G contiguous mode the address space for C D! can be CLGGGG & CLG#.......
:. FLO4 CHART:
<C
2"-T
!@C D!-
-. 'T-"@SI1ISSI @(
-. '-!C!I;!-(
D!C D!-
>CD
E0
;. RESULT:
E3
?. SCHEMATIC DIA'RAM:
U5 VCC R4 1 1 D5 BR D!E VN ! N D VOUT " 220H D4 "MM
LM7805
C7 10uF/25V
C9 0.1uF
2 CON2
VCC
1 C R4 RES STOR S $ 9 9 8 7 % 5 4 " 2 VCC &1 C" 7 8 9 10 11 12 1" 14 2 15 VCC 0.1uF VCC5V VCC 24 17 18 19 VCC 20 21 22 1" 14 15 ANTEENA R* 1% 9 10 R2 "90# 11 2" 1 2 " 4 5 % 7 &7 D" VT 8 "MM 2 1 'uzz() 21 22 2" 24 25 2% 27 28 10 11 12 1" 14 15 1% 17 40 "1 U2 A4 A5 A% A7 A8 A9 A0 A1 A2 A" DN OSC2 U2 AD10 AD11 AD12 AD1" AD14 AD15 AD1% AD17 $2.0/A8 $2.1/A9 $2.2/A10 $2."/A11 $2.4/A12 $2.5/A1" $2.%/A14 $2.7/A15 $".0/R*D $".1/T*D $".2/ NTO $"."/ NT1 $".4/TO $".5/T1 $".%/WR $".7/RD "9 "8 "7 "% "5 "4 "" "2
&" 4 " 2 1
VC C E A /V $ $
VD D
"
R1 10#
LCD
4 % 1 5 1%
1 $1.0 2 $1.1 VCC $1.2 $1." $1.4 $1.5 $1.% $1.7 " 4 5 % 7 8
HT648
OSC1 VSS
RF RECEIVER
12
AT89S52
RST
E=
20
1<. CONCLUSION
The pro+ect PEm$e%%e% $+se% )!stomi.e% /i,e(ess mess+ge )i,)!(+, system -o, )o((ege0 i %!st,iesQ has been successfully designed and tested. Integrating features of all the hardware components used have developed it. <resence of every module has been reasoned out and placed carefully thus contributing to the best working of the unit. .inally we can successfully send the data from the main office room to all classrooms or banks$ railway stations$ industries etc.
E9
E?
12. #I#LIO'RAPHY:
7G91&1IC- C @T- >>!- "@D !1B!DD!D SDST!1.<g.@o.10G&09G
<- A-"11I@A "@D C2ST 1IWI@A T:! 7G91 & 1yke <redko
4E#SITES REFERRED
EE