Menu English Ukrainian russian Home

Free technical library for hobbyists and professionals Free technical library


ENCYCLOPEDIA OF RADIO ELECTRONICS AND ELECTRICAL ENGINEERING
Free library / Schemes of radio-electronic and electrical devices

Cable probe on PIC controllers. Encyclopedia of radio electronics and electrical engineering

Free technical library

Encyclopedia of radio electronics and electrical engineering / Microcontrollers

Comments on the article Comments on the article

The described device consists of a transmitter and a receiver. On the side of the first, the ends of the wires are inserted into numbered clamps, and on the side of the second, they touch their other ends with a probe. The number of the terminal to which this or that wire is connected is displayed on the digital display of the receiver. To determine the numbers of cores, it is necessary to identify one of them and connect it to the common wire of the receiver and transmitter.

The transmitter operates in the pulse distributor mode for ten pins of the microcontroller (MK). Each of them has its own constant, to which tens are added at the moment of changing their code. In order for all 80 pulse distribution cycles to be performed in the same time, each of them is completed in the time from one interruption to the next. Interrupts occur when the TMR0 timer overflows. It has a division ratio preset, chosen to fit 80 output pulses between interrupts.

Consider the algorithm of the transmitter program (Fig. 1).

Cable probe on PIC controllers

After starting the program and initializing the registers, the tens register is reset. Its value is rewritten to port A for switching multiplexers. Next, interrupts are enabled, and the binary number of tens is used to find its decimal value, which is added to the first output constant. The output constant (K) is determined by its number: for the first it is equal to 1, for the second - 2, for the tenth -10. When the value of tens is zero, each output has a number of pulses equal to the output number.

Next, the program checks register K for zero. If it is not present, one is subtracted from the register, which is accompanied by switching the output to a single state. Then a pause of 24 µs is maintained, and the output is set to zero, which lasts 30 µs (i.e., the period of oscillation is 54 µs). After that, the program checks the register for zero. If the register is empty, it goes into interrupt waiting mode, and if its value is not equal to zero, the entire pulse generation cycle at the output is repeated. Thus, the output is the number of pulses that was written to the K register.

After the initialization of the registers, a prescaler with a division factor of 32 and a timer with a division factor of 137 (256 - 119) are turned on. With a 4 MHz crystal, the timer overflow interrupt should occur in about 4,38 ms (32-137 = 4384 µs), but the interrupt returns from the command without interrupt enable. To this time is added the cycle time until the interrupt is enabled and, in fact, the time for the interrupt itself to be executed (the total average duration of this time is 16 cycles). In addition, the prescaler is reset every time the timer is set, so the pause between interrupts is 4,4 ms. As it is not difficult to calculate, 80 oscillation periods will last 4,32 ms (54 μs x 80 \u4320d XNUMX μs), i.e. this time fits into the interval between interruptions.

After the timer overflows, the usual procedure for saving the values ​​​​of registers during an interrupt is performed and one is added (possibly subtracted) to the interrupt counter. The values ​​of this counter are not used by the program, and the counter itself is required to execute the interrupt. But it is convenient to use when debugging a program. After restoring the values ​​of the registers, an interrupt is enabled to generate pulses from the next output.

After the pulses are generated at the tenth output, the tens register is increased by one and the whole cycle is repeated with the command to write the binary code of tens to port A. In the new cycle, the number of generated pulses at each output increases by ten. When the tens value reaches eight, the pulse shaping cycle will begin by resetting the tens register to zero. Thus, the maximum value of tens is seven, and the maximum number of pulses will be at the tenth output (10 + 70 = 80). All 80 interrupt cycles last 0,352 s (4,4 ms x 80). This time determines the guaranteed duration of the pause between the issuance of pulses at each output. For a single pulse at the first output, the pause duration will be increased by almost a time equal to the time between interruptions, and for 80 pulses at the tenth output, the pause between pulses will be 0,352 s. This should be noted in order to better understand the operation of the receiving part of the probe.

The schematic diagram of the transmitter is shown in fig. 2.

Cable probe on PIC controllers
(click to enlarge)

All bits of the port In MK DD1 are configured for output and have coefficients from one to eight. Bits RAO-RA2 are used to output the values ​​of the tens register in binary code, RA3 and RA4 - as outputs with coefficients of 9 and 10, respectively. Since the RA4 output has an open drain, it is loaded with a resistor R1. The Y inputs (pin 3) of the DD2-DD11 multiplexers are connected to the bits of port B, the address inputs (A, B, C) are connected in parallel and connected to the outputs of dozens of MKs.

Thus, with a zero value of the tens register, a zero address will be selected on all multiplexers, and a number of pulses will appear at their XO outputs (pin 13), equal to the output coefficient of the MK, which is connected to the Y input of the multiplexer. Only one pulse will be constantly present at the XO output of the DD2 microcircuit, and 11 pulses at the DD10 output of the same name. When the address of the multiplexer is increased by one, its next output (X1) will turn on, and the number of pulses on it will increase by ten. Thus, only its own number of pulses will appear sequentially at each output of the multiplexers. The lower (according to the diagram) output of the transmitter (Common) is connected, as noted, to one known wire, which will be common to the transmitter and receiver.

The cable probe receiver works on the principle of a two-digit counter. The algorithm of his program is shown in Fig. 3, and the schematic diagram - in fig. 4.

Cable probe on PIC controllers

After start-up and initialization, the program proceeds to dynamic indication of two LED digital indicators with a common cathode. The time for the indication of one indicator is 5 ms, i.e., the entire indication cycle is repeated at a frequency of 100 Hz.

Cable probe on PIC controllers
(click to enlarge)

The receiver uses two types of interrupts: on the overflow of the TMR0 timer and on a change in the signal at the RB0 input. When a pulse arrives at this input, the values ​​of the current registers are saved. Next, the program checks the source of the interrupt. If it did not occur due to a timer overflow, then the pulse counter is incremented, the timer is reset (256 - 120 = 136) and the prescaler counter is reset. The program restores the values ​​of the registers, and the display continues. Thus, when pulses are received from the RBO input, the timer is constantly reset, so the timer overflow interrupt is not possible as long as pulses are present at this input.

If there are no pulses at the input for a long time, a timer overflow interrupt occurs. For the reliability of the receiver, the time between interruptions is slightly reduced compared to the transmitter and is equal to 4,38 ms. Timer overflow interrupts are counted by the interrupt counter. The pause between pulses at each output of the transmitter is 80 interrupts, so the interrupt counter in the receiver can count up to 80. If there were no input pulses during this time, the program rewrites the values ​​of the pulse counter registers into the indication registers and the readings are updated. This happens every 0,35 s.

Codes "firmware" MC transmitter and receiver are shown in Table. 1 and 2, respectively.

Cable probe on PIC controllers
(click to enlarge)

Outputs RB1-RB7 MK DD1 switch elements (segments) of LED indicators HG1, HG2, outputs RA0, RA1 - their cathodes. The pulses from the probe are fed to the input RB0. Terminal X1 is connected to a known cable core, which serves as a common wire for the receiver and transmitter. If the transmitter multiplexer output is not selected by address, it will have an undefined level and when pulses appear on the receiver counter, there will be one false alarm (regardless of the set counter threshold: it can be either a zero-to-one or a one-to-zero threshold) . To avoid false pulses, the input is shunted by resistor R1.

The receiver and transmitter are powered by batteries made up of three AA or AAA cells each. If you intend to work with the receiver for a long time, it is advisable to use a 3R12X battery.

The receiver and transmitter used quartz resonators at a frequency of 4 MHz. Without any changes in the circuits and programs, you can use resonators with a lower frequency, down to 1 MHz. In this case, the refresh rate of the indicators readings will decrease accordingly, but it will remain at an acceptable value for the eyes - up to 25 Hz.

The transmitter is mounted on two printed circuit boards, each of which is designed for 40 outputs (the second one differs from the first one in that it does not have a DD1 chip and there is a place for installing a resistor R1). The boards are placed one under the other, connected with screws and threaded posts, and a case for three battery cells is installed between the boards (in the area where the DD1 chip is located).

The clamps for connecting wires on the transmitter board are self-made (Fig. 5). They consist of two identical brackets 2, bent in the form of the letter "L" from strips of sheet bronze or well-spring brass 0,4 ... 0,5 thick and 2,5 mm wide. One of the ends of the blanks is sawn to a width of about 1 mm (at a length of 1,5 ... 2 mm, depending on the thickness of the material of the boards 1), in the other, a hole with a diameter of 1,2 mm is drilled, after which the ends are bent. The sawn parts of the brackets are soldered into the boards, as shown in Fig. 5.

Cable probe on PIC controllers

To connect wire 3, the lower and upper (according to the figure) ends of the brackets are compressed until the holes match. After installation, the clamps are numbered in such a way that, by turning the transmitter (when the bottom becomes the top, and vice versa), their numbers can be seen.

Author: N.Zaets, Veidenevka village, Belgorod region.

See other articles Section Microcontrollers.

Read and write useful comments on this article.

<< Back

Latest news of science and technology, new electronics:

Machine for thinning flowers in gardens 02.05.2024

In modern agriculture, technological progress is developing aimed at increasing the efficiency of plant care processes. The innovative Florix flower thinning machine was presented in Italy, designed to optimize the harvesting stage. This tool is equipped with mobile arms, allowing it to be easily adapted to the needs of the garden. The operator can adjust the speed of the thin wires by controlling them from the tractor cab using a joystick. This approach significantly increases the efficiency of the flower thinning process, providing the possibility of individual adjustment to the specific conditions of the garden, as well as the variety and type of fruit grown in it. After testing the Florix machine for two years on various types of fruit, the results were very encouraging. Farmers such as Filiberto Montanari, who has used a Florix machine for several years, have reported a significant reduction in the time and labor required to thin flowers. ... >>

Advanced Infrared Microscope 02.05.2024

Microscopes play an important role in scientific research, allowing scientists to delve into structures and processes invisible to the eye. However, various microscopy methods have their limitations, and among them was the limitation of resolution when using the infrared range. But the latest achievements of Japanese researchers from the University of Tokyo open up new prospects for studying the microworld. Scientists from the University of Tokyo have unveiled a new microscope that will revolutionize the capabilities of infrared microscopy. This advanced instrument allows you to see the internal structures of living bacteria with amazing clarity on the nanometer scale. Typically, mid-infrared microscopes are limited by low resolution, but the latest development from Japanese researchers overcomes these limitations. According to scientists, the developed microscope allows creating images with a resolution of up to 120 nanometers, which is 30 times higher than the resolution of traditional microscopes. ... >>

Air trap for insects 01.05.2024

Agriculture is one of the key sectors of the economy, and pest control is an integral part of this process. A team of scientists from the Indian Council of Agricultural Research-Central Potato Research Institute (ICAR-CPRI), Shimla, has come up with an innovative solution to this problem - a wind-powered insect air trap. This device addresses the shortcomings of traditional pest control methods by providing real-time insect population data. The trap is powered entirely by wind energy, making it an environmentally friendly solution that requires no power. Its unique design allows monitoring of both harmful and beneficial insects, providing a complete overview of the population in any agricultural area. “By assessing target pests at the right time, we can take necessary measures to control both pests and diseases,” says Kapil ... >>

Random news from the Archive

Biochemistry for automotive fuel 24.04.2015

On the roads, you can increasingly see cars that use gas instead of gasoline. These are mainly commercial vehicles - trucks or buses, for which it is more economical to drive on gas. Inside the red cylinders marked "flammable" is usually propane gas or a mixture of it with other hydrocarbons, such as butane.

All these hydrocarbons are obtained by processing gas or oil extracted from the bowels of the earth, which mankind has learned to use as fuel or as a raw material for the production of all kinds of plastics. Recently, however, technologies for obtaining fuel from biological raw materials have been widely developed. But if terms like bioethanol or biodiesel have been around for a long time, what about "biogas"?

They learned how to get methane from biological waste - the simplest of a number of hydrocarbons. For this, special bioreactors are used. In them, special types of bacteria process biomass, resulting in a mixture of gases, consisting mainly of the methane we need. Then it can be cleaned of impurities, pumped into special containers under pressure and used as fuel. Such a process has been created, worked out and there are already buses that run on biogas. However, there is one problem, and it lies in the difference in the properties of methane from heavier gases.

The fact is that propane and butane can be converted into a liquid state at ordinary temperature and relatively low pressure. Take, for example, an ordinary household lighter - a thin case made of transparent plastic is enough to safely store liquefied hydrocarbons. But this will not work with methane - in order to convert methane into a liquid, it will have to be cooled to a temperature of - 82 ° C. Therefore, in order to stock up on the necessary amount of methane, one has to use a container that can withstand a pressure of several hundred atmospheres.

This makes methane a much less convenient transportation fuel than propane. However, if bacteria that can synthesize methane exist, then everything is much more sad with the synthesis of complex hydrocarbons: in nature there are no such biological processes that would result in the formation of propane.

Researchers from the Department of Biotechnology at the University of Manchester have tackled this problem and come up with a way to make biopropane. To do this, they artificially changed the biochemical process by which the E. coli bacterium can produce alcohol - butanol. Butanol or butyl alcohol differs from the well-known ethyl alcohol in the length of the carbon chain - it has four carbon atoms, and not two, like ethanol. Biochemists managed to change the direction of the process so that propane was obtained in the last stage of the reaction instead of butanol.

Of course, so far this is nothing more than a laboratory study that has shown a way in which complex hydrocarbons of biological origin can be obtained. However, it has a chance to become the basis of an alternative way to obtain efficient fuel.

Other interesting news:

▪ Restoration of tooth enamel

▪ Anti-mosquito composition for clothing

▪ Hydrogen sailboat Nemesis Yacht

▪ Nerves stop the bleeding

▪ High-speed remote radar-metal detector

News feed of science and technology, new electronics

 

Interesting materials of the Free Technical Library:

▪ section of the site Calls and audio simulators. Article selection

▪ parachute article. History of invention and production

▪ article In which country are deceased relatives regularly removed from the crypt and changed clothes? Detailed answer

▪ article A woodworker who paints and varnishes on spray machines in a high voltage electric field. Standard instruction on labor protection

▪ See the article Displaying eight waveforms on an oscilloscope screen. Encyclopedia of radio electronics and electrical engineering

▪ article Switching power supply, 5 volts 0,2 amperes. Encyclopedia of radio electronics and electrical engineering

Leave your comment on this article:

Name:


Email (optional):


A comment:





All languages ​​of this page

Home page | Library | Articles | Website map | Site Reviews

www.diagram.com.ua

www.diagram.com.ua
2000-2024