Microcontroller Course Overview and Concepts
Microcontroller Course Overview and Concepts
Course: Microcontroller
Project to be submitted
Industrial computing
is a branch of
applied computing that
covers the entire
design techniques and
programming of systems
computerized for a purpose
industrial, which are not
of computers. » (Source :
Wikipedia
Industrial computing
Applications:
●
Automation, robotics
● Measurementsofphysicalquantities,
●
Real-time systems,
●
Embedded systems.
Ascom S.A.
The different programmable systems
●
Specialized circuits or ASIC (Application Specific Integrated Circuit):
ASIC circuits are specialized circuits designed from the outset for a specific application.
data.
Texas Instruments
Advantages: Inconvénients :
●
Veryfast ●
Lowmodularity
●
Lowerconsumption ●
Limited possibility of evolution
●
Optimized for an application ●
Cost
The different programmable systems
• Systems in programmed logic and/or programmable logic are known as the
designation of PLD (programmable logic device, programmable logic circuit)
●
FPGA (field-programmable gate array, in-situ programmable gate network)
●
PAL (programmable array logic, programmable logic network)
●
...
Advantages: Disadvantages:
●
Strongmodularity ●
More complex implementation
●
Speed ●
High development costs
Processors
●
CISC: Complex Instruction Set Computer
●
RISC: Reduced Instruction Set Computer
Source: Intel
22nm
• internal architecture 64
bits 4/12 cores
• clock frequency 4.0
GHz
• Bus frequency: 0.2 GHz
Intel Pentium 4 Northwood C (2002)
42 million transistors, etched at 0.13 µm
32-bit internal architecture
clock frequency 2.4/3.4 GHz
Bus frequency: 0.2 GHz
Wired logic:
• ["TRUE","FALSE"]
• NO, YES
• AND
• NON-ET (NAND)
• OR
STI2D Sin
Wired logic:
Two families:
• microprocessor
• microcontroller.
Cabled Vs Programmed
LOW LANGUAGE
COMPILATION LEVEL
ASSEMBLER
PROGRAMME.c
CODING IN
MACHINE LANGUAGE
PROGRAMMING LIBRARY
DOWNLOAD
LIBRARY.h
Microcontroller
Controller
a controller is a device that - placed at the heart of a process -
monitor the evolution of an event and compare its state (or value) to
a predetermined data, to intervene as soon as the set limits
are affected.
19
Microcontroller
Integrated circuit
Microcontroller architecture
Placing in situation
Microcontroller Architecture
Internal structure
A microcontroller comes in the form of an integrated circuit that brings together all the elements.
of a microprocessor-based structure.
Hereisgenerallywhatyoufindinsidesuchacomponent:
A microprocessor (C.P.U.)
From data memory (RAM and EEPROM),
From program memory (ROM),
Parallel interfaces for connecting inputs/outputs,
Serial interfaces (synchronous or asynchronous) for communication with others
units
Timers to generate or measure signals with high precision
temporal
Analog to digital converters for signal processing
analog
Internal structure
• Von Neumann architecture
The previous functional diagram represents a "Von Neumann" architecture (Common
to most microprocessors) where the program memory shares the same bus as the
data memory.
The architecture of 'Harvard', which has separate buses for data and for
program is used less often.
• C.P.U. (MICROPROCESSOR).
. An arithmetic and logic unit (ALU) that allows for performing operations
between the accumulator and an operand,
. A register code condition indicating certain specifics regarding
concerning the result of the last operation (hold, zero, interruption...).
It can be noted that there are 2 categories of microprocessors: CISC and RISC.
This device allows for the temporary storage of data generated by the
microprocessor during the various phases of digital processing (results
operations, sensor states...). These memories are accessible for writing and reading.
The pins of these ports can therefore be configured as input or output, with
different options (pull-up resistors, open collector outputs, interruption...).
The configuration as well as the logical state of these pins is obtained through operations.
of writing or reading in different registers associated with each port.
We generally find:
In this device, the transmission is synchronized by a clock signal emitted by the unit.
master.
. Serial interface
asynchronous series liaison
This device does not have a synchronization clock signal. The units are linked.
each have an internal clock running at the same frequency.
When a unit wants to emit a binary word, it generates a falling edge on its line.
emitter. At the end of the broadcast of this word, the line returns to the high level.
The data to be transmitted may contain an additional bit called 'parity' which is used for the
correction of errors.
. Serial interface
Parameters involved for the RS232 standard:
Parity: the transmitted bit may or may not be followed by a parity bit that is used to
detect any potential transmission errors.
Bit start: the idle line is in logical state 1 to indicate that a word will be
bring the line low before starting the transfer.
. The Timer
Its role is to enable the synchronization of the operations that the microcontroller is
in charge of carrying out.
Several registers associated with the Timer allow for the configuration of the different described modes.
previously.
. THE GUARD DOG.
This device is an anti-crash system for the microcontroller. It ensures that there is no
prolonged execution of the same sequence of instructions.
. Clock signals
To obtain it, a quartz is placed between the two pins 'OscIn' and 'OscOut' as
The following diagram indicates:
MODE OF OPERATION.
. Interrupt-driven operation
The instructions contained in the program memory are a sequence of binary words.
decoded and then executed by the microprocessor, called machine language. These codes are
difficult to understand by the programmer. This is the reason why they are
translate into different words that are part of assembly language.
Addressing modes are the different ways that allow the microprocessor
to access an operand in order to test or modify the content of a register or a
memory.
Description and programming of the task to be accomplished.
The specifications define all the commands or actions that must be carried out.
the microcontroller. Before generating the binary machine code understandable by the
microcontroller, intermediate steps are necessary to reduce risks
of errors and difficulties.
An advanced language (C, Pascal, and Basic) using procedures suited to the type of
microprocessor and is translated into machine code by a compilation operation
performed by a "Cross-compiler".
The familyPSOCofCyprus.
Study of the Microchip PIC family
Identification of a Peak
Study of PIC 16F877:
The internal architecture of the PIC16f877 is mainly composed of registers that have
each with a well-defined function. The PIC also has built-in peripherals, such
an EEPROM memory, three timers, input/output ports or converter
analog/digital
Study of PIC 16F877:
Ces chiffres décimaux peuvent être complétés par les lettres A à F pour la numération
hexadecimal:
Library for LCD
The HD44780 is one of the most appreciated liquid crystal controllers, being used
in the industry and in commercial applications.
Modules with 8, 16, 20, 24, 32, and 40 characters are available. Depending on the model,
The LCD screen is made with 14 or 16 pins for the interface.
Description
Description
The VSS pin is at 0V or ground. The VDD pin must be connected to the positive terminal.
power supply. Although manufacturers specify a 5V DC power supply,
The 3 VEE leg is designated for adjusting the display contrast and must be connected to a
DC power supply. A potentiometer is usually connected to
the power supply with its slider connected to the VEE pin and the other pin of the potentiometer connected
to the masses.
Leg 4: is the selection register (RS). When RS is at +5V, the data from
Characters can be transferred from the LCD module.
The leg 6 is validation (EN), which is used to initiate the transfer of orders or
of data between the module and the microcontroller.
Pins 7 to 14 are the eight data bus lines (D0 to D7). The data can
to be transferred between the microcontroller and the LCD module using either a single 8-bit byte
bits can be of two 4-bits. In this last case, only the four upper data lines
(D4 to D7) are used..
The name of the port must be specified by passing its address. For example, if RS leg is
connected to RB0, EN pin to RB1, D7 pin to RB2, D6 pin to RB3, D5 pin to RB4, and D4
pat to RB5, so the function must be called as follows:
. Lcd_Init
The Lcd_Init function is called to set up the interface between the microcontroller and
the LCD screen when the connections are made by default that has just been illustrated. The name of
the port must be specified by passing its address. For example, assuming that the LCD is connected to
PORTB and the previous default connections are used, the function must be called
as a:
Lcd_Init();
. Lcd_Out
The Lcd_Out function displays text at the indicated line and column positions.
the LCD screen. The function must be called with parameters in the following order:
Description
texte
For example, to display the text 'Computer' at line 1 and column 2 of the screen
LCD we should call the function as follows:
Computer
. Lcd_Chr
The function Lcd_Chr displays a character at the indicated line and the column position of the
cursor. The function must be called with the parameters in the following order:
Description
For example, to display the character 'K' at line 2 and column 4 of the LCD screen, we
should call the function of:
Lcd_Chr(2, 4, 'K');
. Lcd_Cmd
The Lcd_Cmd function is used to send a command to the LCD screen. With this
command, we can move the cursor to any line, disable the screen
LCD, make the cursor blink, shift the display, etc. A list of the most commonly used.
LCD orders are given in the table below.
For example, to clear the LCD screen we should call the function as follows:
Lcd_Cmd (Lcd_Clear);
Application exercise