W Register

General discussion on mikroPascal.
Post Reply
Author
Message
JimKueneman
Posts: 417
Joined: 10 Jan 2009 22:03

W Register

#1 Post by JimKueneman » 04 Feb 2009 14:03

Is there a way to view the contents of the W register while debugging?

Jim

yo2lio
Posts: 1878
Joined: 19 Sep 2006 12:57
Location: Romania, Arad City
Contact:

#2 Post by yo2lio » 04 Feb 2009 15:34

only at P18 or higher ... WREG
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

JimKueneman
Posts: 417
Joined: 10 Jan 2009 22:03

#3 Post by JimKueneman » 04 Feb 2009 16:20

Bummer, I hope this is on the wish list for the lower series of PICs.

Jim

yo2lio
Posts: 1878
Joined: 19 Sep 2006 12:57
Location: Romania, Arad City
Contact:

#4 Post by yo2lio » 04 Feb 2009 16:28

JimKueneman wrote:Bummer, I hope this is on the wish list for the lower series of PICs.

Jim
You should tell this to Microchip because at lower series WREG is not mapped into REGISTERS.
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

Stefan Uhlemayr
Posts: 158
Joined: 17 Jan 2009 21:33

Re: W Register

#5 Post by Stefan Uhlemayr » 04 Feb 2009 21:59

JimKueneman wrote:Is there a way to view the contents of the W register while debugging?
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:
- 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

janni
Posts: 5373
Joined: 18 Feb 2006 13:17
Contact:

#6 Post by janni » 04 Feb 2009 23:59

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:

Code: Select all

asm movwf STACK_15 end;
Note, that asm block may disturb Pascal code optimisation, so the final code may change after inserting the above.
JimKueneman wrote:Bummer, I hope this is on the wish list for the lower series of PICs.
It was suggested for simulation, but to no avail.

Post Reply

Return to “mikroPascal General”