PIC microcontrollers, where can they be useful for a radio amateur?

Among the many families of microcontrollers from different manufacturers, radio amateurs love two - AVR and PIC. PIC microcontrollers are manufactured by Microchip.

Enthusiasts and hobbyists in the field of electronics often use them both for assembling ready-made projects and for developing their own small automated systems. For example, many built-in volt-ampere meters from China are built on the basis of PIC controllers.

Types of PIC microcontrollers and their architecture

Perhaps the most common microcontrollers among beginners are the junior models, namely the following families:

  • Pic10;
  • Pic12;
  • Pic16.

These microcontrollers are 8-bit, and there are two architectures:

  1. Baseline with 10-bit instructions with 35 assembly instructions.
  2. Mid-range with 14-bit instructions and 35 or 49 assembly language instructions depending on the specific model.

In the developments of radio amateurs, the 16f628 model is very often encountered. The configuration of this pic microcontroller is as follows, it has:

  • built-in clock generator can be set to 4 or 8 MHz;
  • 18 legs – ports, of which 16 can be used for data input/output, 2 are used for power supply;
  • the ability to use a quartz resonator to operate at clock frequencies up to 20 MHz (then 2 more legs are used for it);
  • the letter F in the marking indicates Flash memory with a capacity of 2048 words;
  • Harvard architecture, with 14-bit instructions, 35 in total;
  • machine cycle length is 4 clock cycles (1 action is performed in 4 clock cycles of a quartz resonator or internal oscillator);
  • 224 bytes of RAM;
  • 128 bytes EEPROM;
  • USART – serial port;
  • internal voltage reference;
  • Powered from 3.3 to 5 V.

PIC16 have a low price and fairly developed analog peripherals, which ensures their popularity. At the same time, models can be produced in cases with the number of legs from 18 to 40. This allows you to create more complex systems than is possible in the above example.

There are also more powerful models, for example, 16-bit:

  1. PIC24x
  2. DsPIC30/33F – for digital signal processing.

They are capable of 16 MIPS (million iterations per second), which gives your system very fast performance at 2 push-pull machine cycles, which is achieved by a frequency of 32 MHz. 40 MIPS is achieved at 80 MHz respectively.

The 32-bit PIC32MX microcontrollers have greater performance and memory capacity than 16-bit models, and operate at 80 MHz.

An overview of PLC devices

Microprocessor-based systems (microcontrollers) act as programmable electronic devices for which programming languages ​​are specially developed.

Thanks to such programming languages, the process of programming controllers is greatly simplified. A high-level language designed for PLCs that provides simplicity, efficiency, and a user-friendly environment.

A microprocessor can actually be thought of as an electronic circuit that supports the processing of instructions stored in system memory. The same circuit works with instructions - arithmetic and logical, and uses external devices:

  • memory,
  • input ports,
  • output ports.

In turn, a microcontroller is an integrated circuit that contains:

  • microprocessor,
  • program and data memory,
  • clock generator,
  • input and output interfaces,
  • timers,
  • analog-to-digital converters,
  • external communication ports and other circuits.

A high-level language macro is an instruction, which is a shortened string containing several instructions. Recording a program with repetitive actions (similarity of instructions) when using macros is significantly reduced.


Microcontrollers are used everywhere in modern electronics. The ability to program microcontrollers opens up broad horizons

The efficiency of a macro-based program is as efficient as writing a program in "C" language. The compiler is responsible for creating appropriate substitutions to generate code that is transferred to the program memory of the microprocessor or microcontroller.

Scope of application of PIC microcontrollers

As already mentioned, the PIC16 family is very popular among radio amateurs. In addition, it is well described in a large amount of literature. In terms of the number of textbooks with the PIC family, at the time of writing, only the AVR family can compete.

Let's look at several circuits using microcontrollers of the PIC family.

Timer for load control on PIC16f628

The simplest automation on PIC microcontrollers is the element of the 8-bit family. Their memory capacity does not allow the creation of complex systems, but is excellent for independently performing a couple of assigned tasks. So this three-channel timer circuit on Pic16f628 will help you control a load of any power. The load power depends only on the installed relay/starter/contactor and the capacity of the electrical network.

The device is configured using a set of 4 buttons SB1-SB4, parameters are displayed on HG1, this is an LCD display with 2 lines of 16 characters. The circuit uses an external 4 MHz quartz resonator, and KV1 is a relay with a 24 V coil power supply, you can use any relay as long as it matches the coil voltage of your power supply. The MK is powered by a 5 V stabilized source.

You can use from 1 to 3 channels to control the load, you just need to duplicate the circuit by adding a relay to the RA3, RA4 pins of the microcontroller.

Alarm clock on MK PIC16f628A

Such watches, according to the developer, turned out to be very accurate, their error is very small - about 30 seconds per year.

With minor modifications you can use any 7-segment indicators. They are powered by a 5V power supply; however, when disconnected from the network, they continue to operate on batteries, which you can see in the upper right corner of the diagram.

Soldering iron power regulator on PIC16f628A

Beginning radio amateurs do not always have the opportunity to buy a soldering station. But they can assemble it themselves. The diagram below shows an adjustable power supply on PIC16f628 for operating a soldering iron. The circuit is based on phase-pulse control. This is, in fact, a modified and modernized analogue of the classic thyristor regulator, but with microcontroller control.

The circuit is quite simple; at the bottom there is an LED display. The main power element is the BT139 thyristor, and the MOC3041 is needed for galvanic isolation of the MK from the network and control of the thyristor using a logical level of 5 V.

AVR microcontrollers

The first AVR microcontrollers were developed in 1996 by Atmel (now part of Microchip). The AVR project was developed by Alf-Egil Bogen and Vegar Wollan, so the AVR acronym received the first two letters from the names of the developers: Alf-Egil Bogen Vegard Wollan RISC, after which this abbreviation began to stand for more officially as Advanced Virtual RISC. The AT90S8515 was the first microcontroller in the AVR line, although the first microcontroller to hit the commercial market was the AT90S1200 (in 1997).

AVR microcontrollers are available in three main subfamilies:

TinyAVR: Less memory, small size, only suitable for simpler applications.

MegaAVR: These are popular microcontrollers that generally have a relatively large amount of memory (up to 256 KB), more onboard peripherals, and are suitable for fairly complex applications.

XmegaAVR: Used in commercial applications to solve complex problems that require large program memory and high speed.

How to flash a microcontroller? Where to start studying?

The official programmer for PIC families is PICkit V3, and is the most common. The program code is loaded into the chip using the software that is on the disk; it comes complete with the programmer. The IDE is called MPlab. It is the official development environment from the manufacturer, and by the way, it is free. To study devices there is an excellent book in Russian “Pic-microcontrollers. The Complete Guide" by Sid Katzen. In addition to this book, you will find a huge number of video lessons and text materials that will help you.

The use of PIC microcontrollers is very widespread; many radio amateurs assemble metal detectors and Geiger counters on these microcontrollers.

Controller families

The PIC controller does not exist in a single copy. The manufacturer produces a significant range of microcontrollers, each of which has its own characteristics, capabilities and potential uses. The number of families themselves is quite large and depends on the classifying feature, which is taken as the main one. Therefore, it is worth reporting only on the main classification, in which there are only three families: 8-, 16- and 32-bit. They, in turn, are divided into others, but since the families themselves are not the topic of the article, they will not be discussed.

ESP


ESP32
And finally, a few words about ESP. I have not worked with these MKs and know little about them. These are 32-bit stones with a Wi-Fi module on board. They use the xtensa architecture. They assemble smart houses and other interesting things (see sidebar below). You can again program in the Arduino IDE. The famous ESP8266, repeatedly mentioned on the pages of our website, belongs to this family. It also includes ESP32, the older brother of ESP8266.

Excerpt describing PIC

Pierre, who had decided with himself that before fulfilling his intention he did not need to reveal either his rank or knowledge of the French language, stood in the half-open doors of the corridor, intending to immediately hide as soon as the French entered. But the French entered, and Pierre still did not leave the door: irresistible curiosity held him back. There were two of them. One is an officer, a tall, brave and handsome man, the other is obviously a soldier or orderly, a squat, thin, tanned man with sunken cheeks and a dull expression on his face. The officer, leaning on a stick and limping, walked ahead. Having taken a few steps, the officer, as if deciding with himself that this apartment was good, stopped, turned back to the soldiers standing in the doorway and in a loud commanding voice shouted to them to bring in the horses. Having finished this matter, the officer, with a gallant gesture, raised his elbow high, straightened his mustache and touched his hat with his hand. - Bonjour la compagnie! [Respect to the whole company!] - he said cheerfully, smiling and looking around him. Nobody answered. – Vous etes le bourgeois? [Are you the owner?] - the officer turned to Gerasim. Gerasim looked at the officer in fear and questioningly. “Quartire, quartire, logement,” said the officer, looking down at the little man with a condescending and good-natured smile. – Les Francais sont de bons enfants. Que diable! Voyons! Ne nous fachons pas, mon vieux, [Apartments, apartments... The French are good guys. Damn it, let's not quarrel, grandfather.] - he added, patting the frightened and silent Gerasim on the shoulder. - Aca! Dites donc, on ne parle donc pas francais dans cette boutique? [Well, really, no one here speaks French?] he added, looking around and meeting Pierre’s eyes. Pierre pulled away from the door. The officer turned to Gerasim again. He demanded that Gerasim show him the rooms in the house. “The master is gone, don’t understand... mine is yours...” said Gerasim, trying to make his words clearer by the fact that he spoke them inside out. The French officer, smiling, spread his hands in front of Gerasim's nose, making him feel that he did not understand him, and, limping, walked to the door where Pierre stood. Pierre wanted to move away to hide from him, but at that very time he saw Makar Alekseich leaning out from the open kitchen door with a pistol in his hands. With the cunning of a madman, Makar Alekseich looked at the Frenchman and, raising his pistol, took aim. - Aboard!!! - the drunk shouted, pressing the trigger of the pistol. The French officer turned around at the shout, and at the same instant Pierre rushed at the drunken man. While Pierre grabbed and raised the pistol, Makar Alekseich finally hit the trigger with his finger, and a shot was heard that was deafening and covered everyone in gunpowder smoke. The Frenchman turned pale and rushed back to the door. Having forgotten his intention not to reveal his knowledge of the French language, Pierre, snatching the pistol and throwing it, ran up to the officer and spoke to him in French. – Vous n'etes pas blesse? [Are you injured?] - he said. “Je crois que non,” answered the officer, feeling himself, “mais je l'ai manque belle cette fois ci,” he added, pointing to the loose plaster in the wall. – Quel est cet homme? [Seems not... but this time it was close. Who is this man?] - the officer said, looking sternly at Pierre. “Ah, je suis vraiment au desespoir de ce qui vient d’arriver, [Ah, I’m really in despair at what happened,” Pierre said quickly, completely forgetting his role. – C'est un fou, un malheureux qui ne savait pas ce qu'il faisait. [This is an unfortunate madman who did not know what he was doing.] The officer approached Makar Alekseich and grabbed him by the collar. Makar Alekseich, his lips parted, as if falling asleep, swayed, leaning against the wall. “Brigand, tu me la payeras,” said the Frenchman, removing his hand. – Nous autres nous sommes clements apres la victoire: mais nous ne pardonnons pas aux traitres, [Robber, you will pay me for this. Our brother is merciful after victory, but we do not forgive traitors,” he added with gloomy solemnity in his face and with a beautiful energetic gesture. Pierre continued in French to persuade the officer not to punish this drunken, insane man. The Frenchman listened silently, without changing his gloomy appearance, and suddenly turned to Pierre with a smile. He looked at him silently for several seconds. His handsome face took on a tragically tender expression, and he extended his hand. – Vous m'avez sauve la vie! Vous etes Francais, [You saved my life. “You are French,” he said. For the Frenchman, this conclusion was undeniable. Only a Frenchman could accomplish a great deed, and saving his life, Mr. Ramball's capitaine du 13 me leger [Monsieur Ramball, captain of the 13th light regiment] was, without a doubt, the greatest deed. But no matter how undoubted this conclusion and the officer’s conviction based on it were, Pierre considered it necessary to disappoint him. “Je suis Russe, [I am Russian,”] Pierre said quickly. “Ti ti ti, a d'autres, [tell this to others," said the Frenchman, waving his finger in front of his nose and smiling. “Tout a l'heure vous allez me conter tout ca,” he said. – Charme de rencontrer un compatriote. Eh bien! Qu'allons nous faire de cet homme? [Now you will tell me all this. It's very nice to meet a compatriot. Well! what should we do with this man?] - he added, turning to Pierre, now as his brother. Even if Pierre were not a Frenchman, having once received this highest title in the world, he could not renounce it, said the expression on the face and tone of the French officer. In response to the last question, Pierre once again explained who Makar Alekseich was, explained that just before their arrival this drunken, crazy man stole a loaded pistol, which they did not have time to take away from him, and asked that his act be left unpunished. The Frenchman stuck out his chest and made a royal gesture with his hand. – Vous m'avez sauve la vie. Vous etes Français. Vous me demandez sa grace? Je vous l'accorde. Qu'on emmene cet homme, [You saved my life. Are you French. Do you want me to forgive him? I forgive him. Take this man away,” the French officer said quickly and energetically, taking the arm of Pierre, who had been promoted to the French for saving his life, and went with him into the house. The soldiers who were in the yard, hearing the shot, entered the vestibule, asking what had happened and expressing their readiness to punish those responsible; but the officer strictly stopped them. “On vous demandera quand on aura besoin de vous,” he said. The soldiers left. The orderly, who had meanwhile managed to be in the kitchen, approached the officer. “Capitaine, ils ont de la soupe et du gigot de mouton dans la cuisine,” he said. – Faut il vous l'apporter? [Captain, they have soup and fried lamb in the kitchen. Would you like to bring it?] “Oui, et le vin, [Yes, and wine,” said the captain. The French officer and Pierre entered the house. Pierre considered it his duty to again assure the captain that he was not a Frenchman and wanted to leave, but the French officer did not want to hear about it. He was so polite, kind, good-natured and truly grateful for saving his life that Pierre did not have the spirit to refuse him and sat down with him in the hall, in the first room they entered. In response to Pierre's assertion that he was not a Frenchman, the captain, obviously not understanding how one could refuse such a flattering title, shrugged his shoulders and said that if he certainly wanted to pass for a Russian, then let it be so, but that he, despite then, everyone is still forever connected with him with a feeling of gratitude for saving his life. If this man had been gifted with at least some ability to understand the feelings of others and had guessed about Pierre’s feelings, Pierre would probably have left him; but this man’s animated impenetrability to everything that was not himself defeated Pierre. “Francais ou prince russe incognito, [Frenchman or Russian prince incognito," said the Frenchman, looking at Pierre’s dirty but thin underwear and the ring on his hand. – Je vous dois la vie je vous offre mon amitie. Un Francais n'oublie jamais ni une insulte ni un service. Je vous offre mon amitie. Je ne vous dis que ca. [I owe you my life, and I offer you friendship. The Frenchman never forgets either an insult or a favor. I offer you my friendship. I say nothing more.] There was so much good nature and nobility (in the French sense) in the sounds of the voice, in the facial expression, in the gestures of this officer that Pierre, answering the Frenchman’s smile with an unconscious smile, shook the outstretched hand. “Capitaine Ramball du treizieme leger, decore pour l'affaire du Sept, [Captain Ramball, Thirteenth Light Regiment, Chevalier of the Legion of Honor for the cause of the seventh of September," he introduced himself with a smug, irrepressible smile that wrinkled his lips under his mustache. – Voudrez vous bien me dire a present, a qui' j'ai l'honneur de parler aussi agreablement au lieu de rester a l'ambulance avec la balle de ce fou dans le corps. [Will you be so kind as to tell me now with whom I have the honor of talking so pleasantly, instead of being at the dressing station with this madman’s bullet in my body?] Pierre answered that he could not tell his name, and, blushing, began was, trying to think of a name, talking about the reasons why he could not say this, but the Frenchman hastily interrupted him. “De grace,” he said. – Je comprends vos raisons, vous etes officier... officier superieur, peut être. Vous avez porte les armes contre nous. Ce n'est pas mon affaire. Je vous dois la vie. Cela me suffit. Je suis tout a vous. Vous etes gentilhomme? [Complete please. I understand you, you are an officer... a staff officer, perhaps. You served against us. It's none of my business. I owe you my life. This is enough for me, and I am all yours. Are you a nobleman?] – he added with a hint of a question. Pierre bowed his head. – Votre nom de bapteme, s'il vous plait? Je ne demande pas davantage. Monsieur Pierre, dites vous... Parfait. C'est tout ce que je desire savoir. [Your name? I don't ask anything else. Mister Pierre, did you say? Wonderful. That's all I need.] When fried lamb, fried eggs, a samovar, vodka and wine from the Russian cellar, which the French had brought with them, were brought, Rambal asked Pierre to take part in this dinner and immediately, greedily and quickly, like a healthy and The hungry man began to eat, chewing quickly with his strong teeth, constantly smacking his lips and saying excellent, exquis! [wonderful, excellent!] His face was flushed and covered with sweat. Pierre was hungry and gladly took part in the dinner. Morel, the orderly, brought a saucepan with warm water and put a bottle of red wine in it. In addition, he brought a bottle of kvass, which he took from the kitchen for testing. This drink was already known to the French and received its name. They called kvass limonade de cochon (pork lemonade), and Morel praised this limonade de cochon, which he found in the kitchen. But since the captain had wine obtained during the passage through Moscow, he provided kvass to Morel and took up a bottle of Bordeaux. He wrapped the bottle up to the neck in a napkin and poured himself and Pierre some wine. Satisfied hunger and wine revived the captain even more, and he talked incessantly during dinner. - Oui, mon cher monsieur Pierre, je vous dois une fiere chandelle de m'avoir sauve... de cet enrage... J'en ai assez, voyez vous, de balles dans le corps. En voila une (he pointed to his side) a Wagram et de deux a Smolensk,” he showed the scar that was on his cheek. - Et cette jambe, comme vous voyez, qui ne veut pas marcher. C'est a la grande bataille du 7 a la Moskowa que j'ai recu ca. Sacre dieu, c'etait beau. Il fallait voir ca, c'etait un deluge de feu. Vous nous avez taille une rude besogne; vous pouvez vous en vanter, nom d'un petit bonhomme. Et, ma parole, malgre l'atoux que j'y ai gagne, je serais pret a recommencer. Je plains ceux qui n'ont pas vu ca. [Yes, my dear Mr. Pierre, I am obliged to light a good candle for you because you saved me from this madman. You see, I've had enough of the bullets that are in my body. Here is one near Wagram, the other near Smolensk. And this leg, you see, doesn’t want to move. This was during the big battle of the 7th near Moscow. ABOUT! it was wonderful! You should have seen it was a flood of fire. You gave us a difficult job, you can boast about it. And by God, despite this trump card (he pointed to the cross), I would be ready to start all over again. I feel sorry for those who did not see this.] “J'y ai ete, [I was there,” said Pierre. – Bah, vraiment! “Eh bien, tant mieux,” said the Frenchman. – Vous etes de fiers ennemis, tout de meme. La grande redoute a ete tenace, nom d'une pipe. Et vous nous l'avez fait cranement payer. J'y suis alle trois fois, tel que vous me voyez. Trois fois nous etions sur les canons et trois fois on nous a culbute et comme des capucins de cartes. Oh!! c'etait beau, monsieur Pierre. Vos grenadiers ont ete superbes, tonnerre de Dieu. Je les ai vu six fois de suite serrer les rangs, et marcher comme a une revue. Les beaux hommes! Notre roi de Naples, qui s'y connait a crie: bravo! Ah, ah! soldat comme nous autres! - he said, smiling, after a moment of silence. - Tant mieux, tant mieux, monsieur Pierre. Terribles en bataille... galants... - he winked with a smile, - avec les belles, voila les Francais, monsieur Pierre, n'est ce pas? [Bah, really? All the better. You are fierce enemies, I must admit. The big redoubt held up well, damn it. And you made us pay dearly. I've been there three times, as you can see me. Three times we were on the guns, three times we were knocked over like card soldiers. Your grenadiers were magnificent, by God. I saw how their ranks closed six times and how they marched out like a parade. Wonderful people! Our Neapolitan king, who ate the dog in these matters, shouted to them: bravo! - Ha, ha, so you are our brother soldier! - So much the better, so much the better, Mr. Pierre. Terrible in battle, kind to beauties, these are the French, Mr. Pierre. Isn’t that right?] The captain was so naively and good-naturedly cheerful, and whole-hearted, and pleased with himself that Pierre almost winked himself, looking at him cheerfully. Probably the word “galant” made the captain think about the situation in Moscow. - A propos, dites, donc, est ce vrai que toutes les femmes ont quitte Moscow? Une drole d'idee! Qu'avaient elles a craindre? [By the way, please tell me, is it true that all the women left Moscow? A strange thought, what were they afraid of?] – Est ce que les dames francaises ne quitteraient pas Paris si les Russes y entraient? [Wouldn’t the French ladies leave Paris if the Russians entered it?] said Pierre. “Ah, ah, ah!..” The Frenchman laughed cheerfully, sanguineally, patting Pierre on the shoulder. - Ah! “elle est forte celle la,” he said. – Paris? Mais Paris Paris... [Ha, ha, ha!.. But he said something. Paris?.. But Paris... Paris...]

Programming with a programmer


But how to transfer the developed program to the microcontroller itself? How is microcontroller programming done? There are special devices specifically for this purpose - programmers. They send signals to the microcontroller that change memory cells according to the program. To begin the data transfer process, you need to insert the microcontroller into the programmer, and it, in turn, connect to the computer. Then you should run the firmware using the software. Typically, programming PIC controllers lasts from thirty seconds to two minutes.

Where is it used?

Due to its versatility, the PIC controller can be used almost anywhere. Microcontrollers themselves can be found in refrigerators, televisions, and washing machines. But the PIC product line has the peculiarity that circuits based on PIC controllers are popular among radio amateurs and self-taught roboticists. With their help, you can easily configure the operation of a unit or an entire device. Reasonable price, ease of programming and a significant amount of educational material contribute to this popularity.

You can use a PIC controller to create a radio-controlled car, a robotic arm, and other crafts that can be done on a modest budget. It can also be used for something industrial - the topic of creating automatic homemade machines controlled by a microcontroller is quite popular. The range of uses is wide, and with the right approach almost any purpose can be fulfilled, so circuits on PIC controllers can be seen not only on amateur creations.

Creating a program for a PIC controller


You can create a special program using the appropriate software and even in a simple notepad.
This possibility exists due to the fact that it works with programming languages ​​such as assembly and C. The main difference is the amount of information to be written and the ease of specifying data. You hear a lot about the complexity of C, but assembler is even more complex and requires a more careful approach. So, when creating a program, you must indicate which controller it is intended for. You may need to make a number of adjustments, but they must be done if you have experience or confidence in your abilities, because mistakes can lead to microcontrollers turning into ordinary pieces of plastic and iron.

Links

  • 16-bit MSP430 • MCS-96 • MCS-296 • PIC24 • MAXQ • Nios • 68HC12 • 68HC16
    32-bit ARM • MIPS • AVR32 • PIC32 • 683XX • M32R • SuperH • Nios II • Am29000 • LatticeMico32 • MPC5xx • PowerQUICC • Parallax Propeller

    Manufacturers Analog Devices • Atmel • Silabs • Freescale • Fujitsu • Holtek • Hynix • Infineon • Intel • Microchip • Maxim • Parallax • NXP Semiconductors • Renesas • Texas Instruments • Toshiba • Ubicom • Zilog • Cypress • Integral • Milander
    Components Register • Processor • SRAM • EEPROM • Flash memory • Crystal • Crystal oscillator • RC oscillator • Case
    Periphery Timer • ADC • DAC • Comparator • PWM controller • Counter • LCD • Temperature sensor • Watchdog Timer
    Interfaces CAN • UART • USB • SPI • I²C • Ethernet • 1-Wire
    FreeRTOS • μClinux • BeRTOS • ChibiOS/RT • eCos • RTEMS • Unison • MicroC/OS-II • Nucleus • Contiki
    Programming JTAG • • Programmer • Assembler • Interrupt • MPLAB • AVR Studio • MCStudio
    This article or section is strictly advertising in nature.
    This does not comply with Wikipedia rules. You can help the project by correcting the text according to Wikipedia's stylistic guidelines.
Rating
( 2 ratings, average 5 out of 5 )
Did you like the article? Share with friends:
For any suggestions regarding the site: [email protected]
Для любых предложений по сайту: [email protected]