Is there a way to view the contents of the W register while debugging?
Jim
W Register
-
- Posts: 417
- Joined: 10 Jan 2009 22:03
You should tell this to Microchip because at lower series WREG is not mapped into REGISTERS.JimKueneman wrote:Bummer, I hope this is on the wish list for the lower series of PICs.
Jim
Best regards, Florin Andrei Medrea.
http://www.microelemente.ro/
http://www.microelemente.ro/produse-si-servicii/
http://www.microelemente.ro/custom-software/
mail : florin@microelemente.ro
http://www.microelemente.ro/
http://www.microelemente.ro/produse-si-servicii/
http://www.microelemente.ro/custom-software/
mail : florin@microelemente.ro
-
- Posts: 158
- Joined: 17 Jan 2009 21:33
Re: W Register
Hm, I still don't know how to realize this in mikroPascal (I've only done some tests up so far...), but in assembler you have a "workaround" for the baseline and midrange-PIC's:JimKueneman wrote:Is there a way to view the contents of the W register while debugging?
- define an additional variable (named for example DEBUG_REG), which is placed on a register-address, which is shared over all banks (adr. 070H in the PIC16F628A for example) (have a look to the data-memory-map in the datasheet of the PIC you are using)
- then place a MOVWF DEBUG_REG whereever you are interrested in the content of the W-register (this instruction doesn't change any status-bits, so it will not influence your code in a way, only it works as a small delay (1 instruction-cycle))
Hope this helps (and maybe a mikroPascal-specialist can "translate" it for you),
Stefan
Yes, that's possible using internal variables compiler defines for itself exactly at these common addresses (the variables are called STACK_x and are used for all 'behind the scenes' operations). Compiler rarely uses all of these variables, so one may use one of the last ones (like STACK_15) for own purposes, like shadowing W register:
Note, that asm block may disturb Pascal code optimisation, so the final code may change after inserting the above.
Code: Select all
asm movwf STACK_15 end;
It was suggested for simulation, but to no avail.JimKueneman wrote:Bummer, I hope this is on the wish list for the lower series of PICs.