¡Descarga Microcontroller vs Microprocessor: Architecture, Components, and Differences y más Guías, Proyectos, Investigaciones en PDF de Sistemas de Control solo en Docsity!
May 23
,2022 H.Matamoros,Tamaulipas.
P1HWK1_ORD_BautistaMartinezJuanFrancisco_INTMICROS
Introduction to Microcontrollers
Bautista Martínez Juan Francisco
García Córdova Jesús Aurelio.
Mechatronic Automation Area.
5 A5M
MICROCONTROLLER
VS
MICROPROCESSOR
Von Neumann Architecture
Advantages the Von Neumann Architecture has
- One of the advantages is the efficient use of memory since the data and instructions share the same space in memory and should not be divided.
- The main advantage of having the same memory for programs and data is that programs can be processed as if they were data. In other words, you can write programs whose data is other programs. In fact, if programs and data were not allowed in the same memory space, as is the case with the Von Neumann architecture, operating systems could never have been developed, they use the same address buses to transport information, it has less hardware already Since its architecture is very simple, it occupies a single type of instruction to access memory, just as it only has a single data and address bus, it is very flexible since it contains self-modifying code and occupies a CPU with fewer operations. It is done by programmers this allows you to have all access to memory.
- An important data of the microcontroller is the access to the RAM and in the Von Neumann architecture this can be used both to store data and to store program instructions.
- Allows self-modifying code.
- Easy-to-design electronic architecture.
- Instructions and data retrieved sequentially.
The Von Neumann Architecture
Which device uses Von Neumann Architecture:
Microprocessor or Microcontroller
The Von Neumann architecture is the common architecture of all PC processors and microprocessor. Each and every one of the CPUs, from ARM to x 86 , from 8086 to Ryzen through Pentiums. They are all Von Neumann architectures and they all inherit a certain common problem. The Von Neumann architecture is on which all PC processors are based, since they are all organized with a series of common components, which are the following:
- Control Unit: In charge of the acquisition and decoding stages of the instruction cycle.
- Logical-arithmetic unit or ALU: In charge of carrying out the mathematical and logic operations required by the programs.
- Memory: The memory in which the program is stored, which we know as RAM memory.
- Input device: From which we communicate with the computer.
- Output Device: From which the computer communicates with us.
Harvard Architecture
Advantages the Harvard Architecture has
- There is less probability of collapse in the transmission because the data and instructions travel on different buses but they can be accessed in the same way, a good thing is that it allows the storage of data and instructions in a low-cost ROM and the data in good RAM.
- You have more bandwidth because of the memory separated from the instructions and the data.
- Another advantage of Harvard can read an instruction and also perform data memory access simultaneously.
- The access time to the instructions can overlap with that of the data, achieving a greater speed in each operation.
- It offers greater performance, since it allows the simultaneous obtaining of data and instructions by being saved in separate memories and traveling through different buses.
- A Harvard architecture will generally help a higher-level computer run faster than a Von Neumann architecture, as long as there is no need to share resources between code and data memories.
The Harvard Architecture
Which device uses Harvard Architecture:
Microprocessor or Microcontroller
Microcontrollers and DSP (digital signal processor or digital signal processor) are two types of computers that use Harvard architecture. The internal structure basically corresponds to a
Harvard-type architecture, many times improved to speed up the execution of instructions and the performance of arithmetic operations.
A microcontroller incorporates in a single integrated circuit all the units necessary for it to function. It is a complete computer but with limited features.
DSP enhancements The improvements that a DSP can include are several: buses are included to transfer instructions and data of a size greater than necessary, more than one address and
data bus to access the data, implementation of parallelism techniques to allow the segmentation of the execution of the instructions and do several elementary operations per cycle,
complex logic and arithmetic operations, etc.
Microcontroller
Memory Types
Memory Types MROM Memory:
Is a computer term that stands for Read Only Memory. It is a storage medium used by computers and other electronic equipment.
- Contains a permanent pattern of data that cannot be altered.
- Non-volatile.
- Applications → Subroutines for frequently used functions, system programs, etc. They are combinational circuits, not sequential. OTP Memory:
OTP (One-Time-Programmable) memory is a non-volatile memory that can only be written to once. Products with OTP memory have a limited number of recording
processes depending on the size of the memory.
EEPROM Memory:
EEPROM (Electrically Erasable Programmable Read Only Memory) is ‘non-volatile’. EEPROM memory offers slow response times both in reading and writing operations. It’s
used to permanently store data like device parameters, sensors data, etc.
It is a type of non-volatile ROM memory chip invented by engineer Dov Flohman. It is made up of FAMOS cells (Floating Gate Avalanche-Injection Metal-Oxide
Semiconductor) or «floating gate transistors», each of which comes from the factory without load, so they are read as 1 (hence, an EPROM without record is read as FF in all its
cells).
Flash memory:
Flash memory is ‘non-volatile’, which means that when the power is shut off, the contents of the memory are NOT lost. Flash memory is used to store
the program. Flash memory can be write a lot of times (see Endurance parameter in datasheet), so it is possibile to update the microcontroller program without
hardware replacements. However, do not use flash memory to store program variables because lifetime of memory will decrease very very rapidly.
PWM Module
What is the PWM Module?
Pulse width modulation (PWM) is a type of voltage signal used to send information or to modify the amount of power being sent to a load. This action takes into account the
modification of the work process of a periodic type signal.
It can have various purposes, such as controlling the power supplied to a load or carrying out data transmission. If the duty cycle is 25%, it spends 25% of its period up and
75% down.
The period is the duration of the wave without repeating itself. That is why it is repeated over time because the period is repeated throughout the time. The period is the
sum of the high and low part once, when it rises again it is another period and the wave starts again. Notice that the width of the wave, its height, is always the same. From
0 to 5 Volts.
The only thing that varies is the time it is ON/OFF. These types of signals are of the square or sinusoidal type in which the relative width is changed with respect to the
period of the same, the result of this change is called the duty cycle and its units are represented in terms of percentage. Mathematically you have to:
D = duty cycle
Pi= time the signal is positive
T = Period
To emulate an analog signal, the duty cycle is changed in such a way that the average value of the signal is the approximate voltage that you want to obtain, thus being
able to send voltages between 0[V] and the maximum that it supports. the PWM device used.
ADC Module
What is the ACD Module?
An ADC (analog to digital converter) is a device that allows us to convert an analog signal (either voltage or current) to a (usually) binary value, where each of these
values corresponds to a single voltage or current value.. In the conversion of the signal, information is always lost that is no longer possible to recover in the reverse process,
that is, it is not recovered only by re-converting the signal.
To minimize these losses, you can look for a device that has a higher bit resolution in the converter. An ADC converts it measures the voltage V on a pin (which will have to be
declared as an input with the corresponding TRISA register) and converts it to a number.
Voltage is measured in reference to a minimum voltage, Vref(-) , and a maximum voltage, Vref (+):
V_norm = ( V – Vref(-) ) / (Vref(+) – Vref(-) )
The above formula corresponds to a normalized voltage. If the voltage V reaches the maximum (Vref+) we will have an output of 1 and if it remains at the minimum (Vref-) an
output of 0. Normally Vref- is usually Vss=GND=0V and Vref+ = Vcc = 5V, but other reference voltages can be used. If, for example, we want to measure a signal that we know
to be between 2 and 3 volts, we would use Vref-=2 and Vref+=3. This way we would take better advantage of the dynamic range of the converter.
Since the microcontroller will not handle floating point numbers, the normalized voltage is expressed as an integer, converting the real range [0,1] to the range of integer
levels between [0 and Nmax-1]. The resolution of the ADC is a fundamental characteristic and it tells us the number of levels with which we cover the interval [0,1]. For
example, in PICs we usually have a resolution of 10 bits, which represents 2^10=1024 levels. The actual interval [0.1) would apply to the interval [0.1023]. If we assume a range
of 5V, we will have that the resolution of each level is r=5/1024 V=4.88 mV. According to Microchip's documentation (this may vary for other microcontrollers) any voltage
between [0 and r] (or below 0, which corresponds to V<Vref-) would be quantized to level 0. Between r and 2r we would have an output of level 1. Thus, until reaching level
1023, which would quantify voltages above 1023r = 1023x 5/1024 = 4.995V. As can be seen, voltages below Vref- or above Vref+ are possible and are quantified as a
minimum level of 0 or a maximum level of 1023. Levels below 0V or above the supply voltage (normally 5V) can damage the PIC.
CCP Module
What is the CCP Module?
The CCP (Capture/Compare/PWM) module is a peripheral that allows you to measure and control different events. Capture mode provides access to the current state of a
register that is constantly changing its value. In this case, it is the Timer1 timer register. Compare mode constantly compares values from two registers. One of them is the
Timer1 timer register. This circuit also allows the user to trigger an external event after a predetermined amount of time has expired. PWM (Pulse Width Modulation) can
generate signals of varying frequency and duty cycle for one or more output pins. The PIC16F887 microcontroller has two CCP modules - CCP1 and CCP2. Both are identical
in normal operating mode, while the enhanced PWM features are available only in CCP1 mode. This is the reason why this chapter describes in detail the operation of the
CCP1 module. With respect to PCC2, only the characteristics that distinguish it from PCC1 will be presented.
In this mode, the Timer1 timer register (consisting of TMR1H and TMR1L) is copied to the CCP1 register (consisting of CCPR1H and CCPR1L) in the following situations:
- Each rising edge (1 - > 0) on the RC2/CCP pin;
- Each falling edge (0 - > 1) on the RC2/CCP1 pin;
- Every fourth rising edge (0 - > 1) on the RC2/CCP1 pin;
- Every sixteenth falling edge (0 - > 1) on the RC2/CCP1 pin.
A combination of four bits (CCP1M3 - CCP1M0) from the control register determines which of these events will cause 16-bit data transmission. In addition, the following
requirements must be met:
- The RC2/CCP1 pin must be configured as an input;
- Timer1 must function as a synchronous timer or counter.
Microcontroller Pin outs
PIC 16F628A Microcontroller Pin out & Main Specification
PIC 16F877A Microcontroller Pin out & Main Specification
Microcontroller
Packaging Types
Microcontroller Packaging Types DIP (Double In-line Package) The leads are led out from both sides of the body, the materials include plastic and ceramic. DIP applications include standard logic ICs, memory LSIs, and microcomputer circuits. The pin pitch of DIP is typically 15.2mm. Some packages with widths of 7.52mm and 10.16mm are called skinny DIP and slim DIP (narrow-body DIP). However, in most cases, it is not differentiated and is simply referred to as DIP. SOP/SOIC/SO (Small Outline Package) The pins are drawn in an L shape from both sides of the body, the materials include plastic and ceramic. In addition to being used for memory LSI, SOP is also widely used in circuits such as ASSP that is not too large. The pin pitch is 1.27mm and the number of pins is from 8 to 44. SOP derives some more IC packaging types, as follows: SOJ (Small Out-Line J-Leaded Package): J-lead small outline package TSOP (Thin Small Outline Package): This IC packaging is thinner than SOP with a pin pitch of 1.27mm SSOP (Shrink Small Outline Package): Pin pitch is 0.635mm TSSOP (Thin Shrink Small Outline Package): This IC package type is thinner than SOP with a pitch of 0.65mm QSOP (Quarter-size Small Outline Package): Pin pitch is 0.635 mm VSOP (Very Small Outline Package): It is smaller than QSOP and has a pitch of 0.4, 0.5 or 0.65 mm