My Experiences With Microcontrollers - part 1
Introduction
The Microchip Microcontrollers are one of the most popular integrated circuits thanks to low price, small size and convenience to develop all kinds of digital and electronic projects. This electronic device has the next parts: CPU, data memory, program memory, input and output ports, clock, reset, etc.
Microchip manufactures 8, 16 and 32 bit microcontrollers. To begin, we are going to see how the hardware of an 8-bit microcontroller is organized, ie the PIC16F84A. In later chapters we will compare these characteristics with PIC12F675, PIC16F88, PIC16F887, PIC18F2550 and dsPIC30F4013.
I have programmed this type of microcontroller with compilers provided by MPASM, such as: assembler and C ++ (XC8, XC16, C18 and C30). Another very popular compiler is the CCS PICC.
RISC Processor
The CPU of Microchip microcontrollers uses RISC (Reduced Instruction Set Computer) technology. The RISC processors have a Pipeline structure and execute almost all the instructions at the same time. The PIC16F84A is a microcontroller with 35 instructions. The Harvard architecture allows instructions to be executed in one machine cycle or four clock cycles. It has an 8-bit ALU, a PC5 Program Counter and a W work register.
PORTS
The PIC16F84A has two parallel ports A and B, and the lines of these ports can be programmed as inputs and outputs. Port A has 5 lines RA4: RA0, and port B has 8 lines RA7: RA0. The working direction is controlled by the TRISA and TRISB registerS, in which a bit "0" configures the line as output, and a bit "1" as input.
The RA4 port is equipped with a Schmitt Trigger that provides a good help to eliminate noise.
Port B has lines that can be used for internal interruptions, which will be seen later and in more detail. All lines of port B have a pull-up resistance of high value and connected to the power supply, which is enabled with the following instruction in assembly language:
bcf OPTION_REG, NOT_RBPU
FEEDING
The PIC16F84A is powered by 5 volts
OSCILLATOR
The PIC16F84A has five types of oscillators between pins OSC1 / CLKIN and OSC2 / CLKOUT:
1) Quartz crystal: XT
2) Oscillator with resistance and capacitor: RC
3) High speed crystal: HS
4) Crystal for low frequency and low power consumption: LP
5) External clock signal: External
In the PIC16F84A the most used oscillator is the 4 MHz crystal.
RESET
The reset in a microcontroller causes the reset of its operation from scratch (MCLR), this occurs when a logic level of zero is applied.
MEMORY
The PIC16F84A has the following types of memories:
1) Program memory ROM type Flash of 1 k and 14 bits
2) Data memory divided into:
- RAM consisting of 22 records of specific purpose SFR and 68 records of general purpose.
- Data EEPROM formed by 64 registers of 8 bits.
The PIC16F84A has a program memory in which all the instructions of the control and recording program are stored permanently. This microcontroller supports 1000 recordings and is guaranteed for several tens of years.
In the next chapter we will see everything related to the data memory registers and their configuration.