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.

Hey (MPLAB SIMULATOR )

Status
Not open for further replies.

shawnmk

Member
I got this error when I was running MPLABsim

CORE-W0014: Halted due to PC incrementing over the Maximum PC address and wrapping back to Zero

The project is building and its error free.
I am not sure what exactly triggered this. Can you please help?
 
I don't know anything about MPLABsim - never used it. But from what little assembler I remember, PC is "Program Counter" - essentially a register in the cpu that keeps track of a pointer to the next instruction to execute in memory. This pointer is an address; since each instruction can have a varying number of opcodes, the addresses aren't necessarily sequential (at least with "modern" CPUs - from what I recall, back in the day where word-sizes were not on "8-bit boundries", instructions and data could occupy an entire word, thus addresses were sequential - to a point - anyway), but they are orderly.

So - each time an instruction is executed, the PC is incremented (by the length in bytes of the instruction and data - handled automagically by the cpu). If the PC is greater than the maximum amount of memory, it will wrap to address 0 (due to 2s complement arithmetic, IIRC) - which is what your error is saying.

Now - like I said, I don't know anything about MPLABsim - but it is obviously a simulator of some sort for microprocessors or microcontrollers. As such, I am thinking maybe there is a configurable option to change the amount of memory allocated to the program space, and that it is currently set smaller (for whatever reason) than your program compiles to. For instance, maybe the total program memory of the system is 1024 bytes, but your program compiles to 1056 bytes. It might compile and run fine - up until it hits that 1024 byte limit and wraps around (totally confusing everything).

I would say there is either an option to change this (per simulated CPU?), or your program is too big for the simulated (and/or real) CPU - or something else of that nature.

That's all just a guess (educated somewhat, though)...

Hopefully somebody else here has more experience and can tell you exactly what is wrong. Good luck!
 
Last edited:
To add to what cr0sh said. MPLABs simulator sets the memory size based on the PIC chip you have selected.

Depending on your program and how closely you have inspected the execution it may well be running of the end of memory and restarting.

Place a breakpoint just after the start of your program. If you keep ending up there when you should be in the main loop the debugger is telling the truth.

EDIT: We are asking that people use titles that indicate the nature of they thread. I have fixed yours.
 
Last edited:
Thank you for your inputs. While I was setting the breakpoints to test the program, another error pops up which i simply cannot resolve.

'One or more breakpoints could not be resolved. Select breakpoints from the configuration menu.'

Please help.
 
Here is the code

;flashingLED12F629.asm
include "p12f629.inc"

; globals variables
T1 equ 26h
T2 equ 27h
T3 equ 28h

Main bsf STATUS,5 ; select bank 1 for TRISIO
movlw B'11111101' ; GP1 as output
movwf TRISIO ; set GP1 as output
bcf STATUS,5 ; select bank 0

again bsf GPIO,GP1 ; port pin = 1
call Delay ; 0.5 second delay
bcf GPIO,GP1 ; port pin = 1
call Delay ; 0.5 delay
goto again ; repeat

;Delay 0.5 sec
Delay movlw 3 ; load values
movwf T1 ; T1 = 3
movlw 0EBh ; W = 235
DelT1 movwf T2 ; T2 = 235
DelT2 movwf T3 ; T3 = 235
DelT3 decfsz T3,1 ; T3 = T3-1, rpeat not 0
goto DelT3 ; repeat previous line
decfsz T2,1 ; T2 = T2-1, rpeat not 0
goto DelT2 ; repeat previous 4 lines
decfsz T1,1 ; T3 = T3-1, rpeat not 0
goto DelT1 ; repeat previous 6 lines
return

;
end
 
I am getting the feeling that running MPLAB on Vista is the issue.

Here are some of the other messages I get :

Case: When i open .asm files, I get the message

MPLAB IDE is already running on this computer. It is not recommended to run simultaneous instances of MPLAB IDE. Do you want to continue?
 
This code is given by the supplementary website of a book I am using. When I build any of the projects given on the site, The output does not show 'Build Successful'. Below is what it shows on the output . .

Release build of project `C:\Users\S#@WIV\Desktop\programs\BookSite\ch_1\Progs\Asm\first\prog1_1.mcp' started.
Language tool versions: MPASMWIN.exe v5.39, mplink.exe v4.38, mplib.exe v4.38
Wed May 04 14:34:55 2011
----------------------------------------------------------------------
Make: The target "C:\Users\S#@WIV\Desktop\programs\BookSite\ch_1\Progs\Asm\first\prog1_1.o" is out of date.
Executing: "C:\Program Files\Microchip\MPASM Suite\MPASMWIN.exe" /q /p16F627A "prog1_1.asm" /l"prog1_1.lst" /e"prog1_1.err" /o"prog1_1.o"
 
It really makes more sense to post the project as a zip with this sort of problem.

First it saves the helper the work of duplicating yours.

Second if the problem is in the project setup we will never see it without your project.

I used MPLAB and the simulator with vista for several years.
 
I reinstalled MPLAB and it kinda showed signs of working. It atleast showed Build Failed. Then I googled the error messages I got and it led me to this site.

Need help.........MPLAB project building [Archive] - All About Circuits Forum

So i included ORG 0x000 and Goto Main (Main is case sensitive!!!). It works but with warnings. Please help.

Warning[205] C:\USERS\S#@WIV\DESKTOP\PROGRAMS\BOOKSITE\CH_2\PROGS\ASM\01_FLASHINGLED\FLASHINGLED.ASM 3 : Found directive in column 1. (ORG)
Warning[203] C:\USERS\S#@WIV\DESKTOP\PROGRAMS\BOOKSITE\CH_2\PROGS\ASM\01_FLASHINGLED\FLASHINGLED.ASM 4 : Found opcode in column 1. (goto)
Message[302] C:\USERS\S#@WIV\DESKTOP\PROGRAMS\BOOKSITE\CH_2\PROGS\ASM\01_FLASHINGLED\FLASHINGLED.ASM 12 : Register in operand not in bank 0. Ensure that bank bits are correct.
Executing: "C:\Program Files\Microchip\MPASM Suite\mplink.exe" /p12F629 "flashingLED.o" /u_DEBUG /z__MPLAB_BUILD=1 /z__MPLAB_DEBUG=1 /o"flashLED.cof" /M"flashLED.map" /W
MPLINK 4.33, Linker
Copyright (c) 2009 Microchip Technology Inc.
Errors : 0

MP2HEX 4.33, COFF to HEX File Converter
Copyright (c) 2009 Microchip Technology Inc.
Errors : 0

Loaded C:\Users\S#@WIV\Desktop\programs\try\flashLED.cof.
----------------------------------------------------------------------
Debug build of project `C:\Users\S#@WIV\Desktop\programs\try\flashLED.mcp' succeeded.
Language tool versions: MPASMWIN.exe v5.33, mplink.exe v4.33
Preprocessor symbol `__DEBUG' is defined.
Wed May 04 16:15:57 2011
----------------------------------------------------------------------
BUILD SUCCEEDED
 
Your first 2 warnings are because (what it says) there is a directive in column 1. Either put a space or tab in front of the referenced line/directives.

The 3rd warning is letting you know that you have changed banks, obviously so you can set the TRIS bits correctly. This isn't a problem, if you mean to be in a different bank (you did). There is a way to remove this warning but I forget it ;)
 
well .. i have come some way from the previous post ... now my problem is about

Invalid osccal value

This happens when i use the PICKIT 2 Programmer software.

I also tried the MPLAB programmer to program the PIC12F629. this is the error i have there.

Verifying Target
PKWarn0003: Unexpected device ID: Please verify that a PIC12F629 is correctly installed in the application. (Expected ID = 0xF80, ID Read = 0x0)
Verifying Program Memory (0x0 - 0x3FF)
PK2Error0027: Failed verify (Address = 0x0 - Expected Value 0x2801 - Value Read 0x0)
PICkit 2 Ready


I have attached my files as a zip folder.
 

Attachments

  • flashLED.zip
    8.8 KB · Views: 169
I am also facing the problem of 'invalid osccal value' when I am using the PICKIT 2 Programmer. I tried to 'auto regenerate' the osccal value. It was successfull and the value is 34FF. However, when i load the hex I want to burn, the setting disappears.

I have attached a screendump. Please help.
 

Attachments

  • osccal.pdf
    120.8 KB · Views: 273
....ID Read = 0x0
....Value Read 0x0

Because it keeps reading all 0's back, that points to either the PIC not talking back at all (probably stuffed) or not connected to the PicKit properly.
 
Hey Gobble,

How do I circumvent this issue of Invalid OSCCAL?

I would also like to mention that I am trying to program the PIC12F629 using ICSP of the PICKIT2 programmer (sorry if the statement is not correctly framed).

I dont know how to set the oscillator frequency value. Please let me know which is the best option:
Do I simply attach the ICSPCLK pin to the corresponding pin of PIC?
or do i need to plug in a 20MHZ and two caps to the CLKIN/OUT of the PIC?
 
Can you show me how you're connecting the PIC12F679 to the pickit2!! I use PIC12F675's all the time and this program you have written won't give a flying *** about the oscal value.. so it seems the problem here is pickit2 doesn't see the pic chip properly... I had to make three different programming boards to take (most) of the pic range..

Cheers Ian

P.S the middle board takes 8 pin at the bottom and 18 / 20 pin at the top
 

Attachments

  • IMG031.jpg
    IMG031.jpg
    211.2 KB · Views: 326
Last edited:
here it is... my setup for ICSP programming with PICKIT2 on the PIC12F629.

I have left the last pin open.

The program i am running is a flash LED. So you will see a LED and resistor to ground. The Vss will also be connected to ground.

please help.
 

Attachments

  • PICKIT 2 ICSP on PIC12F629.pdf
    564.7 KB · Views: 217
I connected the PICKIT2 as shown and opened the flashLED project. This is the error message i got. I have shared the screen dump.
 

Attachments

  • MPLAB warning.pdf
    86.2 KB · Views: 232
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top