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.
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!
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.
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"
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.
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 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.
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.
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
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.