Newcomers to the field of electronics is usually thought that the microcontroller is the same as the microprocessor. That is not true. They differ from each other in many ways. The first difference of the and most important is microcontroller functions. Microprocessor can be used when other components such as memory be added to it. Although it is regarded as a powerful computing machine, it is not adjusted to communicate with the peripheral environment. In an effort to allow the microprocessor to communicate with the peripheral environment, a special circuit must be used. This is how it was in the beginning and is still the same today.
About ten years ago, the design of electronic devices that control the elevator in a multistory building are very difficult, even for a team of experts. Have you ever thought about what ordinary lifts requirements? How to handle the situation when two or more people call the elevator at the same time? Who call first? Loss of electricity? Failure? Abuse? ...
This is usually the point at which the party turned into a real job because of electronic devices almost never come into operation immediately. Get ready for more sleep, corrections, improvements ... and do not forget, we are still talking about the exercise of ordinary elevator.
This is usually the point at which the party turned into a real job because of electronic devices almost never come into operation immediately. Get ready for more sleep, corrections, improvements ... and do not forget, we are still talking about the exercise of ordinary elevator.
PIC microcontrollers designed by Microchip Technology are likely the best choice for beginners. Here is why...The original name of this microcontroller is PICmicro (Peripheral Interface Controller), but it is better known as PIC. Its ancestor, called the PIC1650, was designed in 1975 by General Instruments.
It was meant for totally different purposes. Around ten years later,
this circuit was transformed into a real PIC microcontroller by
adding EEPROM memory. Today, Microchip Technology announces the manufacture of the 5 billionth sample.
All PIC microcontrollers use Harvard architecture, which means that
their program memory is connected to the CPU over more than 8 lines.
Depending on the bus width, there are 12-, 14- and 16-bit
microcontrollers.
The instruction set for the 16F8XX includes 35 instructions in total.
The reason for such a small number of instructions lies in the RISC
architecture. It means that instructions are well optimized from the
aspects of operating speed, simplicity in architecture and code
compactness. The bad thing about RISC architecture is that the
programmer is expected to cope with these instructions. Of course, this
is relevant only if you use assembly language for programming. This book
refers to programming in the higher programming language C, which means
that most work has been done by somebody else. You just have to use
relatively simple instructions.
All instructions are single-cycle instructions. The only exception may
be conditional branch instructions (if condition is met) or instructions
performed upon the program counter. In both cases, two cycles are
required for instruction execution, while the second cycle is executed
as an NOP (No Operation). Single-cycle instructions consist of
four clock cycles. If 4MHz oscillator is used, the nominal time for
instruction execution is 1μS. As for jump instructions, the instruction
execution time is 2μS.
The microcontroller executes the program loaded in its Flash memory.
This is the so called executable code comprised of seemingly meaningless
sequence of zeros and ones. It is organized in 12-, 14- or 16-bit wide
words, depending on the microcontroller’s architecture. Every word is
considered by the CPU as a command being executed during the operation
of the microcontroller. For practical reasons, as it is much easier for
us to deal with hexadecimal number system, the executable code is often
represented as a sequence of hexadecimal numbers called a Hex code. It
used to be written by the programmer. All instructions that the
microcontroller can recognize are together called the Instruction set.
As for PIC microcontrollers the programming words of which are comprised
of 14 bits, the instruction set has 35 different instructions in total.
As the process of writing executable code was endlessly tiring,
the first ‘higher’ programming language called assembly language was
created. The truth is that it made the process of programming more
complicated, but on the other hand the process of writing program
stopped being a nightmare. Instructions in assembly language are
represented in the form of meaningful abbreviations, and the process of
their compiling into executable code is left over to a special program
on a PC called compiler. The main advantage of this programming language
is its simplicity, i.e. each program instruction corresponds to one
memory location in the microcontroller. It enables a complete control of
what is going on within the chip, thus making this language commonly
used today.
However, programmers have always needed a programming language close
to the language being used in everyday life. As a result, the higher
programming languages have been created. One of them is C. The main
advantageof these languages is simplicity of program writing. It is no
longer possible to know exactly how each command executes, but it is no
longer of interest anyway. In case it is, a sequence written in assembly
language can always be inserted in the program, thus enabling it.
No comments:
Post a Comment