PIC16C5X microcontroller data memory

Publisher:梦想学院Latest update time:2015-04-24 Source: laoguKeywords:PIC16C5X Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
Program counter f2 (PC)
    The program counter gives the 2048x12 ROM address on the chip. The program counters of different models and their two-level stacks are 9-11 bits wide, as shown in Table 1.

  Table 1 Program counter PC and stack size
model PC width/bit Stack width/bits
PIC16C54/55 9 9
PIC16C56 10 10
PIC16C57 11 11
 
    After the system is reset, PC is all "1". The PC automatically increases by "1" for each instruction executed by the program, unless the program instruction itself changes the content of PC (such as program jump, interrupt service, etc.). The following instructions will change the value of PC.

    [1]. "GOTO" instruction: allows the lower 8 bits of the program counter to be loaded directly. For PIC16C56/57/58, the highest bit of PC is determined by the two page select bits PA0 and PA1 (that is, bits 5 and 6 of the status register). This instruction allows jumping to any position on any page.

    [2]. "CALL" instruction: first push the current PC value into the stack, then clear the 9th bit to "0", and load the lower 8 bits into the program counter PC. For PIC16C56/57/58, the upper two bits of PC are loaded into the page select bits PA0 and PA1.

    [3]. "RETLW" instruction: This return instruction directly reloads the top of the stack into the PC.

    [4]. The program counter can be changed by a certain instruction (such as MOVWF f2, ADDWF f2 or BSF f2,5). The calculation result will be loaded into the lower 8 bits of PC, and the 9th bit will be cleared to "0". For PIC16C56/57/58, the upper two bits of PC are loaded into the page select bits PA0 and PA1.

    It should be noted that: when executing "CALL" or other instructions that change the PC value, the 9th bit will be cleared to "0". When all subroutine call instructions and jump instructions that need to be calculated, the branch program should be placed in the first 256 units of any page (512 bytes) (addresses are 000-0FFH, 200-2FFH, 400-4FFH, 600-6FFH respectively).

    In the case of multiple program memory page selection (valid for PIC16C56/57/58), when the program counter points to the last address of the storage page, it can still add 1 and continue to execute to the next page, but the PA0, PA1 page selection bits will not change. Subsequent "GOTO", "CALL", "ADDWF f2", "MOVWFf2" and other instructions will return to the original page unless the page selection bits are changed in the program. For example, the NOP instruction is located at 1FFH (page 0), and the PC adds 1 to 200 (page 1). A "GOTO XXX" instruction at 200 will return to the XXX address of page 0 (if the page preselection bit of f3 is "0").

    In the RESET state, PA0 and PA1 are cleared to "0", and page 0 will become the preselected page. At the same time, the program counter PC will address the last unit of the last page. Therefore, the "GOTO" instruction at this position will automatically return to page 0 for execution.

Keywords:PIC16C5X Reference address:PIC16C5X microcontroller data memory

Previous article:PIC16C5X microcontroller status register
Next article:PIC16C5X microcontroller program memory

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号