Characteristics and block diagram of the pic16f628a microcontroller. LC meter on a PIC16F628A microcontroller. Diagram and description. Timer for load control on PIC16f628

Thermometer on the PIC16F628A and DS18B20 (DS18S20) microcontroller - an article with a detailed description of the memory thermometer circuit and, in addition, a logical continuation of the article I previously published on the Yandex site pichobbi.narod.ru. This thermometer has proven itself quite well, and it was decided to modernize it a little. In this article I will tell you what changes have been made to the scheme and work program, I will describe the new functions. The article will be useful for beginners. Later I converted the current version of the thermometer into .

The thermometer on the PIC16F628A and DS18B20 (DS18S20) microcontroller can:

  • measure and display temperature in the range:
    -55...-10 and +100...+125 with an accuracy of 1 degree (ds18b20 and ds18s20)
    -in the range -9.9...+99.9 with an accuracy of 0.1 degrees (ds18b20)
    -in the range -9.5...+99.5 with an accuracy of 0.5 degrees (ds18s20);
  • Automatically detect DS18B20 or DS18S20 sensor;
  • Automatically check the sensor for failure;
  • Remember the maximum and minimum measured temperatures.

The thermometer also provides for easy replacement of the 7-segment indicator from OK to an indicator with OA. A gentle procedure for writing to the EEPROM memory of the microcontroller has been organized. A voltmeter that has proven itself well is described in this article -.

The circuit diagram of a digital thermometer on a microcontroller was developed for reliable and long-term use. All the parts used in the circuit are not in short supply. The pattern is easy to follow and perfect for beginners.

The schematic diagram of the thermometer is shown in Figure 1

Figure 1 - Schematic diagram of a thermometer on PIC16F628A + ds18b20/ds18s20

Describe all schematic diagram I won’t use a thermometer, since it’s quite simple, I’ll just focus on the features.

Used as a microcontroller PIC16F628A from Microchip. This is an inexpensive controller and also not in short supply.

Digital sensors are used to measure temperature DS18B20 or DS18S20 from Maxim. These sensors are inexpensive, small in size, and information about the measured temperature is transmitted digitally. This solution allows you not to worry about the cross-section of the wires, their length, etc. Sensors DS18B20,DS18S20 capable of operating in the temperature range from -55… +125 °C.

The temperature is displayed on a 7-segment 3-digit LED indicator with a common cathode (OK) or with (OA).

To display the maximum and minimum measured temperatures on the indicator, you need the SB1 button. To reset the memory you also need the SB1 button

Using the SA1 button you can quickly switch sensors (street, house).

A jumper is needed to switch the common wire for the LED indicator. IMPORTANT! If the indicator is OK, then we put the jamper in the lower position according to the diagram, and solder the transistors VT1-VT3 with p-n-p conductivity. If the LED indicator is OA, then we move the jamper to the upper position according to the diagram, and solder the transistors VT1-VT3 with n-p-n conductivity.

In Table 1 you can see the entire list of parts and their possible replacement with an analogue.

Table 1 – List of parts for assembling the thermometer
Position designation Name Analog/replacement
C1, C2 Ceramic capacitor - 0.1 μFx50V -
C3 Electrolytic capacitor - 220μFx10V
DD1 Microcontroller PIC16F628A PIC16F648A
DD2,DD3 Temperature sensor DS18B20 or DS18S20
GB1 Three 1.5V AA batteries
HG1 7-segment LED indicator KEM-5631-ASR (OK) Any other low-power for dynamic indication and suitable for connection.
R1,R3,R14,R15 Resistor 0.125W 5.1 Ohm SMD size 0805
R2,R16 Resistor 0.125W 5.1 kOhm SMD size 0805
R4,R13 Resistor 0.125W 4.7 kOhm SMD size 0805
R17-R19 Resistor 0.125W 4.3 kOhm SMD size 0805
R5-R12 Resistor 0.125W 330 Ohm SMD size 0805
SA1 Any suitable switch
SB1 Tact button
VT1-VT3 Transistor BC556B for indicator with OK/transistor BC546B for indicator with OA KT3107/KT3102
XT1 Terminal block for 3 contacts.

For initial debugging of the digital thermometer, a virtual model built in Proteus was used. In Figure 2 you can see a simplified model in Proteus

Figure 2 – Model of a thermometer on the PIC16F628A microcontroller in Proteus

Figure 3-4 shows the circuit board of the digital thermometer

Figure 3 – Printed circuit board The thermometer on the PIC16F628A microcontroller (bottom) is not to scale.

Figure 4 – Printed circuit board of a thermometer on a PIC16F628A microcontroller (top) not to scale.

The thermometer, assembled working parts, starts working immediately and does not need debugging.

The result of the work is Figures 5-7.

Figure 5 - Appearance thermometer

Figure 6 - Appearance of the thermometer

Figure 7 - Appearance of the thermometer

IMPORTANT! In the thermometer firmware not sewn in advertising can be used for your pleasure.

Amendments made to the work program:

1 automatic detection of DS18B20 or DS18S20 sensor;

2. The rewriting time in EEPROM has been reduced (if the condition for rewriting is met) from 5 minutes to 1 minute.

3. The blinking frequency of the dot has been increased;

More detailed description The operation of the thermometer can be viewed in the document, which can be downloaded at the end of this article. If you don’t want to download, then on the website www.pichobbi.narod.ru The operation of the device is also perfectly described.

The finished board fit perfectly into a Chinese alarm clock (Figures 8, 9).

Figure 8 – All the stuffing in a Chinese alarm clock

Figure 9 - All the filling in the Chinese alarm clock

Video - Thermometer operation on PIC16F628A


This version of the watch is made in such a way as to simplify the circuit as much as possible, reduce power consumption, and ultimately obtain a device that easily fits in your pocket. Having selected miniature batteries to power the circuit, SMD mounting and a miniature speaker (for example, from a non-working mobile phone), you can get a design slightly larger than a matchbox.
The use of a super-bright indicator allows you to reduce the current consumed by the circuit. A reduction in current consumption is also achieved in the "LoFF" mode - the indicator is off, and only the blinking dot of the low-order digit of the clock is turned on.

Indication
Adjustable brightness of the indicators allows you to choose the most comfortable display of readings (and again reduce energy consumption).
The watch has 9 display modes. Switching between modes is carried out using the “plus” and “minus” buttons. Before the readings themselves are displayed, a short hint about the name of the mode is displayed on the indicators. The duration of the hint display is one second. The use of short-term prompts made it possible to achieve good ergonomics of the watch. When switching between display modes (of which there are quite a lot for such a simple device as an ordinary watch), there is no confusion, and it is always clear which readings are displayed on the indicator.


Correction of the readings displayed on the indicator is activated by pressing the "Correction" button. In this case, a short-term prompt is displayed for 1/4 second, after which the adjusted value begins to blink at a frequency of 2 Hz. The readings are corrected using the plus and minus buttons. When you press the button for a long time, the auto-repeat mode is activated at the specified frequency. The auto-repeat frequencies for pressing a button are: for hours, months and day of the week - 4 Hz; for minutes, year and indicator brightness - 10 Hz; for the correction value - 100 Hz.
All adjusted values, except hours, minutes and seconds, are written to EEPROM and restored after turning the power off and on. The seconds during correction are reset to zero. All modes except hours-minutes, minutes-seconds and LoFF are automatically returned. If no button is pressed within 10 seconds, the clock switches to the hour-minute display mode.
By pressing the button "On/Off alarm." The alarm clock turns on/off. The activation of the alarm is confirmed by a short two-tone sound. When the alarm clock is on, the dot in the low-order digit of the indicator lights up.
In the "Corr" mode, a correction constant is displayed on the indicator, the initial value of which is 5000 microseconds per second. When the clock lags, we increase the constant by the amount of lag calculated in microseconds per second. If the clock is in a hurry, then we reduce the constant according to the same principle.

Model name: PIC16F628A-I/P

Detailed description

Manufacturer: Microchip

Description: 8-bit microcontrollers (MCU) 3.5 KB 224 RAM 16 I/O

Brief contents of the document:
PIC16F627A/628A/648A Data Sheet
Flash-Based, 8-Bit CMOS Microcontrollers with nanoWatt Technology
© 2009 Microchip Technology Inc.
DS40044G
Note the following details of the code protection feature on Microchip devices: Microchip products meet the specification contained in their particular Microchip Data Sheet.

Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the intended manner and under normal conditions. There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchip's Data Sheets. Most likely, the person doing so is engaged in theft of intellectual property. Microchip is willing to work with the customer who is concerned about the integrity of their code. Neither Microchip nor any other semiconductor manufacturer can g

Specifications:

  • Supply Voltage - Max: 5.5 V
  • Supply Voltage - Min: 3 V
  • Mounting type: Through Hole
  • On-chip ADC: no
  • Height: 3.3 mm
  • Length: 22.86 mm
  • Interface: USART
  • Number of I/O lines: 16
  • Number of timers: 3
  • Operating supply voltage: 3 V... 5.5 V
  • Operating temperature range: - 40 C ... + 85 C
  • RAM size: 224 B
  • Data ROM size: 128 B
  • Program memory size: 3.5 KB
  • CPU Series: PIC16
  • Maximum clock frequency: 20 MHz
  • Housing type: PDIP-18
  • Program memory type: Flash
  • Packing: Tube
  • Data bus: 8 bits
  • Width: 6.35 mm
  • Core: PIC16
  • RoHS: yes

Spelling options:

PIC16F628AI/P, PIC16F628A I/P

Microprocessor PIC, Core 8bit, 3.5K-Flash 224B-SRAM 128B-EPROM, 20MHz, 3.0V…5.5V, -40°C…85°C PIC (Peripheral Interface Controller) microcontrollers are programmable PROMs, have low power consumption,... .



What else to read