ENCYCLOPEDIA OF RADIO ELECTRONICS AND ELECTRICAL ENGINEERING Two-channel PC-based data acquisition and processing system. Encyclopedia of radio electronics and electrical engineering Encyclopedia of radio electronics and electrical engineering / Computers Once the author of the article needed to take the characteristics of the flame burning (radiation intensity in two narrow bands of the spectrum, the ratio between the intensities and their change in time depending on the speed of air movement, the volume of combustible substance, etc.). A digital oscilloscope could handle this task, but it was not available. I had to urgently develop a data acquisition and processing system that could make at least 100 measurements per second in each channel with a time delay between the same samples of no more than 0,5 ms. The output information is the signal voltage in each channel, the ratio of their levels and the difference between the previous and subsequent signal samples in each channel. Of course, it is unlikely that many readers will need to solve the same problem, however, the proposed hardware and software system can be considered as an example of building a workable data collection system, and it can serve as an initial impetus for developing your own. The described system consists of a device for collecting and transmitting data (let's call it DDD) and software for a PC. 1 (a photoconverter is conventionally not shown on it). It is based on the ATMEL AT90S4433-8PI (DDI) flash microcontroller, which includes a 10-bit ADC with an analog multiplexer. In this case, however, an external channel switch on integral keys DA1 is used. This seemed more convenient, as it allowed the use of one buffer amplifier on the op-amp DA3 with a variable gain Ku. The latter depends on the state of the DA4.1 key: if it is open, Ku = (R8/R6)+1, and if it is closed, Ku = [R8/(R6||R7)]+1 (here R6||R7 is the resistance in parallel connected resistors R6 and R7). The input stage of the op-amp DA3 is built on MOS transistors. This made it possible to use protective resistors (R1 and R2) at the input of each channel without reducing the measurement accuracy caused by the input current (leakage current of the DA1 microcircuit keys is also negligible). Resistors are necessary so that the input protective diodes built into the DA1 chip do not fail when the measured signal exceeds the DA1 supply voltage (the maximum allowable current through these diodes is 10 mA). Another important feature of the applied op-amp is that its input and output voltages can reach the supply voltage values (the so-called rail-to-rail op-amp). Thanks to this, it is possible to use one power supply for the op-amp and the microcontroller without narrowing the dynamic range of the measured signal. On the DA2 chip, a voltage regulator for the device is assembled, on DA5 - a source of exemplary voltage for the ADC of the microcontroller. The DA6 chip is used to communicate the universal asynchronous serial transceiver (UART) of the microcontroller with a PC via the RS232 serial interface. LEDs HL1 and HL2 - indicators of operating modes of the USD. The XP1 connector is required for sequential programming of the microcontroller in the device, for example, with the AS1 in-circuit programmer. Through the connector XS1, the JCD is connected to the serial port of the PC. The program for the microcontroller is written in AVR assembler in the AVR-Studio environment, which is freely distributed by ATMEL. The Windows application responsible for communicating with the DDD and processing the received information was created in the Delphi 5 environment. When writing the program, R. Kusyapkulov's article "Working with Serial Ports in Windows 95" helped me a lot (Radio, 2000, No. 1, p. .23). In the Delphi environment window, the application looks as shown in Fig. 2. Let's consider the operation of the software and hardware of the DRM in a complex. After the entire system is assembled and all the necessary connections are made, you can run the application. A window will appear on the computer monitor. At this time, the USD microcontroller is in the mode of constant polling of the UART receiver. The HL1 ("Ready to Receive") indicator lights up. The microcontroller program constantly checks the state of the RXC bit in the UCSRA register, waiting for it to go to a one state. The system is waiting for user action. It is possible either to change the gain of the DRD measuring path, or to start a measurement cycle. In the first case, you should "click" on the button "Ku=0,5" or "Ku=1". The components RadioButton 1 and Radiobutton 2 are responsible for switching the gain in the application program. For example, if you "click" on the button "Ku=0,5", the RadioButton2Click event handler will be launched and the Kamp variable will take the value 110. This code corresponds to the reduced gain (conditionally Ku=0,5). Now you can press the "Start" button (it is not visible in Fig. 2, since the "Complete" button is located on top of it), thereby starting the measurement cycle. Here it is expedient to consider the general ideology of data exchange between DDD and PC. Once started, the measurement cycle must be stopped at some point. In the described system, the following tactic is adopted. The measurement is not carried out continuously, but at intervals of just over 2 s (set by the Interval property of the Timerl component in the application program). Three hundred measurements in each of the channels takes a little less than 2 s. Thus, if a measurement cycle is started by the Timer1Timer event (300 measurements in each channel), then after it ends, there will be a short time left until the next Timer1Timer event occurs, sufficient for the application to react to the bbCompleteKeyPress event (if the "Complete" button was pressed). Note that in one measurement cycle, the DDD will send 1200 bytes of information to the PC, since the result of each measurement consists of two bytes. So, after clicking the "Start" button, a timer with a period of 110 ms is started (see the application program, procedure TForml bbStartClick). After this time, control passes to the Timer1Timer event handler. Code 110 or 130 (reduced or normal gain, respectively) is transmitted to the DDD through the serial port - the variable Kamr. The microcontroller receives this data, sets the required gain by closing or opening the DA4.1 key, and waits for new information to be received. At this time, the PC transmits code 100 (ActionKey variable in the application program) to the DRC. The microcontroller, having received this information, turns off the HL1 indicator, turns on the HL2 indicator (“Transmission in progress”) and starts the measurement cycle (action label in the microcontroller program) After making one measurement in each channel, the microcontroller transmits data to the PC and makes a short pause to ensure required signal sampling rate. Then the measurements, data transfer and pause are repeated 299 more times, after which the microcontroller goes into the mode of waiting for information from the PC (the HL2 indicator goes out, and HL1 lights up). If during the cycle (≈2,1 s) the "Complete" button was pressed, then immediately after the end of receiving the last of the 1200 bytes, control is transferred to the bbCompleteKeyPress handler. The computer transmits code 120 to the DDD, which is not recognized by the microcontroller as a known one, as a result of which the DRD remains in the mode of waiting for a command from the PC. If the "Complete" button has not been pressed, then a new measurement cycle will start upon the occurrence of the Timer1Timer event. And so on until the "Complete" button is pressed. The bbCompleteKeyPress handler also processes the received information and generates a text file in which the measurement results are presented in a convenient form. Each measurement cycle is named here as a block with a corresponding number. A fragment of the text file data_temp.txt is shown in fig. 3. The text contains some semblance of a "header" of the table, where "No. meas" is the measurement number (from 1 to 300 in the first block); IR - channel 1 signal voltage; dif IR - the difference between the previous and subsequent measurements of channel 1; cr - channel 2 signal voltage; dif cr - the difference between the previous and subsequent measurements of channel 2; dif - the ratio of the signal level of the first channel to the level of the second one. Establishing the DCD comes down to setting the voltage to +5 V by selecting the resistor R5 (it must be at least the exemplary one at the AREF DD1 input, but not more than 6 V) The KR1157EN1 (DA2) microcircuit can be replaced with an imported analog LM317L, as well as any adjustable voltage regulator of positive polarity with an output current of at least 30 mA. Instead of OU KR1446UD1A (DA3), you can use KR1446UD4A; the use of modifications with other letter indices is undesirable due to the higher zero bias voltage. Resistors - metal-dielectric C2-23, C2-33; capacitors C1-C3 - oxide-semiconductor tantalum K53-1, K53-4; the rest are ceramic KM, K10-17. Throttle L1 - unified DM, DPM. Connectors XP1 - PLD10, XS1 - DRB-9FB. Quartz resonator ZQ1-RK169MA-6AP-6000K. Programs for the microcontroller (program 1) and PC (program 2) Author: M.Bogdanov, Sarov, Nizhny Novgorod region. See other articles Section Computers. Read and write useful comments on this article. Latest news of science and technology, new electronics: Artificial leather for touch emulation
15.04.2024 Petgugu Global cat litter
15.04.2024 The attractiveness of caring men
14.04.2024
Other interesting news: ▪ A new method for diagnosing anxiety disorders ▪ New type of biomolecule discovered ▪ Super-maneuverable Tsubame satellite ▪ Ultrabook hybrid Toshiba Portege Z10T ▪ The ISS will become a filling station for satellites News feed of science and technology, new electronics
Interesting materials of the Free Technical Library: ▪ site section And then an inventor (TRIZ) appeared. Article selection ▪ article Dark kingdom. Popular expression ▪ article Which of the comets is the most famous? Detailed answer
Leave your comment on this article: All languages of this page Home page | Library | Articles | Website map | Site Reviews www.diagram.com.ua |