This paper introduces a design scheme of a frequency meter, and applies this instrument to the measurement of the dome temperature of the 2.4m telescope in Lijiang, Yunnan Astronomical Observatory. The frequency measurement principle of the CCP module of PIC18F452 is elaborated in detail, and the design ideas of the instrument hardware and software are given. Finally, the system is simulated and tested in Proteus. The test results show the feasibility of this scheme. The development of this instrument also provides an effective measurement tool for the site selection of telescopes in the west.
Obtaining temperature data indirectly through frequency measurement is a common method for detecting the temperature of the dome of an astronomical telescope. Frequency signals not only have strong anti-interference capabilities, but are also easy to transmit. Therefore, the electrical signal generated by the temperature sensor near the dome of the telescope is converted into a frequency signal, and then the frequency signal is measured and collected, and finally the frequency value is converted into a temperature value through some determined functional relationships. Compared with the method of directly measuring temperature, this solution is more operational.
1 Frequency measurement principle of PIC18F452
PIC18F452 is a high-performance 8-bit microcontroller produced by Microchip Corporation of the United States. It has rich on-chip resources. The frequency meter designed in this article is realized by using the capture function of the CCP1 (capture/compare/pulse width modulation) module of the microcontroller. The functional block diagram of the CCP1 module working in capture mode is shown in Figure 1.
In capture mode, whenever one of the following events occurs on the CCP pin: every falling edge, every rising edge, every 4 rising edges, every 16 rising edges, CCP R1H:CCPR1L will capture the 16-bit count value of the TMR1 or TMR3 register, that is, record the moment when the event occurs. Using this function of the CCP module, frequency measurement can be achieved.
The principle of frequency measurement using PIC18F452 is shown in Figure 2: Set the CCP module to work in capture mode and let it capture data once on each rising edge. The time difference between two adjacent rising edges can be used to obtain the period of the measured pulse, and thus the frequency of the pulse.
2. Software and hardware design of frequency meter
2.1 Hardware Circuit Design
The hardware circuit of the frequency meter mainly includes two aspects: frequency measurement circuit and data communication circuit. Frequency measurement refers to using the CCP module of PIC18F452 to measure the frequency of the external pulse signal; data communication refers to transmitting the measured data to the PC through the serial port for processing. The hardware circuit of the frequency meter is shown in Figure 3.
2.2 Software Design
The main function of the software is to set up relevant functional modules to cooperate with the hardware to realize frequency acquisition and data upload. In order to achieve the purpose of real-time acquisition, the CCP module uses interrupt mode for capture. The frequency meter and PC adopt master-slave communication. PIC18F452 performs related operations according to different instructions sent by the PC. There are two kinds of instructions: start acquisition and stop acquisition. When receiving the "start acquisition" command, PIC18F452 starts the CCP module to measure the frequency and upload the measurement results to the PC through the serial port; when receiving the "stop acquisition" command, PIC18F452 turns off the CCP module, stops uploading data, and then continues to wait for the command of the host computer. The software flow chart of the frequency meter is shown in Figure 4.
3 Simulation Analysis
Using software simulation methods can not only verify the feasibility of the design in theory, but also reduce the cost and difficulty of development. This technology is very useful in development based on microcontrollers.
Proteus is a circuit analysis and physical simulation software developed by Labcenter in the UK. It can simulate and analyze a variety of analog devices and integrated circuits. It is very powerful and supports a variety of single-chip microcomputers, such as AVR, PIC, MCS-51, etc. What is more valuable is that the software can be seamlessly connected with Microchip's MPLAB integrated development environment, so that the program can be debugged step by step. The whole operation is also very simple. You only need to use MPLAB to compile the source program into a HEX file and import it into the circuit diagram in Proteus to continue the simulation test. The circuit schematic diagram used for the test is shown in Figure 5.
There are several points to note about this simulation schematic:
(1) The purpose of simulation is to verify the working condition of the CCP module of interest, so the crystal oscillator circuit and reset circuit of PIC18F452 are omitted in the figure. In fact, they will not affect the results of program operation.
(2) The simulation component (COMPIM) used in the serial communication part does not need level conversion. As long as the virtual serial port is installed and the relevant properties of the simulation component are set, the PIC18F452 in Proteus can communicate with the PC, so the MAX232 level conversion chip is omitted in the figure.
(3) COMPIM only provides a mapping relationship on the physical connection, so the connection method of the RxD pin and the TxD pin here is connected according to the corresponding relationship. In the actual hardware circuit, it is still necessary to connect according to the hardware circuit diagram (see Figure 3).
After the above work is completed, the designed circuit can be simulated and debugged. The simulation results of the program are shown in Figure 6.
As can be seen from Figure 6, PIC18F452 has measured the values of several set input frequencies, and the simulation results show that the solution is feasible.
4 Hardware circuit testing
After the simulation is passed, you can build the hardware circuit according to Figure 3 to test the hardware operation. Here, VB 6.0 is used to write the host computer software, and the Access database is used to store the frequency data uploaded by PIC18F452. The operation effect of the system is shown in Figure 7 and Figure 8.
5 Conclusion
At present, the frequency meter has been successfully applied to the temperature collection work of the 2.4 m dome in Lijiang, Yunnan Observatory. In the future, the instrument will be expanded and improved (for example, adding a data storage module to the instrument), and then the instrument will be able to adapt to the field working environment, which is of great practical significance for the site selection work of the western telescope that is about to begin.
Previous article:PIC microcontroller port expansion technology based on I2C bus
Next article:Design of IC card intelligent water meter based on PIC16F84 single chip microcomputer
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Microphone sound signal extraction and processing
- 5G will change the way we surf the Internet. Will each of us have a small base station?
- Learning to use FPGA to implement video and image processing design
- [RVB2601 Creative Application Development] Part 2 Development Preparation 2 (Development Environment Setup and Helloworld Example)
- Comparison of technical performance between 433MHz solution and 2.4G, micro-power, and direct sequence spread spectrum solutions
- EEWORLD University Hall----Mathematical Linear System Theory
- IIS2ICLX 2-axis digital inclinometer test
- [Fudan Micro FM33LG0 Series Development Board Review] Development Environment First
- OpenRGB, an open-source lighting control that does not rely on manufacturer software
- I recently took apart an old spectrum analyzer Advantest R4131D.