Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Mock Exam Question - Clarification

Status
Not open for further replies.

Spadez

New Member
Hi,

I have an exam in a few weeks and two of the mock exam questions are slightly confusing. Ive attempted to answer them but can you tell me if I have it right please.

1.

What is the significance of the Stack locations 000h, 004h and 005 to 07FFh.

Ive attached a picture of the relevant section of the datasheet.

Is the answer to the first part, that stack locations 000h to 004h are used for the reset vector, which means that the program can start between these four memory locations, which is defined in "ORG" at the start of the code.

In answer to the second question, this is all "on chip memory". This is where the compiled assembly program (hex file) will be stored.

2.

What is the significance of Bank 0 to Bank 3, and how does the user access them?
Bank 0-3 contain all of the file registers for the data memory. I dont really understand the last part of the question.

In which registers is the user able to store user specific data
Is it in the general purpose register? For example 20h.

Any help would be appreciated,

James
 

Attachments

  • Capture2.GIF
    Capture2.GIF
    18.1 KB · Views: 306
  • Capture.GIF
    Capture.GIF
    64.2 KB · Views: 378
I think your correct on the first part. For the bank selection, see table 4-2 right above it, it says what it is, and how to get at it by using RP1,RP0.RP<1:0>: Register Bank Select bits (used for direct addressing) and also IRP: Register Bank Select bit (used for indirect addressing) located in the STATUS – REGISTER

I believe you need to switch between banks to access different registers of the chip, and one method of doing this directly is through the RP1/0 bits. For example if you are in bank 0 and need to change something in the TRISB register you need to go to bank 1, then change TRISB or whatever you need.
 
Last edited:
000h, 004h and 005 to 07FFh are not "stack locations" They are locations for your program.
The actual location of the stack is not "known." The microcontroller has 8 locations called the stack locations.
The micro goes to location 00h when it is turned on, or reset.
Location 07FFh holds the oscillator calibration value.
If you are not using any interrupt features, your program can start at 00h and continue to 07FEh.
If you are using interrupt features, your program can use locations 00h, 001h, 002h, 003h to tell the micro to go to Main. In most cases you only need a single instruction to do this, because you cannot use location 004h as this location needs to be an instruction to go to the Interrupt Service Routine.
Location 004h will contain an instruction to go to (ISR) Interrupt Service Routine - ISR can be located anywhere in your program.
Location 005h can be the start of a table or the beginning of a sub-routine if you are using the interrupt feature.
Locating a table at the top of the program (start at 005h) allows nearly 250 values, as the table cannot pass the 1FFh boundary without a lot of additional clever instructions.

Some of the general purpose registers (files) are in bank0 and some are in the other banks.
 
Last edited:
Disregard, didn't read properly ;)
 
Last edited:
You should ask your examiner to ask questions that make sense. As pointed out by Colin, your examiner has confused Stack Locations with Program Memory.

Mike.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top