KR20170093356A - Method for adjusting time information of real time clock device in programmable logic controller and the programmable logic controller - Google Patents

Method for adjusting time information of real time clock device in programmable logic controller and the programmable logic controller Download PDF

Info

Publication number
KR20170093356A
KR20170093356A KR1020160014636A KR20160014636A KR20170093356A KR 20170093356 A KR20170093356 A KR 20170093356A KR 1020160014636 A KR1020160014636 A KR 1020160014636A KR 20160014636 A KR20160014636 A KR 20160014636A KR 20170093356 A KR20170093356 A KR 20170093356A
Authority
KR
South Korea
Prior art keywords
error
rtc
clock
time
time information
Prior art date
Application number
KR1020160014636A
Other languages
Korean (ko)
Inventor
나중빈
Original Assignee
엘에스산전 주식회사
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 엘에스산전 주식회사 filed Critical 엘에스산전 주식회사
Priority to KR1020160014636A priority Critical patent/KR20170093356A/en
Publication of KR20170093356A publication Critical patent/KR20170093356A/en

Links

Images

Classifications

    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B19/00Programme-control systems
    • G05B19/02Programme-control systems electric
    • G05B19/04Programme control other than numerical control, i.e. in sequence controllers or logic controllers
    • G05B19/05Programmable logic controllers, e.g. simulating logic interconnections of signals according to ladder diagrams or function charts
    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B2219/00Program-control systems
    • G05B2219/10Plc systems
    • G05B2219/15Plc structure of the system
    • G05B2219/15063Real time clock

Abstract

Provided is a method for automatically correcting the time of an RTC device embedded in a PLC, which includes the steps of: receiving an outputted timing signal by counting a system clock; receiving an interrupt signal from the RTC device to generate time information by counting an RTC clock; calculating an error of the RTC clock by comparing the timing signal with the interrupt signal; and correcting the time information in the RTC device based on the calculated error of the RTC clock. Accordingly, the present invention can secure the stability of the time information.

Description

METHOD FOR ADJUSTING TIME INFORMATION OF REAL TIME CLOCK DEVICE IN PROGRAMMABLE LOGIC CONTROLLER AND PROGRAMMABLE LOGIC CONTROLLER

The present invention relates to a time correction method of an RTC apparatus built in a PLC and a PLC thereof. More particularly, the present invention relates to a time correction method for an RTC apparatus built in a PLC, and more particularly to an RTC apparatus for counting a system clock, receiving an output timing signal, counting an RTC clock, A time correction method of the RTC device built in the PLC which receives the signal and calculates the error of the RTC clock by comparing the timing signal and the interrupt signal and corrects the time information in the RTC device based on the calculated error of the RTC clock, PLC.

PLC (Programmable Logic Controller) incorporates an RTC device that generates time information to control the current time or leave a work history. An RTC (Real-Time Clock) device is a device necessary for an electronic device using time information.

The RTC apparatus counts the RTC clock generated by the RTC clock oscillation element, and calculates and outputs time information on the counted RTC clock.

FIG. 1 is a view for explaining oscillation characteristics of a crystal used as an RTC oscillation element for each temperature. FIG.

Referring to FIG. 1, a crystal having an error range of 20 ppm at a frequency of 32,768 Hz and a room temperature (about 25 ° C) is used for an RTC oscillation element.

Accordingly, the RTC apparatus calculates the time information by converting 32,768 clocks into 1 second. Here, the time information may be composed of year, month, day, hour, minute, and second.

The temperature characteristic of the crystal is the smallest about 20ppm of the clock error at room temperature (about 25 ° C), and the clock error becomes larger as the temperature becomes lower and higher.

Crystals can cause product-specific errors in the PCB pattern design process in the manufacturing process. In addition, the crystal may experience additional errors depending on the capacitor and frequency matching designed on both ends. In this way, the oscillation frequency of the crystal used in the RTC device may vary from part to part due to various situations of the manufacturing process. However, the RTC apparatus is designed in consideration of outputting a clock of 32,768 Hz in a crystal used as an RTC oscillation element.

Therefore, if any crystal used as an RTC oscillator does not output a clock of 32,768 Hz and is a crystal outputting a clock of, for example, 32,766 Hz, the RTC is delayed as time elapses, do. Accordingly, the accuracy of the time information used in the PLC may be inferior.

SUMMARY OF THE INVENTION A problem to be solved by the present invention is to provide a time correction method of an RTC device incorporated in a PLC which can ensure stability of time information by appropriately responding to changes in the RTC clock output from a crystal used as an RTC oscillation element And its PLC.

The problems to be solved by the present invention are not limited to the above-mentioned problems, and other problems not mentioned can be clearly understood by those skilled in the art from the following description will be.

According to an aspect of the present invention, there is provided a method of controlling an RTC apparatus, the method comprising: receiving a timing signal output by counting a system clock; inputting an interrupt signal from an RTC apparatus for generating time information by counting an RTC clock; And correcting the time information in the RTC device based on the calculated error of the RTC clock is provided to the RTC device of the PLC .

The step of calculating the error of the RTC clock may include calculating an error time by comparing the timing signal and the interrupt signal, and calculating an error clock number based on the error time.

The step of correcting the time information in the RTC device may include storing the calculated error clock number in a clock error register for compensating for an error of the RTC clock, And correcting the time information.

The system clock is input from an oscillator, and the RTC clock can be input from a crystal.

According to another aspect of the present invention, there is provided an RTC apparatus including an RTC unit for counting an RTC clock to generate time information and outputting an interrupt signal, and an RTC unit for counting a system clock and comparing the output timing signal with the timing signal and the interrupt signal, There is provided a PLC equipped with a time correction function of an RTC device including an MPU for calculating an error of a clock and correcting the time information in the RTC device based on the calculated error of the RTC clock.

Wherein the MPU comprises: a system counter for counting the system clock and outputting a timing signal; a comparator for comparing the timing signal with the interrupt signal to calculate an error time of the RTC clock; And a clock error register for storing the number of error clocks so that the RTC device can correct the time information based on the calculated number of error clocks.

The RTC unit may correct the time information based on the stored number of error clocks.

The RTC apparatus may include a clock error register for storing the number of error clocks for correcting the time information. The MPU includes a system counter for counting the system clock and outputting a timing signal, And an error calculator for calculating the error clock count based on the error time and transmitting the calculated error clock count to the clock error register of the RTC apparatus.

According to the present invention, an interrupt signal is received from an RTC device that counts a system clock, receives an output timing signal, counts an RTC clock to generate time information, compares a timing signal with an interrupt signal, And corrects the time information in the RTC device based on the calculated error of the RTC clock. Thus, it is possible to cope with the change of the RTC clock output from the crystal used as the RTC oscillation device, thereby ensuring the stability of the time information .

FIG. 1 is a view for explaining oscillation characteristics of a crystal used as an RTC oscillation element for each temperature. FIG.
2 is a view for explaining a PLC having a time correction function of the RTC apparatus according to an embodiment of the present invention.
3 is a view for explaining a time correction method of an RTC apparatus built in a PLC according to an embodiment of the present invention.
4 is a view for explaining a PLC having a time correction function of the RTC apparatus according to another embodiment of the present invention.
5 is a view for explaining a time correction method of an RTC apparatus built in a PLC according to another embodiment of the present invention.

While the invention is susceptible to various modifications and alternative forms, specific embodiments thereof are shown by way of example in the drawings and will herein be described in detail. It should be understood, however, that the invention is not intended to be limited to the particular embodiments, but includes all modifications, equivalents, and alternatives falling within the spirit and scope of the invention.

Hereinafter, a preferred embodiment of the present invention will be described in detail with reference to the accompanying drawings.

2 is a view for explaining a PLC having a time correction function of the RTC apparatus according to an embodiment of the present invention.

2, the PLC 100 having the time correction function of the RTC device according to an embodiment of the present invention includes an oscillator 110, a crystal 120, an RTC device 130, and an MPU 140 And the like.

The oscillator 110 is designed to operate only when power is supplied while power is applied. The oscillator 110 operates only when power is applied, and generates a clock for the operation of the MPU 140. The clock output from the oscillator 110 is a basic clock for the operation of the MPU 140. The clock output from the oscillator 110 is referred to as a system clock.

On the other hand, the crystal 120 can operate as an auxiliary power source even when the power is off. Accordingly, the clock generated from the crystal 120 is input to the RTC device 130, and the RTC device 130 is used to generate the time information. The clock output from the crystal 120 is referred to as an RTC clock.

The RTC device 130 counts the RTC clock output from the crystal 120 to generate time information. The RTC unit 130 also counts the RTC clock to generate an interrupt signal and outputs it to the MPU 140.

The RTC device 130 is operated by the crystal 120. At this time, it is preferable that the crystal 120 outputs an RTC clock of a specific frequency, for example, 32,768 Hz, but an error may occur depending on temperature or environment. In case of mass production, for example 32,767 Hz instead of 32,768 Hz, the RTC unit 130 calculates the current time by converting 1 second when the 32,768 Hz clock is input, and outputs the time information.

The RTC unit 130 generates an interrupt signal by counting the RTC clock corresponding to a predetermined time to calculate whether the RTC clock is error. For example, the RTC device 130 may generate an interrupt signal at a time interval of 1 second, 10 seconds, 1 minute, or 1 hour, and output the generated interrupt signal to the MPU 140.

The MPU 140 receives a system clock from the oscillator 110. The MPU 140 may compute the error of the RTC clock by comparing the output timing signal and the interrupt signal based on the system clock. The MPU 140 may correct the time information in the RTC device 130 based on the calculated error of the RTC clock.

That is, the MPU 140 receives an interrupt signal output from the RTC device 130 at predetermined time intervals, for example, at intervals of 1 second, 10 seconds, 1 minute, or 1 hour. In addition, the MPU 140 counts the system clock inputted from the oscillator 110 so as to correspond to a time interval of a predetermined time, for example, 1 second, 10 seconds, 1 minute, or 1 hour, Output. Then, the MPU 140 compares the generated timing signal and the interrupt signal for counting the same time interval, thereby calculating the error of the RTC clock.

The MPU 140 may include a system counter 141, a comparator 142, an error calculator 143, a clock error register 144, and a PLC controller 145.

The system counter 141 counts a system clock input from the oscillator 110 and outputs a timing signal.

The comparator 142 compares the timing signal and the interrupt signal to calculate an error of the RTC clock. The comparator 142 receives the timing signal and the interrupt signal from the oscillator 110 and the RTC device 130 at predetermined time intervals, compares the timing signal and the interrupt signal, and calculates an error time. Accordingly, the error time can be calculated more clearly as the time elapses.

The error calculator 143 calculates the number of error clocks based on the error time calculated by the comparator 142. [ At this time, the error calculator 143 calculates the number of error clocks by converting the error time into the frequency range of the RTC clock.

For example, if an arbitrary error time occurs due to the fact that the frequency of the RTC clock output by the arbitrary crystal 120 is not 32,768 Hz, for example, 32,767 Hz, the error time is divided into the frequency range of the RTC clock And calculates the number of error clocks.

The clock error register 144 stores the number of error clocks so that the RTC unit 110 can correct the time information based on the number of error clocks calculated by the error calculator 143. [

The PLC controller 145 receives the current time information from the RTC device 130 and controls the overall operation of the PLC.

The RTC unit 130 reads the number of error clocks stored in the clock error register 144 of the MPU 140 and can correct the time information based on the number of error clocks.

3 is a view for explaining a time correction method of an RTC apparatus built in a PLC according to an embodiment of the present invention.

Referring to FIG. 3, a system clock is generated by the oscillator 110 (S1). The system clock is input to the system counter 141. The system counter 141 counts the system clock input from the oscillator 110 (S2). At this time, the system counter 141 outputs a timing signal based on the preset number of counts (S3). The timing signal is input to the comparator 142.

On the other hand, an RTC clock is output from the crystal 120 (S4). The RTC clock is input to the RTC device 130. In the RTC apparatus 130, the RTC clock is counted, and an interrupt signal is generated every predetermined time (S5). At this time, the RTC unit 130 counts the RTC clock, converts the counted time information, and outputs the time information. The interrupt signal is input to the comparator 142.

The timing signal and the interrupt signal are compared in the comparator 142 (S6). At this time, the timing signal input to the comparator 142 and the interruption signal are values obtained by counting the same time. Therefore, in the comparator 142, the timing signal and the interrupt signal are compared and the error time is calculated (S7).

The calculated error time is input to the error calculator 143. The error calculator 143 calculates an error clock number corresponding to the input error time (S8). The number of error clocks calculated by the error calculator 143 is stored in the clock error register 144 (S9). The number of error clocks stored in the clock error register 144 is input to the RTC device 130. In the RTC device 130, time information correction is performed corresponding to the number of error clocks input (S10).

4 is a view for explaining a PLC having a time correction function of the RTC apparatus according to another embodiment of the present invention.

4, a PLC 200 having a time correction function of an RTC apparatus according to another embodiment of the present invention includes an oscillator 210, a crystal 220, an RTC unit 230, and an MPU 240. [ As shown in FIG.

The oscillator 210 is designed to operate only when power is supplied while power is applied. The oscillator 210 operates only when power is supplied to generate a clock for the operation of the MPU 240. The clock output from the oscillator 210 is referred to as a system clock as a basic clock for operation of the MPU 240.

On the other hand, the crystal 220 can operate as an auxiliary power source even when the power is off. Accordingly, the clock generated from the crystal 220 is input to the RTC unit 230, and the clock output from the crystal 220 as the RTC unit 230 is used to generate the time information is referred to as an RTC clock.

The RTC device 230 counts the RTC clock output from the crystal 220 to generate time information. The RTC unit 230 counts the RTC clock to generate an interrupt signal and outputs the generated interrupt signal to the MPU 240.

The RTC device 130 is operated by the crystal 220. At this time, it is preferable that the crystal 220 outputs an RTC clock of 32,768 Hz, but errors may occur depending on temperature or environment. In case of mass production, for example 32,767 Hz instead of 32,768 Hz, the RTC unit 230 calculates the current time by converting the RTC clock of 32,768 Hz into 1 second, and outputs the time information.

The RTC unit 230 generates an interrupt signal by counting the RTC clock corresponding to a preset time to calculate whether the RTC clock is error. For example, the RTC device 230 may generate an interrupt signal at a time interval of 1 second, 10 seconds, 1 minute, or 1 hour, and output the interrupt signal to the MPU 240.

Meanwhile, the RTC unit 230 may include a clock error register 231 for storing the number of error clocks for correcting a crystal frequency error of the RTC unit 230. The RTC unit 230 reads the number of error clocks stored in the clock error register 231 every predetermined period to correct the RTC time information. At this time, the number of error clocks stored in the clock error register 231 can be received from the MPU 240.

The MPU 240 receives the system clock from the oscillator 210. The MPU 240 can compute the error of the RTC clock by comparing the output timing signal and the interrupt signal based on the system clock. The MPU 240 can correct the time information in the RTC unit 230 based on the calculated error of the RTC clock.

That is, the MPU 240 receives an interrupt signal output from the RTC device 230 at intervals of 1 second, 10 seconds, 1 minute, or 1 hour, for example. In addition, the MPU 240 counts the system clock input from the oscillator 210 so as to correspond to a time interval of, for example, 1 second, 10 seconds, 1 minute, or 1 hour, and outputs a timing signal. Then, the MPU 240 compares the timing signal generated through the counting with the interrupt signal for the same time interval, and calculates the error of the RTC clock.

The MPU 240 may include a system counter 241, a comparator 242, an error calculator 243, and a PLC controller 244.

The system counter 241 counts a system clock input from the oscillator 210 and outputs a timing signal.

The comparing unit 242 can compute the error of the RTC clock by comparing the timing signal and the interrupt signal. The comparator 242 receives the timing signal and the interrupt signal from the oscillator 210 and the RTC device 230 at predetermined time intervals, compares them, and calculates an error time. Accordingly, the error time can be calculated more clearly as the time elapses.

The error calculator 243 calculates the number of error clocks based on the error time calculated by the comparator 242. [ At this time, the error calculator 243 can calculate the error clock number by converting the error time into the frequency range of the RTC clock.

For example, if an arbitrary error time occurs due to the fact that the frequency of the RTC clock output by any crystal 220 is not 32,768 Hz, for example, 32,767 Hz, the error time is divided into the frequency range of the RTC clock And calculates the number of error clocks.

The number of error clocks calculated by the error calculator 243 is transmitted to the RTC device 230. The number of error clocks delivered to the RTC device 230 is stored in the clock error register 231. Accordingly, the RTC unit 130 corrects the time information based on the number of error clocks stored in the clock error register 231.

The PLC control unit 244 receives the current time information from the RTC device 230 and controls the overall operation of the PLC.

5 is a view for explaining a time correction method of an RTC apparatus built in a PLC according to another embodiment of the present invention.

Referring to FIG. 5, a system clock is generated by the oscillator 210 (S21). The system clock is input to the system counter 241. The system counter 241 counts the system clock input from the oscillator 210 (S22). At this time, the system counter 241 outputs a timing signal based on the preset number of counts (S23). The timing signal is input to the comparator 242

On the other hand, an RTC clock is output from the crystal 220 (S24). The RTC clock is input to the RTC device 230. In the RTC device 230, the RTC clock is counted and an interrupt signal is generated at predetermined time intervals (S25). At this time, the RTC unit 230 counts the RTC clock and converts the time information into the time information. The interrupt signal is input to the comparator 242.

The timing signal and the interrupt signal are compared in the comparator 242 (S26). At this time, the timing signal input to the comparator 242 and the interruption signal are values obtained by counting the same time. Therefore, the comparator 242 compares the timing signal and the interrupt signal to calculate the error time (S27).

The calculated error time is input to the error calculator 243. The error calculator 243 calculates an error clock number corresponding to the input error time (S28). The number of error clocks calculated by the error calculator 243 is transmitted to the RTC device 230. The number of error clocks is stored in the clock error register 231 of the RTC device 230 (S29). In the RTC unit 230, time information correction is performed in accordance with the number of error clocks stored in the clock error register 231 (S30).

While the invention has been shown and described with reference to certain preferred embodiments thereof, it will be understood by those skilled in the art that various changes and modifications may be made without departing from the spirit and scope of the invention as defined by the appended claims. Accordingly, the true scope of the present invention should be determined by the following claims.

Claims (8)

Counting a system clock and receiving an output timing signal;
Receiving an interrupt signal from an RTC device that generates time information by counting an RTC clock;
Comparing the timing signal and the interrupt signal to calculate an error of the RTC clock; And
And correcting the time information in the RTC device based on the calculated error of the RTC clock.
2. The method of claim 1, wherein calculating the error of the RTC clock comprises:
Comparing the timing signal and the interrupt signal to calculate an error time; And
And calculating the number of error clocks based on the error time.
3. The method of claim 2, wherein the correcting the time information in the RTC device comprises:
Storing the calculated number of error clocks in a clock error register for compensating an error of the RTC clock; And
And correcting the time information in the RTC device based on the stored number of error clocks.
The method of claim 1, wherein the system clock is input from an oscillator and the RTC clock is input from a crystal.
An RTC device for counting the RTC clock to generate time information and output an interrupt signal; And
A timer for counting a system clock to calculate an error of the RTC clock by comparing the output timing signal with the interrupt signal, and an MPU for correcting the time information in the RTC device based on the calculated error of the RTC clock, And a time correction function of the RTC device.
6. The apparatus of claim 5,
A system counter for counting the system clock and outputting a timing signal;
A comparing unit comparing the timing signal with the interrupt signal to calculate an error time of the RTC clock;
An error calculator for calculating the number of error clocks based on the error time; And
And a clock error register for storing the number of error clocks so that the RTC device can correct the time information based on the calculated number of error clocks.
The method according to claim 6,
Wherein the RTC device is provided with a time correction function of an RTC device for correcting time information based on the stored error clock number.
6. The method of claim 5,
Wherein the RTC apparatus includes a clock error register for storing an error clock number for correcting time information,
The MPU includes:
A system counter for counting the system clock and outputting a timing signal;
A comparing unit comparing the timing signal with the interrupt signal to calculate an error time of the RTC clock;
And an error calculator for calculating the error clock number based on the error time and transmitting the calculated error clock number to the clock error register of the RTC device.
KR1020160014636A 2016-02-05 2016-02-05 Method for adjusting time information of real time clock device in programmable logic controller and the programmable logic controller KR20170093356A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
KR1020160014636A KR20170093356A (en) 2016-02-05 2016-02-05 Method for adjusting time information of real time clock device in programmable logic controller and the programmable logic controller

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
KR1020160014636A KR20170093356A (en) 2016-02-05 2016-02-05 Method for adjusting time information of real time clock device in programmable logic controller and the programmable logic controller

Publications (1)

Publication Number Publication Date
KR20170093356A true KR20170093356A (en) 2017-08-16

Family

ID=59752369

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1020160014636A KR20170093356A (en) 2016-02-05 2016-02-05 Method for adjusting time information of real time clock device in programmable logic controller and the programmable logic controller

Country Status (1)

Country Link
KR (1) KR20170093356A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20190050249A (en) * 2017-11-02 2019-05-10 현대오트론 주식회사 Real Time Clock Device and Method Thereof
CN113346881A (en) * 2021-05-27 2021-09-03 珠海东之尼电子科技有限公司 Digital clock calibration method, wireless remote controller and storage medium

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20190050249A (en) * 2017-11-02 2019-05-10 현대오트론 주식회사 Real Time Clock Device and Method Thereof
CN113346881A (en) * 2021-05-27 2021-09-03 珠海东之尼电子科技有限公司 Digital clock calibration method, wireless remote controller and storage medium
CN113346881B (en) * 2021-05-27 2023-08-18 珠海东之尼电子科技有限公司 Digital clock calibration method, wireless remote controller and storage medium

Similar Documents

Publication Publication Date Title
KR100687230B1 (en) Real time clock apparatus and the real time compensating method thereof
JP2007078405A (en) Timing program of software timepiece
US11874633B2 (en) Method for adjusting the operating frequency of an electronic watch
CN110413042B (en) Clock server, and time keeping frequency compensation method and device
KR20170093356A (en) Method for adjusting time information of real time clock device in programmable logic controller and the programmable logic controller
EP3503690B1 (en) Electronic device capable of adjusting light emitting frequency, computer system having the same and method for adjusting light emitting frequency of electronic device
US5719827A (en) Highly stable frequency generator
JP5931152B2 (en) Timing signal generator with temperature compensation function
JP2012047705A (en) Time correction device and control method
JP5931151B2 (en) Timing signal generator with temperature compensation function
CA2856377C (en) Metrology timekeeping systems and methods
JP2017020852A (en) Embedded device
JP2003270369A (en) Time correction method and time correction device for real time clock
KR100819735B1 (en) Computer system and control method thereof
US4730286A (en) Circuit and method for correcting the rate of an electronic timepiece
JP2006329759A (en) Monitoring control system
JP2010190585A (en) Electronic clock device, electronic equipment including the same, and control system
JP2006047101A (en) Timepiece precision correction device
JPWO2009040945A1 (en) Monitoring device and program
JP7333705B2 (en) circuit system
CN111694399B (en) Method and device for adjusting display clock
JP2005140595A (en) Radio controlled timepiece and time correcting method therefor
JP2011182099A (en) Reference signal generation device and method
JP2017181055A (en) Electronic timepiece of apparatus built-in type
JP2008151556A (en) Method for correcting time in remote monitoring/controlling system