Tuesday, August 20, 2013

Master Slave Clock




       The basic aim of the project is to design a compact user-friendly clock. It is digital in nature and programmable.

       This clock can sense temperature and displays it on LED display. Also it displays date and time of the day.

       It works on the Master Slave principle, which has master clock and slave clock with their display, microcontroller and temperature sensor mounted on PCB.

       The project is divided into two parts:
·         Master clock
·         Slave clock

       In Master clock -

       A power supply is also made on the board to convert the ac voltage into fixed regulated D.C. voltage to supply 5 volts to all the IC’s and peripherals. In master clock there is one real time clock IC is mounted on PCB.

       In Slave clock -

       In slave clock there is no real time clock, but all the slaves have one temperature IC that is mounted on PCB because temperature is different in other areas.




























                                                                                             












       In today’s world, while dealing with various electronics equipments and devices, it is desired to have visual information. Various applications demand a display system to convey ‘Basic and vital’ information to a large number of people.

       In master slave clock, we are having one master clock, which will control all other slaves.

      Master accepts information from the various peripherals and displays it on its own display and slaves accepts that data and also displays it on their own display. This can be done through an RS-485 cable for serial communication. The micro controller then sends the data corresponding to the input to the display panel and it also synchronizes data between master and slave clock.
       On display panel displaying parameters like temperature, date, time and also having one more feature of ringing circuitry. Whenever we change time and date on master, the same change will be on slaves.
      using real time clock IC for updating day and time in case of power failure. It updates data by internal battery back.
       In master slave clock, we can use up to 32 slaves by using RS-485 cable. But if we want to connect more slaves we can connect them by using repeaters.













 

 

 

 

 

 

 

 


















 
The Power Supply:

       Consists of 4 diodes D1-D4, which rectify the input a. c. signal, a 1000-microfarad capacitor, which filters the signal. An IC regulator is used 7805 which keeps the voltage constant at 5 volts. The 104 and 100-microfarad capacitors are used to remove the high frequency signal and to remove noise.

Microcontroller:

Pin no.31 is given to Vcc.
Pin no.18 and 19 are connected to the crystal oscillator of frequency 11.0592 MHz.
Pin no.9 is connected to reset pin of real time clock. Reset pin is used to reset the microcontroller in case the program goes into an infinite loop or does not respond for particular amount of time.
When microcontroller is reset, then all the counters and flags are brought to their original values.
Pin no.12 is INT0; the output from real time clock (i.e. pin no.19) is given here.
Port P2.0-P2.4 is given to the driver; these are the output digits from the microcontroller.
Port P0.0-P0.7 is given to real time clock IC (i.e. from pin no.4 to 11) to send data.
Pin no.30 is given to real time clock to latch the address.
Also RD, WR and RST pins of microcontroller are given to real time clock IC.

These are the various connections of the microcontroller (89S52) and real time clock IC
 (DS12C887).




Ringing Circuit:

Pin no.15 of microcontroller i.e. timer1 is connected to ringing circuit to make a ring for predetermined time.
                                          
RS-485:

IC 75176 is used in the circuit make communication compatible between RS-485 and microcontroller. It is bi-directional transceiver.
Pin no.1 and 4 are interfaced with microcontroller.

Temperature Sensor:
IC DS1621 is used as temperature sensor in the circuit. SDA, SCL, Tout and A0, A1, A2 these lines of this IC are interfaced with microcontroller.

Display:

Pin no.21, 22,23,24,25 are connected to the digits 1,2,3, 4,5 respectively to the microcontroller output.
The other pins are the 7-digit output.




























 

 

 

 
























       We use a linear power supply with a regulated IC 7805, which gives a constant output voltage of +5volts. The transformer is step down transformer, which converts 230V to 9V. Then the bridge rectifier rectifies the signal and converts the ac signal to a positive wave. Then filter removes the ripples and makes it a constant wave with reduced ripples. We used a capacitor filter which charges when the wave goes positive from zero to max value. Then the capacitor starts to discharge but has a very large discharge time and doesn’t get fully discharged till the next high wave starts. Therefore it starts charging again and the cycle repeats itself.
       The regulated gives a ripple free regulated output; the capacitors around the input and output are used to remove noise. The diode provides short circuit protection as a high voltage if by mistake passed on to the other devices could be very dangerous and could damage all the devices connected to the power supply.


Fig 7:OUTPUT VOLTAGE OF REGULATOR







Vtg
 


5V
 

 












t
 
 


The Bridge Rectifier:

       When four diodes are connected as shown in figure, the circuit is called a BRIDGE RECTIFIER. The input to the circuit is applied to the diagonally opposite corners of the network, and the output is taken from the remaining two corners.
Fig 8. Bridge rectifier.

       One complete cycle of operation will be discussed to help you understand how this circuit works. We have discussed transformers in previous modules in the NEETS series and will not go into their characteristics at this time. Let us assume the transformer is working properly and there is a positive potential at point A and a negative potential at point B. The positive potential at point A will forward bias D3 and reverse bias D4. The negative potential at point B will forward bias D1 and reverse bias D2. At this time D3 and D1 are forward biased and will allow current flow to pass through them; D4 and D2 are reverse biased and will block current flow. The path for current flow is from point B through D1, up through RL, through D3, through the secondary of the transformer back to point B. The solid arrows indicate this path. Waveforms (1) and (2) can be observed across D1 and D3.
Filters:
       While the output of a rectifier is a pulsating dc, most electronic circuits require a substantially pure dc for proper operation. Single or multisection filter circuits placed between the output of the rectifier and the load provide this type of output.
There are four basic types of filter circuits:
·         Simple capacitor filter
·         LC choke-input filter
·         LC capacitor-input filter (pi-type)
·         RC capacitor-input filter (pi-type)

       Filtering is accomplished by the use of capacitors, inductors, and /or resistors in various combinations. Inductors are used as series impedances to oppose the flow of alternating (pulsating dc) current. Capacitors are used as shunt elements to bypass the alternating components of the signal around the load (to ground). Resistors are used in place of inductors in low current applications.

Lets briefly review the properties of a capacitor. First, a capacitor opposes any change in voltage. The opposition to a change in current is called capacitive reactance (Xc) and is measured in ohms. The capacitive reactance is determined by the frequency (f) of the applied voltage and the capacitance (C) of the capacitor.


         
 if frequency or capacitance is increased, the Xc decreases. Since filter capacitors are placed in parallel with the load, a low Xc will provide better filtering than a high Xc. For this to be accomplished, a better shunting effect of the ac around the load is provided, as shown in fig. To obtain a steady dc output, the capacitor must charge almost instantaneously to the value of applied voltage. Once charged, the capacitor must retain the charge as long as possible. The capacitor must have a short charge time constant (view A). This can be accomplished by keeping the internal resistance of the power supply as small as possible (fast charge time) and the resistance of the load as large as possible (for a slow discharge time a illustrated in view B).
The Capacitor Filter:
       The simple capacitor filter is the most basic type of power supply filter. The application of the simple capacitor filter is very limited. It is sometimes used on extremely high-voltage, low-current power supplies for cathode ray and similar electron tubes, which require very little load current from the supply. The capacitor filter is also used where the power-supply ripple frequency is not critical; this frequency can be relatively high. The capacitor (C1) shown in figure is a simple filter connected across the output of the rectifier in parallel with the load.
.

       When this filter is used, the RC charge time of the filter capacitor (C1) must be short and the RC discharge time must be long to eliminate ripple action. In other words, the capacitor must charge up fast, preferably with no discharge at all. Better filtering also results when the input frequency is high; therefore, the full-wave rectifier output is easier to filter than that of the half-wave rectifier because of its higher frequency.
       Current pulses flow through the load resistance (RL) each time a diode conducts. The dashed line indicates the average value of output voltage. For the half-wave rectifier, Eavg is less than half (or approximately 0.318) of the peak output voltage. This value is still much less than that of the applied voltage. With no capacitor connected across the output of the rectifier circuit, the waveform in view A has a large pulsating component (ripple) compared with the average or dc component. When a capacitor is connected across the output (view B), the average value of output voltage (Eavg) is increased due to the filtering action of capacitor C1.



       The value of the capacitor is fairly large (several microfarads), thus it presents a relatively low reactance to the pulsating current and it stores a substantial charge.

5.2 LM 7805:

Description:

       The LM78XX series of three terminal positive voltage regulators is available with several fixed output voltages making them useful in a wide range of applications. One of these is local on card regulation, eliminating the distribution problems associated with single point regulation. The voltages available allow these regulators to be used in logic systems, instrumentation, Hi-Fi, and other solid-state electronic equipment. Although designed primarily as fixed voltage regulators these devices can be used with external components to obtain adjustable voltages and currents.

       The LM78XX series is available in an aluminum TO-3 package that will allow over 1.0A load current if adequate 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 expanded to make the LM78XX series of regulators easy to use and minimize the number of external 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. For output voltage other than 5V, 12V and 15V the LM117 series provides an output voltage range from 1.2V to 57V.

Features:
·         Output current in excess of 1A
·          Internal thermal overload protection
·          No external components required
·         Output transistor safe area protection
·         Internal short circuit current limit
·         Available in the aluminum TO-3 package
·         Output voltages of 5V, 12V and 15V.




 






 

Fig 11: Microcontroller IC
 
       The AT89S52 is a low-power, high-performance CMOS 8-bit microcontroller with 8K bytes of in-system programmable Flash memory. The device is manufactured using Atmel’s high-density nonvolatile memory technology and is compatible with the industry-standard 80C51 instruction set and pin out. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU with in-system programmable Flash on a monolithic chip, the Atmel AT89S52 is a powerful microcontroller that provides a highly flexible and cost-effective solution to many embedded control applications.

Features:

• Compatible with MCS-51 Products
• 8K Bytes of In-System Programmable (ISP) Flash Memory
   Endurance: 1000 Write/Erase Cycles
• Fully Static Operation
• 256 x 8-bit Internal RAM
• 32 Programmable I/O Lines
• Three 16-bit Timer/Counters
• Eight Interrupt Sources
• Speed up to 33 MHz

Working:
       We use port 2 for the output connected to the driver circuit and then to the seven-segment display. The other port we use is the port 0 for address data signals. The INT0 pin sends an interrupt signal to the microcontroller whenever an input signal has to display. This interrupt starts the microcontroller program that updates the data for one second and stores the value in registers. A delay of 1 second is used in which the microcontroller counts the number of high to low transitions using an increasing 16-bit counter. The output of the counter is stored in a 16-bit register. This value in register is then send to the I/O port 2 as output.  

       The microcontroller is also programmed to give temperature of the atmosphere, which is given to display. The program is written to display this temperature after some amount of delay using delay function. Every time an input from various peripherals is given to the microcontroller, then program starts running and displayed on display panel.
These are the various functions of the microcontroller.

Theory:
       The microcontroller has 40 pins. 32 are input-output pins and the remaining 8 perform various functions like reset, reference voltage oscillator input and ground.
It has 4 ports each port contains 8 pins.

Port 0:
       Port 0 is an 8-bit open drain bi-directional I/O port. The 8 pins can also be used as multiplexed address and data bus. It stores the lower 8 bits of the address bus.

Port 1:
       It is a basic input-output port with no other special feature. Used for parallel communication with any parallel device.


Port 2:
       It is like port 0. it is used for the next 8 bits of the address bus to extend the memory.

Port 3:
       It is a special bus can be used for basic I/O operations as well as for serial data transmission. This port is also used for some special functions like interrupts, timers, read and write operations.



Memory Organization:

       MCS-51 devices have a separate address space for Program and Data Memory. Up to 64K bytes each of external Program and Data Memory can be addressed.

Program Memory:

       If the EA pin is connected to GND, all program fetches are directed to external memory. On the AT89S52, if EA is connected to VCC, program fetches to addresses 0000H through 1FFFH are directed to internal memory and fetches to addresses 2000H through FFFFH are to external memory.

Data Memory:

       The AT89S52 implements 256 bytes of on-chip RAM. The upper 128 bytes occupy a parallel address space to the Special Function Registers. This means that the upper 128 bytes have the same addresses as the SFR space but are physically separate from SFR space.















DESCRIPTION:

       The DS1621 Digital Thermometer and Thermostat provides 9–bit temperature readings, which indicate the temperature of the device. The thermal alarm output, TOUT, is active when the temperature of the device exceeds a user–defined temperature TH. The output remains active until the temperature drops below user defined temperature TL, allowing for any hysteresis necessary. User-defined temperature settings are stored in nonvolatile memory so parts may be programmed prior to insertion in a system. Temperature settings and temperature readings are all communicated to/from the DS1621 over a simple two–wire serial interface.

FEATURES:

  1. Temperature measurements require no external components.
  2.  Measures temperatures from –55°C to +125°C in 0.5°C increments. Fahrenheit
             equivalent is –67°F to 257°F in 0.9°F increments.
      3.   Temperature is read as a 9–bit value (2-byte transfer)
  1. Wide power supply range (2.7V to 5.5V)
  2. Converts temperature to digital word in 1 second.
  3. Thermostatic settings are user definable and nonvolatile.
      7.     Data is read from/written via a two–wire serial interface (open drain I/O lines)



5.5 REAL TIME CLOCK:

       The DS12C887 Real Time Clock plus RAM is designed as a direct upgrade replacement for the DS12887 in existing IBM compatible personal computers to add hardware year 2000 compliance. A century byte was added to memory location 50, 32h, as called out by the PC AT specification. A lithium energy source, quartz crystal, and write-protection circuitry are contained within a 24–pin dual in-line package. As such, the DS12C887 is a complete subsystem replacing 16 components in a typical application. The functions include a nonvolatile time-of-day clock, an alarm, a one-hundred-year calendar, programmable interrupt, square wave generator, and 113 bytes of nonvolatile static RAM. The real time clock is distinctive in that time-of-day and memory are maintained even in the absence of power.

FEATURES:

  • Totally nonvolatile with over 10 years of operation in the absence of power.
  • Self-contained subsystem includes lithium, quartz, and support circuitry.
  • Counts seconds, minutes, hours, days, day of the week, date, month, and year with leap year compensation valid up to 2100.
  • Binary or BCD representation of time, calendar, and alarm.
  • 12– or 24–hour clock with AM and PM in 12-hour mode.
  •  Daylight Savings Time option.
  • Multiplex bus for pin efficiency.
  • Interfaced with software as 128 RAM locations and 113 bytes of general purpose RAM.
  • 15 bytes of clock and control registers and century register.
  • 113 bytes of general purpose RAM.
  • Bus–compatible interrupt signals (IRQ).
  • Three interrupts are separately software maskable and testable
  • Time–of–day alarm once/second to once/day

5.6 SERIAL COMMUNICATION USING RS-485:

       In the project, communication from PC to master clock is done with DS232A and to connect number of slaves to the master we are using RS-485. The DS232A is a dual RS-232 driver/receiver pair that generates RS-232 voltage levels from a single +5 volt power supply. Additional ±12 volt supplies are not needed since the DS232A uses on-board charge pumps to convert the +5 volt supply to ±10 volts.
       Standards have been developed to insure compatibility between units provided by different manufacturers, and to allow for reasonable success in transferring data over specified distances and/or data rates. The Electronics Industry Association (EIA) has produced standards for RS-485, RS-422, RS-232 and RS-423 that deal with data communications.
Selection of RS-485 depends upon number of conductors, shielding and cable characteristics.




       RS-485 meets the requirement for a truly multi-point communications network, and the standard specifies up to 32 drivers and 32 receivers on a single (2-wire) bus. With the introduction of “automatic” repeaters and high impedance drivers / receivers this “limitation” can be extended to hundreds (or even thousands) of nodes on a network. RS-485 extends the common mode range for both drivers and receivers in the “tri-state” mode and with power off. Also, RS-485 drivers are able to withstand “data collisions.”
       To solve the “data collies  mion” problem often present in multi-drop networks hardware units (converters, repeaters, microprocessor controls) can be constructed to remain in a receive mode until they are ready to transmit data. Single master systems (many other communications schemes are available) offer a straightforward and simple means of avoiding “data collision” in a typical 2-wire, half-duplex, multidrop system. The master initiates a communications request to a “slave node” by addressing that unit. The hardware detects the start bit of the transmission and automatically enables (on the fly) the RS-485 transmitter. Once a character is sent hardware reverts back into a receive mode in about 1-2 microseconds (at least with R.E. Smith converters, repeaters and remote I/O boards).

Commonly used signals in RS-485 are:
·         Transmitted data (TxD)- Data sent from DTE to DCE.
·         Received data (RxD)- Data sent from DCE to DTE.
·         Request to send (RTS)-Asserted (set to 0) by DTE to prepare DCE to receive data. This may require action on the part of the DCE, e.g. transmitting a carrier or reversing the direction of a half-duplex line.
·         Clear to send (CTS)-Asserted by DCE to acknowledge RTS and allow DTE to transmit.
·         Data terminal ready (DTR)-Asserted by DTE to indicate that it is ready to be connected. If the DCE is a modem, it should go “off hook” when it receives this signal. If this signal is de-asserted, the modem should respond by immediately hanging up.
·         Data set ready (DSR)- Asserted by DCE to indicate an active connection. If DCE is not a modem (e.g. a null modem cable or other equipment), this signal should be permanently asserted (set to 0), possibly by a jumper to another signal.
·         Carrier detect (CD)- Asserted by DCE when a connection has been established with remote equipment.
·         Ring indicator (RI)- Asserted by DCE when it detects a ring signal from the telephone line.

SPECIFICATIONS OF RS-485:
Table 1: Specifications
SPECIFICATIONS
RS232
RS423
RS422
RS485
Mode of Operation
SINGLE
-ENDED
SINGLE
-ENDED
DIFFERENTIAL
DIFFERENTIAL
Total Number of Drivers and Receivers on One Line (One driver active at a time for RS485 networks)
1 DRIVER
1 RECVR
1 DRIVER
10 RECVR
1 DRIVER
10 RECVR
32 DRIVER
32 RECVR
Maximum Cable Length
50 FT.
4000 FT.
4000 FT.
4000 FT.
Maximum Data Rate (40ft. - 4000ft. for RS422/RS485)
20kb/s
100kb/s
10Mb/s-100Kb/s
10Mb/s-100Kb/s
Maximum Driver Output Voltage
+/-25V
+/-6V
-0.25V to +6V
-7V to +12V
Driver Output Signal Level (Loaded Min.)
Loaded
+/-5V to +/-15V
+/-3.6V
+/-2.0V
+/-1.5V
Driver Output Signal Level (Unloaded Max)
Unloaded
+/-25V
+/-6V
+/-6V
+/-6V
Driver Load Impedance (Ohms)
3k to 7k
>=450
100
54
Max. Driver Current in High Z State
Power On
N/A
N/A
N/A
+/-100uA
Max. Driver Current in High Z State
Power Off
+/-6mA @ +/-2v
+/-100uA
+/-100uA
+/-100uA
Slew Rate (Max.)
30V/uS
Adjustable
N/A
N/A
Receiver Input Voltage Range
+/-15V
+/-12V
-10V to +10V
-7V to +12V
Receiver Input Sensitivity
+/-3V
+/-200mV
+/-200mV
+/-200mV
Receiver Input Resistance (Ohms), (1 Standard Load for RS485)
3k to 7k
4k min.
4k min.
>=12k





       Pin no.15 of microcontroller i.e. timer1 is connected to ringing circuit to make a ring for predetermined time. This ringing circuitry will be useful for ringing at the time of start and end of college, for recess time.























involve single crystal phosphor materials, which distinguishes them from the polycrystalline electro luminescent displays. Light emitting diodes (LED) are PN junction devices that give off light radiation when biased in the forward direction. Most light emitting diodes function in the near infrared and visible ranges, though there are now UV LEDs. Light emitting diodes are a reliable means of indication compared to light sources such as incandescent and neon lamps. LEDs are solid-state devices requiring little power and generating little heat. Because their heat generation is low and because they do not rely on a deteriorating material to generate light, LEDs have long operating lifetimes. One of the alternatives, incandescent bulbs, consumes much more power, generate a great deal of heat, and rely on a filament that deteriorates in use. Neon bulbs, on the other hand, rely on excited plasma, which, along with its electrodes, can deteriorate over time.  LED displays, digital, are highly versatile and well suited to a variety of measurement applications.  Display types can be segmented or dot matrix.  A seven-segment display can display numbers only; a sixteen-segment display can display numbers and letters.  A 4x7 dot matrix display can display numbers only; a 5x7 dot matrix display can display numbers and letters.  LED displays, digital can be numeric or alpha numeric.  Numeric displays display numbers only, a seven-segment display or 4x7 dot matrix display.  An alphanumeric display can display numbers and letters, a sixteen-segment display or 5x7 dot matrix display.

       LED displays can have a common anode or common cathode configuration.  In a common anode configuration all the segments in the LED share one anode pin.  In a common cathode configuration all the segments in the LED share one cathode pin.  Common cathode is the "standard" circuit where the cathode is connected to the "common" point on the circuit, usually ground, and usually through a resistor, which is often bypassed with a capacitor, placing it at "AC" ground potential.  Important display package specifications to consider when searching for LED displays, digital include the number of rows and the number of characters per row.  Standard color choices for LEDs include standard red, yellow, high efficiency red, orange, green, and blue.  Other display specifications to consider include color wavelength, character height, and viewing distance.  Wavelength of the display will be determined by the color of the LED.  Viewing distance is determined primarily by the minimum size requirements for objects that the user must see.  The viewing angles on the x and y-axis are also important to consider.  The viewing angle of the display is the angle, in degrees, between a line normal to the display surface and the user's visual axis.  Minimum and typical luminous intensity describe the luminous flux per unit solid angle, and its unit of measurement is the candela (cd).  Case dimensions include width depth and height.  The case or package of the display will have separate dimensions than the actual viewing area of the display.

       LED displays, message, are typically commercial or industrial signs. They allow for larger characters and longer viewing distances than digital LED displays. Light-emitting diode (LED) displays are segmented or dot matrix displays allowing for numeric only and alphanumeric character representation.   Light emitting diodes (LED) are PN junction devices that give off light radiation when biased in the forward direction. Most light emitting diodes function in the near infrared and visible ranges, though there are now UV LEDs. Light emitting diodes are a reliable means of indication compared to light sources such as incandescent and neon lamps. LEDs are solid-state devices requiring little power and generating little heat. Because their heat generation is low and because they do not rely on a deteriorating material to generate light, LEDs have long operating lifetimes. One of the alternatives, incandescent bulbs, consumes much more power, generate a great deal of heat, and rely on a filament that deteriorates in use. Neon bulbs, on the other hand, rely on excited plasma, which, along with its electrodes, can deteriorate over time.

       Choices for display types for LED displays, message; include matrix, line, character, fixed digit, and ticker.  A matrix display is composed of an array of LEDs able to form graphics.  A line display only displays messages in a line format.  A character display is composed of an array of LEDs only capable of displaying characters.  On a fixed digit display the digits are fixed and cannot move.  On a ticker display the digits can move across the viewing area.  LED displays, message can be configured to be used in either an indoor application or an outdoor application.  Displays that are configured for outdoors use have weatherproof housings.

       Important configuration parameters to consider when specifying LED displays, message, include character height, number of lines, number of characters, viewing distance, viewing angle, and luminous intensity.  The character height may also be called pitch.  The number of lines will determine the size of the message display.  The number of characters refers to the number of characters per line.  Viewing distance is determined primarily by the minimum size requirements for objects that the user must see.  The viewing angle is the angle, in degrees, between a line normal to the display surface and the user's visual axis.  Luminous intensity is typically given @ 10mA. Also known as pixel brightness. Luminous intensity is luminous flux per unit solid angle, and its unit of measurement is the candela (cd).

       LED displays, message, can be mounted in a panel or case, or top mounted, or bottom mounted.  Top mounted displays can hang from the ceiling.  Case dimensions of height, width, and depth are important to consider.  Common features include special effects or animations, programmability, selectable fonts, displaying of countdown time, adjustable intensity, and clock format.  Special effects include a variety of scrolling, wiping, twinkling, flashing, images and animations that function in conjunction with text or as stand-alone effects. They are used to provide emphasis on specific textual statements, to simply draw attention to the display, or to provide an additional level of entertainment in conjunction with message presentation.  Important environmental parameters to consider when specifying LED displays, message include operating humidity and operating temperature.










  ALGORITHM:

FOR MASTER CLOCK-

1.    Start.
2.    Clear flag.
3.    Initialize serial communication registers i.e. (TCON, SCON, TMOD, TH1, TL1, IP, IE).
4.    Initialize RTC for 24 hours.
5.    Read RTC and send serially from RTC.
6.    Enable interrupt.
7.    If serial data is enabled then read serial data, write RTC, read RTC, send RTC and repeat step 7.
8.    If serial data is not enabled, then check time flag.
9.    If time flag is enabled, then read RTC and if it is not enabled, then go to step 7.
10.  Then check sec<5. If condition is satisfied, then send date and go to step 7.
11.  If sec<5 condition is not satisfied then check for 5<sec<9. If condition is satisfied, then read temperature (DS1621) and send temperature and then go to step 7.
12.  If 5<sec<9 condition is not satisfied then send time and check initialize=00.If this condition is satisfied then make relay on for some time and make it off. Then go to step 7.
13.  If initialize=00 condition is not satisfied then go to step 7 and repeat same steps.









FOR SLAVE CLOCK-

1.    Start.
2.    Clear flag.
3.    Initialize time and serial register.
4.    Set timer and serial interrupt.
5.    Make timer on.
6.    Check for serial data receive, if it high then update register and repeat step 6.
7.    If serial data receive is low then repeat from step 6.




















0 comments:

Post a Comment