CATEGORII DOCUMENTE |
PIC16F887 is one of the latest products of Microchip . PIC16F887 este una dintre cele mai noi produse de Microchip. It features all the components which upgraded microcontrollers normally have. Contine toate componentele care au actualizat in mod normal, microcontrolere. For its low price, wide range of application, high quality and easy availability, it is an ideal solution in applications such as: control of different processes in industry, machine control device, measurement of different values etc. Some of its main features are listed below. Pentru sale de pret scazut, gama larga de aplicare, de inalta calitate si usor de disponibilitate, aceasta este o solutie ideala in aplicatii cum ar fi: de control a diferitelor procese in industrie, masina de dispozitiv de control, de masurare a diferitelor valori etc Unele dintre principalele sale caracteristici sunt enumerate dedesubt.
Pin Description PIN Descriere
As seen in picture above, the most pins are multi-functional. Dupa cum se vede in imaginea de mai sus, cea mai sunt multi-pin-functional. For example, designator RA3/AN3/Vref+/C1IN+ for the fifth pin specifies the following functions: De exemplu, calculatoare RA3/AN3/Vref + / C1IN + pentru cea de-a cincea de aderenta specifica urmatoarele functii:
This small trick is often used because it makes the microcontroller package more compact without affecting its functionality. Acest mic truc este folosit adesea pentru ca face mai multe microprocesoare pachet compact, fara a afecta functionalitatea. These various pin functions cannot be used simultaneously, but can be changed at any point during operation. Aceste diverse functii de aderenta nu pot fi utilizate simultan, dar poate fi modificat in orice moment in timpul operatiunii.
In the following tables, all pins' numbers refer to the PDIP 40 microcontroller. In urmatoarele tabele, toate pin 'se refera la numerele de PDIP 40 microcontroler.
Unitatea Centrala Procesor (CPU)
Any attempt to explain in detail the operation of CPU would take us too far. Orice incercare de a explica in detaliu modul de functionare a procesorului ne-ar lua prea departe. Who is anyway interested in that?! Cine este interesat de faptul ca oricum?! It is important to say that CPU is made in RISC technology because this fact can affect you to buy exactly this microcontroller. Este important sa spun ca este facuta in Procesor RISC, tehnologie, deoarece acest fapt poate afecta sa cumpere exact acest microcontroler.
RISC stands for Reduced Instruction Set Computer , which gives the PIC16F887 two great advantages: RISC inseamna redus de instructiuni set de Calculator, care ofera PIC16F887 doua mari avantaje:
Memory
Memorie
This microcontroller has three types of memory- ROM, RAM and EEPROM. Acest microcontroler are trei tipuri de memorie-ROM-ul, memoria RAM si EEPROM. All of them will be separately discussed since each has specific function, features and organization. Toate acestea vor fi discutate separat, deoarece fiecare are anumite functii, caracteristici si organizare.
ROM Memory Memorie ROM
ROM memory is used to permanently save program being executed. ROM de memorie este folosit pentru a economisi permanent, programul fiind executat. That is why it is often called "program memory". De aceea este deseori numit 'Programul de memorie'. The PIC16F887 has 8Kb ROM (in total of 8192 locations). PIC16F887 de a 8KB ROM (in total 8192 de locatii). Since, in this very case, ROM is made in FLASH technology, its contents can be changed by providing special programming voltage (13V). Deoarece, in acest caz, ROM este facuta in tehnologia FLASH, continutul sau poate fi schimbat prin furnizarea de programare speciale de tensiune (13V).
Anyway, there is no need to explain it in detail because it is automatically performed by means of a special program on PC and a simple electronic device called programmer (not original at all). Oricum, nu este nevoie sa se explice, in detaliu, deoarece acesta este efectuat in mod automat, prin intermediul unui program special de pe PC-ul si un simplu dispozitiv electronic numit programator (nu la toate originale).
EEPROM Memory
Memorie EEPROM
Similar to program memory, the contents of EEPROM is permanently saved, even upon the power goes off. Similare cu programul de memorie, continutul de EEPROM este permanent salvat, chiar si la puterea de merge afara. However, unlike ROM, the contents of EEPROM can be changed during operation of the microcontroller. Cu toate acestea, spre deosebire de ROM, continutul de EEPROM poate fi schimbata in timpul operatiunii de microcontroller. That is why this memory (256 locations) is a perfect one for permanently saving results created and used during the operation. De aceea, acest memorie (256 locuri) este perfect pentru un permanent rezultatele de economisire a creat si utilizat in timpul operatiei.
RAM Memory Memorie RAM
This is the third and the most complex part of microcontroller memory. Aceasta este cea de-a treia si cea mai complexa parte din memoria microcontroler. In this very case, it consists of two parts: general-purpose registers and special-function registers (SFR). In acest caz, este alcatuita din doua parti: cu scop general si registre speciale cu functie registre (SFR).
Even though both groups of registers are cleared when power goes off and even though they are manufactured in the same way and act in the similar way, their functions do not have many things in common. Chiar daca ambele grupuri de registre sunt eliminate atunci cand pleaca afara de putere si, chiar daca acestea sunt fabricate in acelasi mod si sa actioneze in mod similar, functiilor lor, nu au multe lucruri in comun.
General-purpose registers Registrele cu scop general
General-purpose registers are used for storing temporary data and results created during operation. Registrele cu scop general sunt folosite pentru stocarea temporara a datelor si rezultatelor create in timpul operatiunii. For example, if the program performs a counting (for example, counting products on the assembly line), it is necessary to have a register which stands for what we in everyday life call "sum". De exemplu, in cazul in care programul efectueaza o numaratoare (de exemplu, contabilizare produse de pe linia de montaj), este necesar de a avea un registru care este de la ceea ce noi numim in viata de zi cu zi 'sint'. Since the microcontroller is not creative at all, it is necessary to specify the address of some general purpose register and assign it a new function. Avand in vedere ca nu este microcontroler de creatie de la toate, este necesar sa se specifice adresa de unele registru in scop general si atribuiti-i acestuia o noua functie. A simple program to increment the value of this register by 1, after each product passes through a sensor, should be created. Un program simplu de a increment valoarea acestui registru, pana la 1, dupa fiecare produs trece printr-un senzor, ar trebui sa fie creat.
Therefore, the microcontroller can execute that program because it now knows what and where the sum which must be incremented is. Prin urmare, microcontroler se poate executa acel program, pentru ca acum stie ce si unde suma pe care trebuie sa fie incremented este. Similar to this simple example, each program variable must be preassigned some of general-purpose register. Similare in acest exemplu simplu, fiecare program trebuie sa fie variabila preassigned unele din registru cu scop general.
SFR registers Registrele SFR
Special-function registers are also RAM memory locations, but unlike general-purpose registers, their purpose is predetermined during manufacturing process and cannot be changed. Registre speciale cu functie de memorie RAM sunt de asemenea locatii, dar spre deosebire de registre cu scop general, scopul lor este predeterminat, pe parcursul procesului de fabricatie si nu poate fi schimbat. Since their bits are physically connected to particular circuits on the chip (A/D converter, serial communication module, etc.), any change of their contents directly affects the operation of the microcontroller or some of its circuits. Deoarece bitii lor sunt fizic conectate la circuite special pe chip (Convertor A / D, de serie modul de comunicare, etc), orice modificare a continutului lor afecteaza in mod direct functionarea microcontroller sau de la unele circuite. For example, by changing TRISA register, the function of each port A pin can be changed in a way it acts as input or output. De exemplu, de a schimba registrul TRISA, in functie de un PIN fiecare port poate fi schimbata intr-un mod pe care il actioneaza in calitate de intrare sau de iesire. Another feature of these memory locations is that they have their names (registers and their bits), which considerably facilitates program writing. O alta caracteristica a acestor locatii de memorie este ca au numele lor (si registrele lor de biti), care faciliteaza considerabil programul de scris. Since high-level programming language can use the list of all registers with their exact addresses, it is enough to specify the register's name in order to read or change its contents. Deoarece la nivel inalt, limbajul de programare poate utiliza lista de registre cu toate adresele lor exacte, este suficient sa se precizeze numele in registru, pentru a citi sau a schimba continutul.
RAM Memory Banks Memorie RAM Banci
The data memory is partitioned into four banks. Datele de memorie este partitioned in patru banci. Prior to access some register during program writing (in order to read or change its contents), it is necessary to select bank which contains that register. Inainte de a accesa unele registru in programul de scris (pentru a citi sau a modifica continutul sau), este necesar sa selectati bancar care contine acest registru. Two bits of the STATUS register are used for bank selecting, which will be discussed later. Doi biti din registrul de stare sunt utilizate pentru selectarea bancii, care va fi discutat mai tarziu. In order to facilitate operation, the most commonly used SFRs have the same address in all banks which enables them to be easily accessed. In scopul de a facilita operarea, cele mai frecvent utilizate SFRs au aceeasi adresa in toate bancile care sa le permita sa fie usor de accesat.
STACK STIVA
A part of RAM used for stack consists of eight
13-bit registers. O parte din RAM utilizat pentru stiva este format din opt 13-bit registre. Before the microcontroller starts to execute a
subroutine ( instruction) or
when an interrupt occurs, the address of first next instruction being currently
executed is pushed onto the stack, ie onto one of its registers. Inainte
de a incepe microcontroler pentru a executa un
subroutine (instructiunea
CALL)
sau cand apare o intrerupere, adresa de langa primul curs de instruire in
prezent este executat impinse spre stiva, si anume, pe unul din registrele
sale. In that way, upon subroutine or interrupt
execution, the microcontroller knows from where to continue regular program
execution. In acest fel, la subroutine intrerupere sau de executie,
microcontroller stie de unde regulate, pentru a continua programul de executie.
This address is cleared upon return to the main
program because there is no need to save it any longer, and one location of the
stack is automatically available for further use. Aceasta
adresa este golit la intoarcerea in principal de
program, deoarece nu este nevoie sa salvati-l mai orice, si o
locatie din stiva este automat disponibil pentru utilizarea
ulterioara.
It is important to know that data is always circularly pushed onto the stack. Este important de stiut ca de date este intotdeauna circularly impinse spre stiva. It means that after the stack has been pushed eight times, the ninth push overwrites the value that was stored with first push. Aceasta inseamna ca, dupa ce stiva a fost impins de opt ori, a noua impinge Suprascrie valoare care au fost stocate cu primul impuls. The tenth push overwrites the second push and so on. A zecea impinge impinge suprascrie cel de-al doilea si asa mai departe. Data overwritten in this way is not recoverable. Date suprascrise in acest mod nu este recuperabil. In addition, the programmer cannot access these registers for write or read and there is no Status bit to indicate stack overflow or stack underflow conditions. In plus, programator nu poate accesa aceste registre pentru a scrie sau a citi si nu exista nici o Stare de biti pentru a indica stack overflow sau stiva underflow conditii. For that reason, one should take a special care of it during program writing. Din acest motiv, ar trebui sa o ia o ingrijire speciala a acestuia in timpul programului scris.
Interrupt System Intreruperea Sistem
The first thing that the microcontroller does upon an interrupt request arrives is to execute the current instruction and then stop regular program execution. Primul lucru pe care nu microcontroler la o cerere de ajunge este de a executa instructiunea curenta si apoi opri program regulat de executie. Immediately after that, the current program memory address is automatically pushed onto the stack and default address (predefined by the manufacturer) is written to the program counter. Imediat dupa aceea, actualul program de adresa de memorie este automat impinse spre stiva si implicit adresa (predefinite de catre producator) este scris in program contra. That location from where the program continues execution is called interrupt vector. De la acea locatie in cazul in care continua programul de executie este denumit vectorul intrerupere. Concerning the PIC16F887 microcontroller, that address is 0004h. In ceea ce priveste microcontroler PIC16F887, care este adresa 0004h. As seen in figure below, the location containing interrupt vector is passed over during regular program execution. Dupa cum se vede in figura de mai jos, ce contine locatia interrupt vector este trecut peste program regulat in timpul de executie.
Part of the program being activated upon interrupt request arrives is called interrupt routine. Parte a programului fiind activat la cerere de intrerupere ajunge este numit de rutina. Its first instruction is located at the interrupt vector. Primul instruire este situata la vectorul intrerupere. How long this subroutine will be and what it will be like depends on the skills of the programmer as well as the interrupt source itself. Cat timp aceasta subroutine va fi si ce va fi ca depinde de abilitatile de programator, precum si a intrerupe sursa virusului. Some microcontrollers have more interrupt vectors (every interrupt request has its vector), but in this case there is only one. Unii au mai multe microcontrolere intrerup vectori (la fiecare cerere de-a vectorului sau), dar in acest caz nu exista decat o singura. Consequently, the first part of interrupt routine consists in interrupt source recognition. In consecinta, prima parte a intrerupe rutina de intrerupere consta in sursa de recunoastere.
At
last, upon interrupt source is recognized and interrupt routine is executed,
the microcontroller reaches the
instruction, pops the address from the stack and continues program execution
from where it left off. La ultima, la sursa de intrerupere este recunoscut si rutina
de intrerupere este executat, microcontroler ajunge la instructiunea
RETFIE,
pops adresa de la stiva de executie
si continua programul de unde a ramas.
How to use SFRs Cum sa utilizati SFRs
You have bought the microcontroller and have a great idea how to use itThere is a long list of SFRs with all bits. Ati cumparat microcontroller si au o mare idee cum sa il foloseasca Exista o lunga lista cu toate SFRs de biti. Each of them controls some process. Fiecare dintre ele unele controale de proces. All in all, it looks like a big control table with a lot of instruments and switches. All in all, se pare ca este un mare control de masa cu o multime de instrumente si switch-uri. Now you are concerned about whether you will manage to learn how to use them all? Acum, va ingrijoreaza daca va gestiona pentru a afla cum sa utilizati-le pe toate? You will probably not, but don't worry, you don't have to! Probabil ca va nu, dar nu va faceti griji, nu trebuie sa! Who anyway needs that? Cine are nevoie ca oricum? Such powerful microcontrollers are similar to the supermarkets: they offer so many things at low prices and it is only up to you to choose. Astfel de puternic, microcontrolere sunt similare la supermarket: pe care le ofera atat de multe lucruri la preturi mici si este numai pana la care sa puteti alege. Therefore, select the field you are interested in and study only what you need to know. Prin urmare, selectati domeniul in care sunteti interesat de studiu si numai ceea ce trebuie sa stiti. Afterwards, when you completely understand hardware operation, study SFRs which are in control of it ( there are usually a few of them). Ulterior, cand veti intelege complet exploatarea hardware-ul, studiul de SFRs care se afla in control al ei (exista de obicei cateva dintre ele). At last, during program writing, prior to change some bit of these registers, do not forget to select the appropriate bank. La ultima, in timpul programului scris, inainte de a modifica unele din aceste registre de biti, nu uitati sa selectati bancar este cazul. That is why they are listed in the tables above. De aceea ele sunt enumerate in tabelele de mai sus.
Politica de confidentialitate | Termeni si conditii de utilizare |
Vizualizari: 4791
Importanta:
Termeni si conditii de utilizare | Contact
© SCRIGROUP 2024 . All rights reserved