This application claims priority to Taiwanese Patent Application No. 101142775, filed on Nov. 16, 2012, the disclosure of which is hereby incorporated by reference he
The technical field relates to a real-time sampling device and a method thereof, and more particularly, to a real-time sampling device applicable to a digital servo control system and method thereof.
In recent years, embedded systems are flourishing. Many control systems employ embedded systems architectures to implement digital control in high-level servo systems using their powerful computing capability.
In general, most of the complex, high-level algorithms can be implemented through software. In terms of digitizing real systems, precision in system sampling time is a crucial factor for accurate digital controls. Users may choose the appropriate hardware and software to construct an embedded control system (such as a fast interrupt processor to reduce hardware delay, a hard real-time operating system to reduce software delay and the like) in the hope that the system can accurately sample feedback values periodically, and complete the control algorithm and send out the result before the end of the current cycle. Therefore, before digital servo control is implemented, the real-time performance of the system is assessed according to the system bandwidth to ensure that the system meets the requirements for digital control.
When implementing a digital control system with high-level algorithms through software, in addition to paying attention to whether the computing power of the system is sufficient enough, the real-time performance of the system also needs to be checked to ensure that the system can meet the digitalized conditions for fixed-period samplings. Under the constraints of these conditions, most of the embedded servo control systems are applicable only to controls of low bandwidths and simple calculations. As for high-bandwith and calculation-complex controls, the control results are often not desirable due to poor real-time performance of the system.
The present disclosure provides a real-time sampling device coupled to a processing unit. The real-time sampling device may include: a timer for outputting an interrupt signal; a first register for externally receiving a first input signal and processing the first input signal to produce first processed data; a second register coupled to the first register and the timer for retrieving the first processed data from the first register upon receiving the interrupt signal sent from the timer, and the processing unit, upon receiving the interrupt signal sent from the timer, retrieving the first processed data from the second register and performing calculation thereon to produce a first processed data calculation value; a third register coupled with the processing unit for receiving and temporarily storing the first processed data calculation value produced by the processing unit; and a trigger output element coupled with the third register and the timer for outputting the first processed data calculation value in the third register upon receiving the interrupt signal sent from the timer.
The present disclosure also provides a real-time sampling method, which may include the following steps of: (1) receiving a first input signal and processing the first input signal by a first register to produce first processed data; (2) retrieving the first processed data from the first register by a second register upon receiving an interrupt signal, and upon receiving the interrupt signal, retrieving the first processed data from the second register and performing calculation by a processing unit to produce a first processed data calculation value and transmit the first processed data calculation value to a third register; (3) receiving and temporarily storing the first processed data calculation value produced by the processing unit by the third register in order to transmit the first processed data calculation value to a trigger output element; and (4) outputting the first processed data calculation value in the third register by the trigger output element upon receiving the interrupt signal.
The real-time sampling device and method use the second register to retrieve the processed data from the first register in real time upon receiving the interrupt signal, such that the processing unit can retrieve the processed data from the second register upon receiving the interrupt signal, and the trigger output element can output the processed data calculation value produced by the processing unit and stored in the third register upon receiving the interrupt signal, thereby eliminating delay between the time at which the interrupt signal is sent from the timer and the time at which processing unit retrieves the processed data.
The present disclosure can be more fully understood by reading the following detailed description of the preferred embodiments, with reference made to the accompanying drawings, wherein:
Below, exemplary embodiments will be described in detail with reference to accompanying drawings so as to be easily realized by a person having ordinary knowledge in the art. The inventive concept may be embodied in various forms without being limited to the exemplary embodiments set forth herein. Descriptions of well-known parts are omitted for clarity, and like reference numerals refer to like elements throughout. Refer to
The timer 10 can output an interrupt signal. The first register 11 can receive an external input signal through the input interface 17 and perform processing of the input signal to produce processed data and store the processed data.
The second register 12 can retrieve the processed data from the first register 11 upon receiving the interrupt signal sent from the timer 10. The processing unit 20 can retrieve the processed data from the second register 12 upon receiving the interrupt signal sent from the timer 10, so as to perform calculations on the processed data to produce a processed data calculation value, and transmit this processed data calculation value to the third register 13.
The third register 13 can receive, and temporarily store the first processed data calculation value produced by the processing unit 20.
The trigger output element 16 can output the processed data calculation value to the output interface 19 upon receiving the interrupt signal sent from timer 10.
Traditionally, there is a delay between the time at which the processing unit 20 retrieves the processed data from the first register 11 upon receiving the interrupt signal sent from the timer 10 and the time at which the interrupt signal is sent, which causes further delay in the processing unit 20 performing calculation on the processed data and then storing the result in the third register. On the other hand, the second register 12 of the present disclosure immediately retrieves the processed data from the first register 11 in real time upon receiving the interrupt signal sent from the timer 10, such that the processing unit 20 can retrieve the processed data from the second register 12 for subsequent calculation upon receiving the interrupt signal sent from the tinier 10, and the trigger output element 16 can immediately output the processed data calculation value produced by the second register 12 in real time upon receiving the interrupt signal sent from the timer 10. As a result, real-time sampling can be achieved.
Referring to
The fourth register 14 can receive a second input signal sent by the timer 10, and then perform processing on the second input signal to produce and store second processed data.
The fifth register 15 can retrieve the second processed data from the fourth register 14 upon receiving the interrupt signal sent from the timer 10, and the processing unit 20 can retrieve the second processed data from the fifth register 15 upon receiving the interrupt signal sent from the timer 10, and perform calculation on the second processed data to produce and transmit a second processed data calculation value to the third register 13.
The third register 13 can receive and temporarily store the second processed data calculation value produced by the processing unit 20, and the trigger output element 16 can output the second processed data calculation value to the output interface 19 upon receiving the interrupt signal sent from the timer 10.
Thus, in the modification of the real-time sampling device shown in
Referring to
In step S202, the first processed data are retrieved from the first register by a second register upon receiving an interrupt signal, and the first processed data are retrieved from the second register by a processing unit upon receiving the interrupt signal, the first processed data are processed by the processing unit to produce a first processed data calculation value, which is transmitted to a third register. In addition, step S206 can be performed at the same time as step S202. In step S206, the second processed data are retrieved from the fourth register by a fifth register upon receiving an interrupt signal, and the second processed data are retrieved from the fifth register by the processing unit upon receiving the interrupt signal, the second processed data are processed by the processing unit to produce a second processed data calculation value, which is transmitted to the third register.
In step S203, the first processed data calculation value (and the second processed data calculation value) produced by the processing unit are temporarily stored by the third register, and the first processed data calculation value (and the second processed data calculation value) are transmitted to a trigger output element.
In step S204, the first processed data calculation value (and the second processed data calculation value) in the third register is/are outputted by the trigger output element upon receiving the interrupt signal.
From the illustrations in
As shown in
The timer 10 can include a data register 101, a control register 102 and a timer logic unit 103, and is used for sending an interrupt signal to the processing unit 20, the latch register 302 of the decoder 30 and the trigger output element 401 of the D/A converter 40.
The decoder 30 can include the timing register 301, the latch register 302 and the decoder logic unit 303. The decoder logic unit 303 can receive an encoder input signal. The timing register 301 can perform counting on the encoder input signal and store the count value. The latch register 302, upon receiving the interrupt signal, retrieves the count value from the timing register 301. Then, the processing unit 20 retrieves the count value from the latch register 302 via a bus by the bus controller 60, and performs calculation on the count value to determine and store a voltage value into the D/A data register 402 of the D/A converter 40.
The D/A converter 40 includes the trigger output element 401, the D/A data register 402 and the D/A logic unit 403. The trigger output element 401, upon receiving the interrupt signal, retrieves the voltage value from the D/A data register 402 in real time, and the D/A logic unit 403 outputs the voltage value. The outputted voltage value is an output signal in the analog form.
As shown in
The timer 10 can send an interrupt signal to the processing unit 20, the latch register 502 of the A/D converter 50 and the trigger output element 401 of the D/A converter 40.
The A/D converter 50 can include the A/D data register 501, the latch register 502 and an A/D control register 503 and the A/D logic unit 504. The A/D control register 503 can receive an analog input signal. The A/D data register 501 performs conversion on the analog input signal and temporarily store a converted value. The latch register 502, upon receiving the interrupt signal, retrieves the converted value from the A/D data register 501. Then, the processing unit 20 retrieves the converted value from the latch register 502 via a bus by the bus controller 60, and performs calculation on the converted value to determine and store a voltage value into the D/A data register 402 of the D/A converter 40.
In the D/A converter 40, the trigger output element 401, upon receiving the interrupt signal, retrieves the voltage value from the D/A data register 402 in real time, and the D/A logic unit 403 outputs the voltage value. The output voltage value is an output signal in the analog form.
As shown in
In
Referring to
Therefore, the real-time sampling device and method of the present disclosure can be applied to the digital servo controlled system, and real-time sampling of the controlled subject can be achieved.
It will be apparent to those skilled in the art that various modifications and variations can be made to the disclosed embodiments. It is intended that the specification and examples be considered as exemplary only, with a true scope of the disclosure being indicated by the following claims and their equivalents.
Number | Date | Country | Kind |
---|---|---|---|
101142775 | Nov 2012 | TW | national |