Assembly Notes: PIC Microcontroller

Publisher:Lihua1314520Latest update time:2012-10-31 Source: 21ic Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

A PIC microcontroller (Peripheral Interface Controller) is an integrated circuit (IC) that controls peripheral circuits. It is a special microcomputer that integrates CPU, ROM (memory), I/O, etc. on a single chip. It is a CPU with decentralized (multi-tasking) functions.

PIC (please be sure to check the relevant information online.) series of single-chip microcomputers are the flagship products of the single-chip microcomputer series produced by the American Microchip (many words are blocked by the server and cannot be sent, I hope you know.) company. The characteristics of this series of single-chip microcomputers of this company are: First, it is the first to use the embedded structure of the reduced instruction set (RISC, we will learn about its instruction system later). It enables the single-chip microcomputer to break through the traditional natural dependence on the PC in structure. Second, the introduction of the Harvard bus memory structure, two-stage pipeline instruction structure, single-cycle instruction and other technologies effectively improves the operating efficiency of the system.

Classification of PIC 8-bit MCU: The current PIC series MCU ranks higher year by year in the world MCU market share, especially in the 8-bit MCU market. There are three series and multiple models of products available. MCUs are used in various fields, including computer peripherals, home appliance control, telecommunications, intelligent instruments, and automotive electronics. It can be said that the current PIC MCU is the most influential embedded microcontroller in the world.

Basic series: low price. Such as PIC16C5X, PIC12C5XX. (Search "chip query website" on Baidu, you can get a lot of detailed technical information of microchips, including pin arrangement, pin function, etc. There is a very famous chip query website, which is easy to find, and all the information is in English.) Second, intermediate series. This level is the most abundant series of PIC, with various packages from eight pins to sixty-eight pins. For example: PIC12C6XX. The performance of this level of products is very high, with internal A/D converter, E*E (E square) PROM data storage, comparator output, PWM, output, I*I (I square) and SPI interfaces. Third, advanced series. Such as PIC17CXX, the characteristic is fast speed, so it is suitable for high-speed digital computing occasions, and because it has the ability to complete 8X8 (bit) binary multiplication operations within one instruction cycle (160 nanoseconds), it can even replace some DSP products. This series is suitable for high- and mid-range electronic devices. (But this series is very expensive.)

These three series of PIC8-bit microcontrollers also have high code compatibility, and users can convert code from one model to another.

Features of PIC series microcontrollers: 1. Practical and cost-effective. For example, PIC12C508 has 512 bytes of ROM, 25 bytes of RAM, 1 8-bit timer, 1 input line, and 5 I/O lines, and the price is 3 to 6 yuan. This microcontroller is suitable for the application of motorcycle automatic ignition. 2. High efficiency. 3. Excellent development environment. 4. Strong anti-interference ability. PIC microcontroller can be connected to 220V AC power supply through current limiting resistor, and can be directly connected to relay control circuit without photocoupler isolation. 5. Absolute confidentiality. PIC uses confidentiality fuse to protect the code. After writing the code, the fuse is blown. Unless the fuse is restored, it is impossible to read the original code. However, PIC uses deep fuse buried technology, and the possibility of restoration is extremely small.

Development of PIC series single-chip microcomputers. Single-chip microcomputers are special microcomputers that integrate CPU, ROM, and I/O on a single chip. They have no development capabilities by themselves. To develop them into a practical product, certain development tools are needed. The development tools are divided into two categories: hardware development tools and software development tools. The former refers to various programmers, simulation development machines and other programming and development equipment; the latter refers to various editing, assembly, simulation debugging and integrated development environment tool software.

When you get a single-chip microcomputer, it is not usable yet. You need to write a program. How to receive data? How to process? How to apply the output? And so on... This is application programming! It is not like writing a program on a computer. If it is wrong, you can change it at will. Because the number of times the single chip is erased and written is too many, it is not good for the stable operation of the program itself. If it is a single chip that is written once, the consequences of the written program are wrong. Therefore, you must be familiar with some single-chip simulation software. They are different from Word, Ecxel... They have high conceptual, real and practical properties. So don't treat them as software that children can learn. If you have never burned a single chip, you are a novice. If you have never written assembly, even if your computer level is hundreds of levels, in the eyes of people who participated in the "64K Programming Competition" (check the "64K Programming Competition First Prize Program" on the Internet to see what kind of program can be written with 64K memory?), you are just a bug that got out of a pile of books. Technology is the realization of practice and theoretical application. We don't need those programming masters from Tsinghua University and Peking University because we don't have money and can't afford them. However, if you are willing, I also believe that we will have their technology one day. Let's skip the basic introduction for now and have a preliminary understanding of the instruction system.

Since the PIC instruction system is similar to the assembly instruction system, the PIC instruction system is more instructive, so I will not introduce the PIC instruction system first, but talk to you about the assembly language instruction system.

The following is an introduction to the pic instruction system:

First, what is an instruction system? The set of instructions that can be recognized and executed by a CPU is based on the instruction system of this CPU. Microcontrollers produced by different manufacturers, or microcontrollers based on different CPU cores, generally have different instruction systems. Therefore, in the future, we will choose the PIC produced by MicroChip as the BV experiment chip. The basic PIC16C5X series chip has a total of 33 instructions, each instruction is 12 bits long; the mid-range PIC16C6X/7X/8X series chip has 35 instructions, each instruction is 14 bits long: the high-end PIC17CXX series chip has a total of 58 instructions, each instruction is 16 bits long. You can definitely search for the instructions of each series of PIC chips on the Internet, and you can print them out for backup.

1. pic instruction system

Here is a program from the book, calculating the function value; Y = {X + 10 (X, 0), 30X [0, 10], X-190 (10, X)}
Source code:
DATA1 SEGMEMT
X DW ?
Y DW ?
DATA1 ENDS
CODE1 SEGMENT

MOV AX, X
CMP AX, 0
JGE CASE23
ADD AX, 10
JMP RESULT

Reference address:Assembly Notes: PIC Microcontroller

Previous article:About the link script file of PIC's C18 compiler
Next article:Design of TPMS tire pressure monitoring system based on PIC microcontroller and SP12

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号