of 6
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Related Documents
  878 IEEE Transactions zyxwvuts n Consumer Electronics, Vol. 38, No. 4, NOVEMBER 1992 zy MICROPROCESSOR BASED MULTIFUNCTION RELAY SWITCHING zyx . Balasubramanian and Mustafa Oral Electrical and Electronics Engg. Dept. Faculty of Engineering and Architecture Cu kurova University 01330, Adana, Turkey Abstract Fig. 1  shows the simplified block diagram of the micro controller generating various A microprocessor controlled general control signals 'needed for switching the purpose programmable multifunction relay appliances. The microprocessor is supported switching system is proposed. The system by a 4K EPROM and two peripheral interface switches independently multiple electronic devices(P1D). Each PID has three parallel appliances at stipulated timings and I/O ports, a 256 byte RAM and a timer. durations. An alarming relay and a light controlled relay are also included in the A keyboard with 20 keys is interfaced to system. the system as to program various timings and to feed some other data. Thirteen keys 1. Introduction are connected in a 4x4 matrix leaving three junctions unconnected for the keys of The rapid increase in the utilization of future use. The row lines of the matrix are consumer electronic products in living connected to the output port lines PA1 and rooms and other establishments demands the the column lines are connected to the input installation of an automatic control system port lines PCl, The other ends of the switching the various appliances on a pre- column lines are connected to VCC through programmed time basis. For instance, it may pull up resistors as in a conventional be required to switch on certain appliances such as lamps, fans, TV, garden lamps and garden fountains at definite timings of the The layout of the proposed keyboard is day and for specified durations. The shown in Fig.2. The keys in the matrix capabilities of commercially available include all numeric keys and some special timers and switching units are limited and keys marked as ST, EN and 01. Three suitable for only specific applications. interrupting keys marked as R, AL and AT Now, a microprocessor controlled general are not included in the matrix and they are purpose multifunction switching system is directly connected to the hardware reported. The system is designed for interrupt lines of the microprocessor. A switching independently six appliances at depressed key in the keyboard matrix is desired times and durations as programmed. sensed by the microprocessor by running a Also, a switching control based on the day keyboard scan subroutine driving coded and night light intensities is provided. signals to rows and reading the status of Furthermore, as the system runs a digital columns. clock for various timed controls, programmed alarming channel is also The port PB1 programmed as output port provided. provides the switching signals to various relays. While relays R1, R2 and R3 switch z . Implementation of the proposed three different appliances, relay R4 switching system switches an alarming circuit. Relay R5 switches a lamp based on the ambient The proposed switching control system is light. This lamp could be a red lamp designed to have the following features. situated at the top of the building for 1) A digital clock displaying time warning a low flying aircraft or could be a continuously 2) Six channel controlled garden lamp. In the proto type unit, as the switching at programmed times and durations software is developed to control only three 3) A channel for programmed alarming and appliances in three different channels, the (4) A programmable light controlled relay other three lines of port PB1 are kept open channel. for future use. Contributed Paper Manuscript received August 20, 1992 0098 3063192 03.00 1992 IEEE manner 2  Balasubramanian and zyxwvutsrqpon ral: Microprocessor Based Multifunction Relay Switching 879 Symbol zyxwvut ours zyxwvut i n u es PA 2 MSMV DIVIDER 1 HZ PID2 pc PE2 Tim er S Fig 1. Block diagram of the switching system Fig. 2. Keyboard layout Photo sensor z   d L1 ppliance 1 Mains Fig. 3. Relay circuit  88 zyxwvutsrqponm EEE Transactions zyxwvu n Consumer Electronics, Vol. 38, No. 4 NOVEMBER 1992 zy A relay circuit in its simplest form is shown in Fig.3. When the base of the transistor goes 'high', the relay gets energized and closes the contact Ra. A manual switch S is connected in parallel with Ra such as to facilitate both manual and automatic switching. A display system consisting of five LEDs and associated latches (Ll-L5) is run by the microprocessor by driving signals through ports of PID2. While the 7-segment codes are delivered through port PA2, the latching signals are provided through port PC2. The left most LED always displays a symbolic code for the numeric data displayed in the other LEDs. The time in hours and minutes is displayed in the four LEDs. Seconds flickering indication is provided by two red LEDs driven by a 1 Hz signal obtained from the timer of the PID2. Short duration interrupting pulses are derived from the 1 Hz pulse train with a monostable multivibrator and fed to non- maskable hardware interrupt (11) of the microprocessor. The ambient light intensity is sensed by a photo sensor circuit consisting of an LDR, transistor, resistors and a standard Voltage source. The analog signal thus obtained is digitized using an ADC and fed to the microprocessor through port PB2. The microprocessor compares this data with the darkness code and brightness code for deriving a light controlled switching signal. 3. Organization of the software Digital clock The microprocessor organizes a software controlled digital clock similar to the one reported earlier[31. Three software counters namely the seconds counter, the minutes counter and the hours counter are organized in RAM to maintain the running time. While the seconds counter and the minutes counter perform modulo-60 BCD format, the hours counter performs modulo- 24 BCD format. An overflow in the seconds counter would reset it and increment the minutes counter. Similarly, an overflow in the minutes counter would reset it and increment the hours counter. The clock input for the seconds counter is provided by the I1 interrupt service subroutine at every second. The running time is continuously displayed in the LEDs with a symbolic display of 'P' until the occurrence of an interrupt(R,I2 or 13 . Registers organized in RAM Apart from the three registers used for the digital clock, the microprocessor maintains several other registers for running various timers and to perform several other operations. A timer involves three different registers for its operation. They are start time register, duration register and time count register. The time count register is normally at reset and would start counting when the present time reaches the data of the start time register. The counting will progress until the data of time count register reaches the data of the duration register. Table-1 lists various registers organized in the RAM. Table-1. Registers organized in RAM Register name Contents Bytes Seconds counter S 1 Minutes counter M 1 Hours counter H 1 Chl-A-start time register H,M zy   Chl-A-duration register H,M 2 Ohl-A-time counter H M 2 Ohl-B-start time register H M 2 Ohl-B-duration register H,M 2 Ohl-B-time counter H M 2 Oh2-start time register H,M H M 2 h2-duration register Ch2-time counter H M 2 Ch3-start time register H M 2 Ch3-duration register H,M 2 Oh3-time counter H,M 2 Alarm time register H,M 2 Alarm duration register M S 2 M,S 2 larm time counter Darkness code register code 1 Brightness code register code 1 flag 1 ommand flag register Status flag register flag 1 Control register flag 1 S-Seconds, M-Minutes and H-Hours: zy __----------____------------------- ...................................  Balasubramanian and Oral: Microprocessor Based Multifunction Relay Switching zyxwvu 01 zyxwv eset routine hlB AU AL Ch3 Ch2 ChlA When the key R is depressed, it gives a hardware reset input to the microprocessor to perform the following sequence of operations. It first runs an initialization routine where all the ports and registers are reset and the timer is set up. As the seconds counter, minutes counter and the hours counter are reset to zero, a 00 hrs time is displayed in the LEDs. The microprocessor now waits for the data entered through the keyboard for further operations. The first data entry is made for setting the present time in the digital clock. The hours and minutes digits are read one by one and loaded to the respective counters and the display latches. Before feeding the numeric time data, the user depresses the start key ST to mark the beginning of the data entry and after feeding the time data he depresses EN key to indicate the end of present data entry. Any key depressed before the ST key will be ignored by the microprocessor. After ST key, itaccepts two hours digits and two minutes digits one digit after other. Depression of further numeric keys would replace the earlier written time data in the same sequence of entry. When EN key is detected, the microprocessor completes the setting of present time and waits for programming the switching channels. AU The hardware has provisions to switch six different channels. However, as explained earlier, the software is restricted to switch only three different channels. Although all three channels could be programmed for multiple operations, channel 1 only is planned to operate two times a day. Two time operations involve two sets of registers indicated in table-1 as chl-A and chl-B. The alarming channel also has three registers for its operation, but its duration is restricted to minutes and seconds. AL Ch3 Ch2 ChlA In order to have a simplified software structure, the microprocessor runs also three flag registers called as command flag register, status flag register and a control register as indicated in table-1. It also runs a darkness code register and a brightness code register in conjunction with the switching of light controlled relay. Fig.4 gives the details of various AU AL ~ 881 Ch3 Ch2 Chl Command flag register Status flag register Control register Fig 4. Flag registers flags used in these flag registers. The flags in the command flag register are set while programming the channels. The flags in the status flag register are set by the microprocessor to indicate the opening of time count registers for various channels. The flags in the control register give the switching signals to various relays hard wired to port PB1. After setting up the presenttime for the digital clock, the microprocessor accepts the data for programming the three channels. In order to help the user to feed the appropriate data, it first gives a symbolic display of ? to accept the number of channels to be programmed for current use. The user feeds 1,2 or zyx   and the number comes to the display in the symbolic LED. Also it gives a display of chlA in the numeric field as to accept data for chl-A channel. The chl-A flag in the command flag register is set. As before, the user gives the start time data of channel chl-A embedded in ST and EN key closures. This data goes to the chl-A start time register. Likewise, the duration of chl-A is entered. After entering the data of chl-A, the data of chl-B needed for second time switching is entered. If the number of channels programmed is only one, then the programming of the channel timings is now over, otherwise, it accepts the timing data of other channels in a similar manner. At each time of operation, the flags in the command flag register are set accordingly. After completing the programming of the channel timings, the microprocessor runs a monitoring routine performing programmed switching. Fig.5 shows the sequence of operations carried out in the reset operation.  882 IEEE Transactions on Consumer Electronics, vol. 38, No. 4, NOVEMBER 1992 zy Perform initialization routine Initiate key scan zyxwvutsr   I zyxwvutsrqp   I Read no of channels n zyxwvutsrq   zyxwvu   Program ChlA ChlB timings I Program Ch2 timings Program Ch3 timings J zyxwvutsrqpo   Perform monitoring routine Fig. 5. Reset routine In the monitoring routine, the microprocessor checks the command flag register one by one for the presence of various flags. It first checks chl-A flag, and if present, it compares the present time with the chl-A start time register. If they are matching, it opens chl-A time counter and chl-A flag is set in the status flag register. Also, a bit to be driven to chl relay line through port PB1 is set in the control register. After then, the chl-A timer counter is compared with the chl-A duration counter and if they are matching, chl-A flag in the status flag register and the Chl flag in the coontrol register are reset. This operation is repeated for chl- B ch2 and ch3 channels. If AL flag is present in the command flag register, it checks the present time with the data of alarm time register and sets the AL flags in the status flag register and the control register accordingly. If the present time matches with the alarm duration register, then AL flag in these registers would be reset. After alarming, the 01 flag in the command flag register is checked and if found present the AL flag in the command flag register would be reset as to prohibit the indefinite alarming. Fig.6 shows the sequence of operations carried out in the monitoring routine. If AU flag is present in the command flag register, the ambient light data is read and compared with the darkness code and brightness code. If it matches with the darkness code, then AU flag in the status register and control register are set. If it matches with the brightness code then, the AU flag is reset in these registers accordingly. Programming alarm timings When the switch AL in the keyboard is depressed it gives an interrupt(I2) to the microprocessor to program the alarming time and duration. In the interrupt service subroutine, the microprocessor sets the AL flag in the command flag register and scans the keyboard to accept these data. As before, the user feeds the data using the ST, EN and numeric keys. He first gives the alarming time data and then the duration data. After then he could use 01 key to mark the alarming needed is for once or indefinite. If 1 is depressed, it is for one time operation and the 01 flag in the command flag register is set. The data of alarming time and duration are loaded in the respective registers. Programming the Darkness and brightness codes When the AT key in the keyboard is depressed, it gives an interrupt(I3) to the microprocessor to program the darkness and brightness codes. In the interrupt service subroutine, it first sets the AU flag in the command flag register and scans the
Related Search
We Need Your Support
Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks