PIC Disassembly (I) Assembler and PIC

Publisher:科技创新实践者Latest update time:2022-01-06 Source: eefocusKeywords:PIC Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Preface

Due to some requirements, we now need to disassemble a hex file into C, so the first thing we need to understand is the overview of PIC and assembly language.


1、PIC

In fact, practically speaking, PIC is just a description of MCU, just like C and JAVA are programming languages. We understand PIC through its functions, features and usage scenarios, and then understand the internal structure and overall framework according to our needs.

Here I quote a description of pic by a big guy 1


What are the advantages of PIC? Maybe you will have such questions, so I will briefly talk about my own views here.

(1) The biggest feature of PIC is that it does not simply pile up functions, but starts from reality, attaches importance to the performance and price ratio of products, and relies on the development of multiple models to meet the application requirements of different levels. In practice, different applications have different requirements for the functions and resources of microcontrollers. For example, a motorcycle ignition requires a small microcontroller with fewer I/Os, less RAM and program storage space, and higher reliability. If a 40-pin and powerful microcontroller is used, the investment will be large and it will be inconvenient to use. The PIC series has dozens of models from low to high to meet various needs. Among them, the PIC12C508 microcontroller has only 8 pins and is the smallest microcontroller in the world. NGE Automation Online Network

This model has 512 bytes of ROM, 25 bytes of RAM, an 8-bit timer, an input line, and 5 I/O lines. The market price is 3-6 yuan. Such a single-chip microcomputer is undoubtedly very suitable for applications such as motorcycle ignition. The high-end model of PIC, such as PIC16C74 (not the highest-end model yet), has 40 pins, and its internal resources are 4K ROM, 192 bytes of RAM, 8-way A/D, 3 8-bit timers, 2 CCP modules, three serial ports, 1 parallel port, 11 interrupt sources, and 33 I/O pins. Such a model can be comparable to high-end models of other brands. NGE Automation Online Network

2) Streamlining instructions greatly improves execution efficiency. The PIC series 8-bit CMOS microcontroller has a unique RISC structure, a Harvard bus structure with separate data bus and instruction bus, which makes the instructions have a single word length and allows the number of bits of the instruction code to be more than the number of bits of the data. Compared with the traditional 8-bit microcontroller with CISC structure, it can achieve 2:1 code compression and increase the speed by 4 times. NGE Automation Online Network

3) Zero time to market. Using PIC's low-cost OTP chip allows the microcontroller to launch the product immediately after its application program is developed. NGE Automation Online

4) PIC has a superior development environment. The real-time performance of the OTP microcontroller development system is an important indicator. For example, most of the development systems of ordinary 51 microcontrollers use high-end models to simulate low-end models, and their real-time performance is not ideal. PIC launches the corresponding simulation chip at the same time as launching a new model. All development systems are supported by dedicated simulation chips, and the real-time performance is very good. In my personal experience, there has never been a situation where the simulation results are different from the actual operation results. NGE Automation Online Network

5) Its pins have the ability to prevent transients and can be connected to a 220V AC power supply through a current limiting resistor. It can be directly connected to the relay control circuit without the need for photoelectric coupler isolation, which brings great convenience to the application. NGE Automation Online

6) Complete confidentiality. PIC uses a confidential fuse to protect the code. After the user burns the code, the fuse is blown and others can no longer read it unless the fuse is restored. At present, PIC uses a deep-buried fuse process, and the possibility of restoring the fuse is extremely small. NGE Automation Online Network

7) Built-in watchdog timer can be used to improve the reliability of program operation. NGE Automation Online

8) Sleep and low power mode. Although PIC cannot compare with the new TI-MSP430 in this aspect, it can still meet the needs in most applications. NGE Automation Online


2. Assembly language and disassembly language

Here I would like to explain assembly language in plain language. In fact, we can simply divide language into two categories: high-level language and machine language. The difference is that machines cannot recognize high-level language, and humans find it difficult to understand machine language. In order to make it easier for humans to program, we have the traditional compilation process, which is the process from high-level language to machine language.

For example, the compilation process of C language: C->assembly language->machine language

The corresponding formats are: .c->.asm->.hex

Keywords:PIC Reference address:PIC Disassembly (I) Assembler and PIC

Previous article:PIC16F1823 Development Notes (I) Preparation and Development Environment, Recommended Materials
Next article:PIC16F883 and TLC5615 (DA) digital-to-analog conversion experiment, breathing light

Recommended ReadingLatest update time:2024-11-15 14:33

On the encoding and decoding of infrared remote control using PIC microcontroller
Introduction: The commonly used infrared remote control coding rules are similar, basically the same as the 6221 principle On Receiving: If you use 54, 57 chips, it will be difficult (if you want to make real-time control; for example, you also need to drive the display, drive the stepper motor, and add a few button
[Microcontroller]
How to use PIC microcontroller to debug LCD controller
There are two issues with using a PIC to debug an LCD application. First, the LCD controller will stop when the device is halted. Second, the ICD pins are segment-shared on the PIC16F946/917/916/914/913 MCUs. When debugging, the device will halt at breakpoints and when the user presses the halt button. If the ICD is
[Microcontroller]
How to use PIC microcontroller to debug LCD controller
PIC microcontroller AD conversion (example analysis)
AD conversion is analog-to-digital conversion. As the name implies, it converts analog signals into digital signals. It mainly includes integral type, successive approximation type, parallel comparison type/serial parallel type, Σ-Δ modulation type, capacitor array successive comparison type and voltage-frequency conv
[Microcontroller]
PIC microcontroller AD conversion (example analysis)
PIC microcontroller memory bank 0 or 1 selection instructions (program)
  The data memory of the intermediate product PIC16C6X of the PIC microcontroller is usually divided into two banks, namely, bank 0 (Bank0) and bank 1 (Bank1). Each bank consists of two parts: dedicated registers and general registers. Some register units in the two banks are actually the same register unit, but have
[Microcontroller]
LCD driver HT1621 PIC microcontroller source code
STATUS  EQU     3H FSR     EQU     4H RB      EQU     6H RC      EQU     7H OPTIONA EQU     81H TRISB   EQU     86H TRISC   EQU     87H GENR0 EQU 053H GENR1 EQU 054H WD_RG EQU 055H DA_AG0 EQU 056H ;SEG0 SEG1 DA_AG8 EQU 05EH ;SEG16 SEG17 ;............................. C EQU 0 Z EQU 2 RP0 EQU 5 RP1 EQU 6  CS EQU 2     W
[Microcontroller]
PIC16F1829 DATA EEPROM Read and Write Operation Examples
Introduction: This article gives a PIC16F1829 DATA EEPROM read and write operation example, interested friends can take a look. #define ReadRomString_CALL #define WriteRomString_CALL //************************************* // Function name: ReadRomByte // Function: Read data from a certain address in ROM // Entry pa
[Microcontroller]
PIC Keyboard Program
ifndef _SKEY_H_ #define _SKEY_H_ #define uchar unsigned char #define uint unsigned int #define SKEY_FR   RA0 #define SKEY_AC   RA1 #define SKEY_RDEF RA3 #define BT_FR 0X0F //REC key value #define BT_AC 0XF0 //AC key value #define BT_RDEF 0XFF //RDEF key value #define UNKEY 0X00 //No key        //Returned ke
[Microcontroller]
Using PIC microcontroller to debug LCD online
There are two issues with   using a PIC to debug an LCD application. First, the LCD controller will stop when the device is suspended. Second, the ICD pins are segment-shared on the PIC16F946/917/916/914/913 MCUs.   When debugging, the device will halt at breakpoints and when the user presses the halt button. If the
[Microcontroller]
Latest Microcontroller Articles
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号