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.

Bank,Page,Reset,Memory

Status
Not open for further replies.

ibwev

Member
Any help with the following four questions would be much appreciated.

1) In MPLAB, once a program is compiled, is it possible to see which bank certain variables are stored in and what pages various section of code were assigned to? If so, how?

2) If power is lost to the pic, is it possible for the pic to remember where it was?

3) Can the pic awake to an assigned location in the code each time the pic is powered up?

4) Using assembly language, what is the best way to reset a pic from a subroutine without using the Watch Dog Timer?
 
It helps if you mention which chip and language. However,

1. in asm you are in charge. In C use the watch window.
2. No.
3. Just put goto location at the reset vector.
4. In 18 series use the reset instruction. In 16 series, no.

Mike.
 
Thanks for the help. I am using assembly language with PIC16F690.

1) I am using relocatable code in MPLAB. How do I see what banks and pages that variables and code have been assigned to.

4) Would there be a problem with using the instruction below in a subroutine on the PIC16F690:
goto 0x0000 ;go to reset location
 
1. Don't know.
2. Yes you can use it but nothing will be reset. The port will still be in the same state, interrupts/timers etc still running.

Mike.
 
When u say relocatable code in asm I am not sure I understand your meaning. Higher level languages like C/Basic do their own code & variable location assignments, and this is more portable between processors. In asm YOU do the location assignments of the code/variables.

If you want to absolutely control the location of your variables you use the EQU statement eg. Temp EQU 0x111 , which will assign the 'Temp' variable to location 0111hex, probably in bank 2. It takes a bit more work to manage rather than the block assignment of variables in MPLAB. In larger programs where you need to assign multibank variables etc. you can use EQU statements.

When it comes to 'seeing' code and variable assignments I have found that the OSHONSOFT PIC Simulator let's you SEE the bits and bytes of the variables and special function registers with an interactive display, allowing you to modify registers etc. Assembling in OSHONSOFT also gives you a visual as to the layout of your code in the Code memory space.

The ORG statement to the assembler tells it where to place the code in the memory space. You can have multiple ORG statements in your code thus controlling exactly which PAGE of memory is used. This helps when you need to allocate blocks of ram on 256 byte boundaries etc for lookup tables etc. It also keeps things orderly if your code is large enough to cross into different pages. Then you need to study the PCLATH register as it relates to calls & gotos.
 
Last edited:
Any help with the following four questions would be much appreciated.

1) In MPLAB, once a program is compiled, is it possible to see which bank certain variables are stored in and what pages various section of code were assigned to? If so, how?

You could use the 'Watch' command under view to see what location a certain variable is located at. I use it to see where my cblock variables are located at. To see what page a section of code is in you could use 'Disassembly Listing' under the same menu. It would be a manual process, but you could do it. I haven't run into that problem yet because I'm using a 16F818 which only has page 0.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top