Professional Documents
Culture Documents
Table of Figures
Chapter 1
Introduction
Domotics ,smart homes ,home automation system are terms used to describe the
cooperation of several In home devices to handle home environment in comfortable ,intelligent and electrically energy efficient way. It is a field that touches electronics, communication, automation and building architecture. Home automation includes a centralized control of lighting, HVA !heating, ventilation air conditioning" and other appliances in order to give improved convenience and energy saving. onsiderable improvements can be made in #uality of life of elderly, and paralyzed persons who might otherwise re#uire a care ta$er. Home automation systems by different companies differ in communication protocol ,communication medium ,topology of networ$ and power consumption .%esides now with current data rate of &' (bps!mega bit per second" )*+,power line carrier communication system are good choice over wireless and other home networ$ing technologies ,due to ease of installation ,availability of A ,reliability ,greater through put and security.),+ plug outlets, low cost
Our project
-ower line communication would appear to be economical and user friendly method for home automation .our pro.ect e/plores such claims and to investigate the challenges we could face. It is about using ,,0v Ac power lines as a ommunication (edium to automate and
control single -hase A devices. 1ser !domestic or industrial" is able to monitor sensors data and control electrical devices using touch screen color display provided by H(I !human machine interference" .H(I is commonly used with -2 s !programmable logic controller" instead of microcontrollers. 3ow here is a uni#ue thing that we have interfaced -I *&45', microcontroller with H(I. 6he scope of this pro.ect is very huge but we have successfully implemented a system that integrates and controls four electric appliances, temperature sensor, door sensor and light sensor.
1.1 Objectives
6o design a 6ransceiver for power line communication.
6o interface H(I with -I *&45', using (odbus -rotocol. 6o design 7raphical user interface !71I" for H(I using 8asy builder&000.
8nergy efficient homes are hot topic these days. 2ot of research has been carried out in power line communication in 1<A ,8urope and (alaysia
Chapter 2
!iterature "evie
2.1 Po er line communication
-ower ;line communication is based on electrical signals, carrying information, propagating 9ver the power;line.)@+ -ower ;line carrier communication refers to a method in which information is transfer through networ$ of electrical power lines as communication channel .and a communication channel is defined as physical path between two nodes on which signal is propagated 6his topic has been in spot light of researchers across the world from #uite couple of years bac$ still there is not any universal standard for -2 ,nor there is any globally accepted worldwide regulatory authority, but some standards are developed from time to time by
different research groups with improvement each time .standards can be classified in two classes depending on data rates for high ,;,0mhz and for low data rate @ ;*5& $Hz.)5+
Home -lug -ower line Alliance 1niversal -ower line Association I888 -*B0* I61;6 home grid forum. 9-8?A !9pen -2 8uropean ?esearch Alliance" -9=8?386 -anasonic
2.2.3
"e&ulator( )uthorities
83828 !8uropean committee for electro technical standardization" 4ederal ommunication ommission !4 Capan (-6 ",
:;*0 and I3<6893 are two industrial standards most commonly used .in our pro.ect we used
2.3 *+1,
It is an international and open industry standard using power line communication for home automation widely spread in 1<A and 8urope. It primarily uses power line wiring for signaling and control applications. It does not use any forward error correction !48 " or cyclic redundancy chec$sum ! ? " techni#ue. 6his protocols uses a form A<D !amplitude shift $eying" and was initially designed for simple/ communication .it uses *,0$hz amplitude modulated carrier signal .to represent digital information .6o minimize interference this signal is superimposed on power line at zero crossings of '0Hz ,,0v ac signal. 6he presence or absence of this burst is used to decode the transmission of E*Fs Eor G0FsH bits respectfully. Addresses are assigned to each node while transmission signal contain room address device address, and function code, but speed limitations !I0 bps"are there and multiple device transmitting at same time can cause collisions .)'+
2.4
-ower line networ$ was not designed for communication purpose .they offer a hostile environment for the propagation of communication signal accurately .two of the biggest impairments of residential power line as communication channel are noise and attenuation )I+. Here we will discuss some types of noise mainly present in power line channel.
2.4.1
6his noise has low power spectral density at fre#uencies ranging ,0;@0 (Hz, but high at low fre#uencies. 6his noise varies with time and caused by devices li$e dimmers, hair dryers and computer
2.4.2
1p to *'0 $Hz range of fre#uencies this type of noise is generated by switching power supplies, fre#uency converters, tube lights, and 6V. Its level varies across the day.
2.4.3
6his type of noise rises due to short voltage pea$s caused mainly by on ;off switching of home appliances. (ostly appear at multiples of '0 Hz fre#uency. 6hese pulses are for very short duration and vanish in micro seconds. Another reason of this type noise is rectifiers in D appliances.
2.4.5
.re6uenc( dependence-
-revious studies show that noise level in residential conditions fluctuate greatly .noise level have tendency towards decreasing as fre#uency increases. In other words communication carrier fre#uency will face less noise if fre#uency is higher .it was also found that fre#uencies above 500$hz are affected more by noise ,as this band is closer to radio band. so power line acts as radio antenna, creating noise. 9n the contrary fre#uencies less than *00 $Hz are more affected by noise as fre#uencies above *00 $Hz.)I+ 9n the other hand, fre#uencies lower than *00 $Hz tend to contain noise inversely proportional to fre#uency.
2.4.7
#i&nal attenuation.
2oss of signal strength as signal travels over some distance is called attenuation. Attenuation remains appro/imately flat if distance is within *0 meters but attenuation increased as distance increase. And it also depends on carrier fre#uency selection
.i&ure 2+ 4 #i&nal attenuation on a po er line across the ,+3,, %'$ 3and. 072 Hence seeing above results it is clear that trade off e/ist fre#uency with attenuation and noise .either low noise and high attenuation with high fre#uency selection .or to use low fre#uency with high noise and low attenuation. <tudies show us that desirable band lies between*00$hz;,00$hz.as we are using *,' $Hz carrier fre#uency so this study provide us solid ground on choosing this fre#uency.
(odbus is usually used to connect a supervisory computer with remote terminal unit !?61" in < ADA systems.
2.7.2 <ersions
(odbus ?61 (odbus A< II (odbus 6 -MI(odbus over !6 (odbus -lus !(%N")B+
2.1
6he (odbus protocol defines a protocol data unit !-D1", introducing additional fields of Application Data 1nit !AD1" .(odbus follows client server communication. In our case -I *&45', is server and H(I is client. lient initiates communication and built AD1.=e will discuss each field of AD1 pac$et below.
2.1.1 .unction code=hen a message is sent from client to server 4unction codeJ tells server which action to perform .valid codes range are *;,'' decimal.*,&;,'' are reserved .o is not a valid function code.
2.1.2 >ata fieldData field contains information .re#uired by server to ta$e action against function code sent by client .it may of zero length in certain cases.i.e. In re#uest frame in which client want information from server data field is zero.
2.1.4 )ddress fieldIt contains address of server and of length * byte. AD1 !Application Data 1nit" O ,'@ bytes N * byte !<erver Address" N, bytes ! ? "O,'Ibytes <o -D1!-rotocol Data 1nit" O4unction code!* byte"NData AD1O-D1NAddressN8rror.
2.4 Modbus Transaction<erver uses function code in response frame to tell client either error has occurred or not .if some error occur then server does not send re#uested data it sends e/ception response 8/ception response consist of e/ception function code and 8/ception code. 8/ception code tells server what action to ta$e in case of error. In case of no error (odbus simply echoes the same function code with data re#uested.
2.4.1 3it )ccessin (odbus discrete output, either 0M* is treated as output" use ,;,5. oils and function code to read coil is ,;,1and to read discrete inputs function code is ,;,2.to write single coil! single bit at
2.4.2 17 bit )ccessIt uses byte operation for analog continuous data li$e ,temperature .(odbus uses holding ?egisters to store data in bye form .and function code to read input register is ,;,4 .)*0+
Chapter 3
"e6uirement #pecification
3.1 Or&ani$ational re6uirements
ID 3?;0,;00* -riority * Details DeliveryJ 6he system development process and deliverable documents shall conform to the process and deliverables defined in the document G II6; 8;0,H Degree -ro.ect <tudentFs 3?;0,;00, * Handboo$F. <tandardJ 6he standard of final product shall be of undergraduate level or above.
3.2
?;ternal re6uirements
-riority @ Details <ecurityJ 6his is a degree pro.ect having no strict security re#uirements.
ID 3?;0@;00*
3?;0@;00,
* 8thicalJ 6he application will not use any type of unethical electronic material while pro.ect development and e/ecution.
3?;0@;00@
* 2egislativeJ 6he application shall not use any private or confidential data, or networ$ information that may infringe copyrights andMor confidentiality of any personnel not directly involved in this product.
3?;0@;005
@ <afetyJ 6his application has 8lectric shoc$ hazard. Avoid touching on board components under operation. ,,0vA
3.3.2 Cate&or( 2
ID 4?;0,;00* 4?;0,;00, 4?;0,;00@ 4?;0,;005 -riority * * * , Details < 9(-I28? 49? -I 8A<Q%1I2D8?&000 49? H(I -?9681< A.I (-2A% ID8
3.3.3 Cate&or( 3
ID 4?;0@;00* 4?;0@;00, 4?;0@;00@ -riority , * * Details 2(A&0' ?8712A69? I A&,'0( HI7H 4?8P13 Q 6?A3<49?(8? *, V926< -9=8? <1--2Q
4?;0@;005 4?;0@;00'
, *
Chapter 4
)rchitecture and Components
6he design of the intended product is e/plained graphically with the help of a bloc$ diagram
4.2
"e6uired Components
=einte$ '.Ainch Interface !H(I"
A&,'0( High 4re#uency -ulse 6ransformer (A: ,@, ?<,@, Driver I 2(@' 6emperature sensor.
4.2.3 #pecifications
-rogram (emory type is 4lash (emory for programming @,Db -1 speed *0 (I-<!mega instruction per second" 88-?9( ,'I bytes ?A( *'@I bytes ommunication peripherals AM8M1<A?6, (<<-!<-IMI, " 4our -orts A,%, , D and 8 6otal IM9 pins @,
4.3
6he -hilips 6DA '0'* A is *Ipin Amplitude shift $eying !A<D" modem, used in power line communications !two wire A " for reception Mtransmission of digital signals .this modem is specially designed for in home applications and operate at low baud rate of I00bps to *,00 bps !ma/imum".its full digital circuitry provides efficient bi directional communication between a control unit and lighting setup and one or more in;home appliances connected to power mains ,,0v A . It operates from single 'V supply.
.i&ure 4+3 pin out confi&uration of modem .i&ure 4+4 T>) 5,51 modem
4.3.1
.eatures
4ull digital modulation.
I00 baud rate, *,00 baud ma/imum Digital demodulator 2ow cost coupling networ$ by using 2 filter without any tunable omponents. I;bit DMA !Digital to Analog" &;bit AMD !Analog to Digital" 4re#uency range B' $Hz to *5&.' $Hz band in compliance with 83'00I' standard.)*,+
4.4.1 #pecifications
Display @,0R,50 pi/els. -1J@,%it ?I< 500(Hz processor D?A(J %uilt in I5 (b DD?, ?am. <torageJ *,& (% flash memory. IM9J serial ports ?<;,@,M?<;5&' and 1<% ,.0. <oftwareJ 8asy builder&000 . ompatible with (odbus protocol.)*@+
of Max232
.re6uenc(
It is isolation transformer which is used at time when carrier signal is in.ected in to power lines through live and neutral wire. onnection between power line modem and ,,0 Ac must be isolated with*J* isolation transformer for safety purposes It is in <(D pac$age and allows high fre#uency signals to pass through with it. (a/imum isolation voltage up to *.' $V.)*5+
MC 'i&h transformer
Chapter 5
.i&ure of T>)5,51 0122 .i&ure 5+2 #chematic dia&ram of Po er line modem 0122
-ower systems operate at low fre#uency and high power where as communication systems operate at high fre#uency low power. <ince we need to have couple our low power, *,' $Hz communication signal on ,,0v mains, there must be some circuitry to couple high fre#uency signal and to prevent our (odem and rest of electronics from ,,0v A . 6his coupling circuitry would be a filter which will allow specific band of fre#uencies to pass and stop low fre#uencies and provide isolation. =e followed design of passive 2 filter suggested by -hilips )tda sheet+ the topology of filter is shown below. 6wo fre#uencies considered here are *,'$hz and '0Hz.this filter completely filtered out power signal '0Hz ,,0V by offering high impedance to it .series of 5Auh high voltage coupling capacitor and 5AuH power inductor with transformer inductance act as a high pass filter..?:M6: -ins are connected to filter with *uf dc bloc$ing capacitor. -reventing from D load of transformer. )*,+)@+
5+3
5.2.2 Issues ith transceiver6his I was not available in -a$istan so we imported from hina. It came in <(D pac$age and we face problem in designing - % of <(D pac$ages, - % ma$ing company made a mirror - % but we managed after some hard wor$. Another issue was of #uartz crystal. local &(Hz crystal available in mar$et was not efficient and it was disturbed circuitry due to electrostatic charge .so we used A3 oscillator but , it was available with ,0 and 5& (Hz oscillator fre#uency. %ut this oscillator did not wor$ for Ac power line although it was
wor$ing for dc power line then we ma$e a new oscillator circuitry using 5& (Hz can oscillator and Cohnson counter 50*A to produce & (Hz oscillator fre#uency out put
5.3.1 #(nta; for serial portUuse rs,@,!baudOBI00, /mitO-I3L I, rcvO-I3L A, parityO3, bitsO&, stopO*" Uuse rs,@,!baudOBI00, /mitO-I3L%I, rcvO-I3L%A, parityO3, bitsO&,streamOmodem"
#(nta;
EHwhile !6?18" V if! modbusL$bhit!""V processLmodbus!"W X inputs)0+ O inputLb!"W outputLa!coils)0+
.i&ure 5+7 .unctional bloc% dia&ram of Modbus and main process. =e are using < compiler in which modbus stac$ is available .Data on (odbus goes to ready
data first .In our software pic has ready data ,in ram there is buffer of coils ,input buffer, and main application use these buffers to put data at out or input ports . -orta or port b.in this test we have onMoff switches on port b .on port a we have 5 leds.port a is of si/ bits ,(odbus uses *I bit holding registers to store data in ram . HereH inputs) + E and Ecoils) +H are holding registersMbuffers .
#(nta;
EHwhile!6?18"V if!modbusL$bhit!""V processLmodbus!"W Xinputs)0+ O inputLb!"W outputLa!coils)0+"
(odbusL$bhit!" chec$s whether any pac$et has come from client !H(I".if yes then it will go to process (odbus .now in process (odbus function ,it chec$s if client has demanded some input or client has some data to show on out put of microcontroller then process (odbus will put that info in ready data. 3ow in our H(I configuration we have assigned 0/5 ,0/*,0/,,0/@ to discrete outputs for coils !switching on Moff" . 3ow to read status of input switches at port % we use this line. It will get input from port % and store at holding register !input ) +" E inputs)0+ O inputLb!" E from there process (odbus will send this data on (odbus through ready data .?8ADQ DA6A aligns the bytes. If H(I sends some output it will go to Ecoils buffer ) +H from there our main application will get output data and map bits on port A. 6here are two layers in processor .foreground main application and in bac$ ground process (odbus is wor$ing .which is in (odbus.h file.
5.4 'MI Confi&uration4or 71I we used 8%&000 software of =einte$ (6I000M&000 series. it is interesting to use. 4irst install this software. go to file menu and select new pro.ect. After selecting H(I name -2 as MO>3=# "T= chose P!C then select local in location menu. In P!C t(pe select (9D%1< ?61.adn chose ?<,@, in -2 IM4. 4or com port settings .and we have faced lot of difficulties in setting this. As our -ower line (odem 6DA'0'* has low baud rate of I00bps.so time out option in set to * sec. All other options are found after many trials. 4or H(I configuration in detail see Appendi/ .
5.4.2 Draphical =ser interface D=I development4inal screen for user will be of following form we will discuss some steps to ma$e this screen.
1 2 3
control
E*
E6o
show
input or status of
door or discrete input either on Moff we used %it lamp shown as press bulb button following window open.
.i&ure 5+E Input bit object address settin&s 1nderstanding of (odbus protocol is re#uired for proper functioning. E,Hto turn devices on Moff we use <et bit buttons. %y pressing re#uired action, either by setting style set on Moff. a new window will pop up.
As in modbus protocol 0: is used for discrete output so configure each push button for
.i&ure Output settin& ?34,,, F3 Fto get temperature (odbus use *I bit registers .use numeric display new window will popup as shown in below figure.
5+1, coils
option .and
As (odbus uses 5/ register address for storing analog data input. so we assign starting address 5/ and inde/ is *.this finishes placing buttons for switches and temperature display. )fter this compile the pro&ram usin& reboot. and do nload to 'MI. It ill
5.5
#lave unit-
9n our slave side .slave unit consist of 5 relays a connected to -I *& 45', with relay driver I 123 ,00@. A temperature sensor and ?eed sensor are connected to slave controller. ?eed sensor is used for door opening and sensing .reed sensor is connected to ?A*!pin @" through opt coupler -c&*A.realys are connected on port % of -I *&45',through *$ resistance that are %0,%*,%,,%@ .these pins are to 3-3 transistor array .temperature sensor 2(@' is connected to pin ,!A0". 6DA'0'* (odem ?: pin is connected to pin,' ? I 6: of pic*&f5', and ?: pin of (odem is connected to -in ,I !6: of controller" for serial communication .In slave only one hardware 1A?6 of controller was used.
5.5.1 @or%in& of "ela( driver3-3 transistors are use as relay drivers. In 3-3 when base gets voltage it then at output !collector " 0 volt from 8mitter is transferred. %ase is input. 8mitter is connected to ground. 3ow when there is no voltage at base we get some negative voltage at collector. 6his in result did not allow relay *,v to complete its circuit and energize the coil. <o when input is given !'v" to relay is energized
.i&ure 5+12 circuit Diode D* connected to relay is used here to avoid bac$ 8(4 of relay.
"ela( driver
5.5.7
6o electrically insulate we use photo couplers .when any voltage upto ,0V is applied at input led will glow which switch -3- transistor on we will get 'V at collector .instead of applied ,0 volts.
Chapter 7
?valuation G "esults
=e have focused on through testing and evaluation in design and implementation phase .starting from theoretical design to hardware implementation we have faced lot of hurdles especially the power line (odem and filter design .=e first used 4<D modulation as I Fs were locally available. And we successfully were able to design 4<D modulator and demodulator using -hilips 38'I5.althoughr resulting wave form was very good enough but it was very much component dependent i.e. tuning issue. And these I Fs are not designed for power line communication .I which use 4<D for power line communication li$e stA'@& were very costly so we switched to 6DA'0'* as it was more suitable to our design for low data rate home control.6DA'0'* I , A&,'0( transformer, were imported from china and it too$ long time. rystal oscillator was another big issue. As we first use & (Hz local crystal :6A2 but our modem ic, it didnFt wor$ so we then tried ,0(hz #uartz oscillator which gave results at @*@ DHz fre#uency. but still we were not able to run power line. &(Hz crystal for *,' DHz modulation fre#uency was needed. 6his was not available in mar$et .we somehow managed to get 6: oscillator 5& (HT which was used with Cohnson counter to get & (Hz cloc$.
power line for accurate filtration. 6his problem was solved by using :, type imported high
?e#uirement 6ested 4?;0*;00* 4?;0*;00@ 4?;0*;005 4?;0*;00' 4?;0*;00, 4?;0*;00* 4?;0@;00* 4?;0@;005 4?;0@;00'
Q 28 * 4ailed 4ailed
Q 28 , 4ailed 9$
4I3A2 <6A61< 9$ 9$
D86AI2< -ower line (odem H(I (A:,@, 6ransformer <erial communication (odem I A&0' I -hoto coupler 2(@' 6emp.sensor
4?;0@;00I
4ailed
4ailed
9$
9scillator
Chapter 1
Conclusion and .uture or%
1.1 Conclusion
6he ob.ective of our -ro.ect E<mart %uilding (anagement <ystem using -ower line carrier communication !-2 " > (9D%1<H was to design and implement the concept of centralized control unit for a building along with using already installed ,,0v single phase house wiring as communication medium .Important part was to interface H(I with microcontroller using (odbus protocol and to realize the concept of power lines as communication medium. 9ur pro.ect can improve convenience of paralyzed and disabled persons and can reduce electrical energy consumption reducing monthly electricity bill. 1p to *,& rooms can be controlled using our developed protocol.
=ith higher order modulation scheme data rate can be increased, high data rate power line communication is also called broad band power line communication. (odem can be developing which will provide high data rate communications li$e computer networ$ing. #calabilit(J (ore slaves can be added to central control unit. "educe the si$e of componentsJ 4abrication on a single chip for slave board can ma$e it more reliable and efficient and ma$e a plug and play device. <ideo surveillanceJ 6o improve home security camera can be attached our e/isting system but it will re#uire high data rate power line modem. Improved D=I .Advance graphics can be used to give a more user friendly and attractive loo$.
"eferences
)*+ Home plug <tandards Association Available at httpJMMwww.homeplug.orgMhome.Accessed !A 9ctober ,0**". ),+ Dhurram .H. Tuberi (.< 6hesis !,00@" ,E-ower line communication systemH, D6H ?oyal Institute of 6echnology. )@+ 2ars <elander, (.< thesis !*BBB" E-ower;2ine ommunications hannel -roperties and ommunication. <trategiesH, 2und 1niversity. )5+ -ower 2ine ommunication by Hendri$ . 4erreira, 2utz 2ampe, Cohn 3ewbury, 6heo 7. <wart. )'+ :;*0 -rotocol specification Available at www./*0pro.com.Accessed !, Culu ,0**". )I+ 7erhard Dorf and, 7.A ?icher (.< 6hesis !,000",HDesign of powerline home Automation systemH, 1niversity of -retoria, <outh Africa. )A+ 8lena (ainardi and (arcello %onfY,! ,00'" E-owerline ommunication in Home;%uilding Automation systems H, 1niversity of 4errara ,Italy. )&+ Halid Hrasnica, Abdel.4.Haidine and ?alf 2ehner E%roadband powerline communications networ$sH, =illey ,005. )B+ www.simplymodbus.caMfa#.htm Accessed !*' 9ctober ,0**". )*0+ Modbus Application Protocol v1.1 b, Available atJ
www.modbus.orgMdocsM(odbusLApplicationL-rotocolLV*L*b.pdf Accessed !*A 3ovember ,0**". )**+ Datasheet of PIC18F !" Available at ww*.microchip.com Accessed ! @ Culy ,0**". )*,+ #DA !$!1 Datasheet Available at J www.n/p.comMdocumentsMdataLsheetM6DA'0'*A.pdf Accessed ! *@ <eptember ,0**". )*@+ M#!$!%i &MI Data sheet Available at ftpJMMftp.weinte$.comMData<heetM...M(6I0'IiLData<heetL837L**0 Accessed !,@ <eptember ,0**" . )*5+ Murata #ransfor'er Datasheet Available at J www.murata;ps.comMdataMmagneticsM$mpLA&,'0.pd Accessed !** December ,0**".
)ppendi; )
#ource code for #lave =nit .
(AI3.c Uinclude Zmain.h[
UI3 21D8 Zstdlib.h[ UI36L?DA V9ID I<?LHA3D!void"V r/Ofgetc!pc"W if!r/OO\a\" ?82AQ5L93W if!r/OO\b\" ?82AQIL93W if!r/OO\c\" ?82AQAL93W if!r/OO\d\" ?82AQ&L93W if!r/OO\e\" ?82AQ5L944W if!r/OO\f\" ?82AQIL944W if!r/OO\g\" ?82AQAL944W if!r/OO\h\" ?82AQ&L944W if!r/OO\i\"V fputc!input*,pc"W delayLms!*"W X if!r/OO\.\"V fputc!input,,pc"W delayLms!*"W X if!r/OO\t\"V fputc!ma$e&!temperature*I,0",pc"W delayLms!*0"W fputc!ma$e&!temperature*I,*",pc"W
delayLms!*0"W XMM if!r/OO\t\" XMM rda voidreadLtemp!"V setLadcLchannel!0"W delayLus!'0"W temperature*IO!int*I"!!readLadc!";,"M,"W delayLms!'"W XMM 8nd void readLtemp!"
void main!" V setLtrisLa!0b********"W setLtrisLb!0b00000000"W setLtrisLc!0b*00*****"W setLtrisLd!0b00000000"W setLtrisLe!0b00000000"W setupLadc!adcLcloc$Linternal"W setupLadcLports!A30"W enableLinterrupts!729%A2"W enableLinterrupts!I36L?DA"W %1TT8?L944W ?82AQ5L944W ?82AQIL944W
?82AQAL944W ?82AQ&L944W for!loopO0WloopZ5WloopNN"V 28DL93W %1TT8?L93W delayLms!@00"W %1TT8?L944W 28DL944W delayLms!@00"W XMM end for 28DL944W while!6?18"V input*OinputLstate!I3L*"W delayLms!*0"W input,OinputLstate!I3L,"W delayLms!*0"W readLtemp!"W X X
'eader file for slaveUinclude Z*&45',.h[ Udevice RO*I,adcO*0 U41<8< H< U41<8< 39=D6 U41<8< 39%?9=3916 U41<8< 392VIM9 MM3o =atch Dog 6imer MM3o brownout reset MM3o low voltage prgming, %@!-I *I" or %'!-I *&" used for
Udefine ?82AQL5 Udefine ?82AQLI Udefine ?82AQLA Udefine ?82AQL& Udefine 28D Udefine %1TT8? Udefine 28DL93 Udefine 28DL944
Udefine %1TT8?L93 outputLhigh!%1TT8?" Udefine %1TT8?L944 outputLlow!%1TT8?" Udefine ?82AQ5L93 outputLhigh!?82AQL5" Udefine ?82AQ5L944 outputLlow!?82AQL5" Udefine ?82AQIL93 outputLhigh!?82AQLI" Udefine ?82AQIL944 outputLlow!?82AQLI" Udefine ?82AQAL93 outputLhigh!?82AQLA" Udefine ?82AQAL944 outputLlow!?82AQLA" Udefine ?82AQ&L93 outputLhigh!?82AQL&" Udefine ?82AQ&L944 outputLlow!?82AQL&"
Uuse ?<,@,!baudOI00,/mitO-I3L I,rcvO-I3L A,<6?8A(Opc" unsigned int*I temperature*IW static unsigned int& loop,input*,input,W static char r/W
disableLinterrupts!729%A2"W switch!processLloop"V case 0J fputc!\i\,modem"W inputs)0+ O !int*I"!fgetc!modem""W brea$W case *J fputc!\t\,modem"W byteLlOfgetc!modem"W byteLhOfgetc!modem"W holdLregs)0+Oma$e*I!byteLh,byteLl"W brea$W case ,J if!bitLtest!coils)0+,@"" fputc!\a\,modem"W else fputc!\e\,modem"W brea$W case @J if!bitLtest!coils)0+,'"" fputc!\b\,modem"W else fputc!\f\,modem"W brea$W case 5J if!bitLtest!coils)0+,I"" fputc!\c\,modem"W else fputc!\g\,modem"W brea$W case 'J
if!bitLtest!coils)0+,A"" fputc!\d\,modem"W else fputc!\h\,modem"W brea$W defaultJ brea$W X processLloopNNW if!processLloop[OI" processLloopO0W enableLinterrupts!729%A2"W delayLms!'00"W rs,@,Lerrors O 0W XMM U83D while!6?18" XMM U83D main!"
Header file for variablesJ Udefine LLVA?IA%28<LH Udefine (A:L?87< Udefine (A:LI3-16< Udefine (A:L 9I2< *I MM @, MM Input signalsMswitches *Mbit @, MM 9utput signalsMrelays *Mbit
static unsigned int*I inputLregs)(A:L?87<+W static unsigned int*I holdLregs)(A:L?87<+W static unsigned int& static unsigned int& Lbytes,LpointsW rdyLdata)(A:LI3-16<M&+W
)ppendi; 3
PC3 la( outs
)ppendi; C
#tep ise 'MI confi&uration in ?as( builder 4,,,
)ppendi; >
Components list"esistance*00 ohm *0 D ohm * ( ohm Capacitors0.*uf 5An4 ,'0V /, type ,Apf *0uf I.CCs (a/ ,@, -I *&45', 2(@' 2( A&0' 6DA'0'* 123,00@ - &*A Transistors?ed 28D,%uzzer TransformerJ A&,'0( "ela(s 1) 12<