How to select PIC microcontroller memory bank 0 or 1

Publisher:温馨家园Latest update time:2011-02-22 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
The data memory of the intermediate product PIC16C6X of PIC microcontroller is usually divided into two banks, namely, bank 0 (Bank0) and bank 1 (Bank1). Each bank is composed of two parts: dedicated registers and general registers. Some register units in the two banks are actually the same register units, but have different addresses. For example, the two addresses of the status register STATUS-Reg of the PIC16F84 introduced in this edition are 03H and 83H. The same is true for general registers. The composition
(i.e., function) of the data memory of different models of PIC microcontrollers is not exactly the same, so once the designer selects a certain model of PIC microcontroller, he often needs to find the data memory information of the microcontroller for programming.
The author takes the initialization of RB port (RB7, RB6...RB0) in the source program written by PIC16F84 in the MPLAB integrated development software environment as an example to explain the method of selecting storage bank 0 or 1 as follows:
Program list
file: PIC01.ASM
List P=16F84
#include P16F84.inc
STATUS EQU 03H
RB EQU 06H
TRISB EQU 86H
ORG 0x00; Reset vector (PIC16F84)
GOTO MAIN; Go to the beginning of the main program
ORG 0x08; Store the program from address 08H
MAIN
CLRF PORTB; Initialize
BSF STATUS, 5; Set RP0 to 1, select Bank1
; In order to set register TRISB
MOVLW 0x0F; Initialize data 00001111B
MOVWF TRISB; RB port D3~D0 is input;
… ; D7~D4 are outputs
The above example shows that the register TRISB in the source program is in the storage bank 1 (Bank1) of the 16F84 data memory, so the purpose of selecting TRISB is achieved by programming.
Reference address:How to select PIC microcontroller memory bank 0 or 1

Previous article:Pseudo instructions for PIC series microcontrollers
Next article:PIC8-bit microcontroller source program assembly and curing under Windows (I)

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号