CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

how Can I read the stack of the pic16F877?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Luis Alberto
Guest







how Can I read the stack of the pic16F877?
PostPosted: Fri Jul 04, 2003 1:31 pm     Reply with quote

how Can I read the stack of the pic16F877?
___________________________
This message was ported from CCS's old forum
Original Post ID: 144515741
xvi.lajos



Joined: 06 Sep 2003
Posts: 12
Location: Hungary

View user's profile Send private message Send e-mail

Re: how Can I read the stack of the pic16F877?
PostPosted: Sun Jul 06, 2003 12:43 pm     Reply with quote

:=how Can I read the stack of the pic16F877?
There's only one way as I know.
Use the CCS ICD with PCW debugger.
Add the #DEVICE CCSICD=TRUE line to your program and you can see the stack by PCW debugger .
George
___________________________
This message was ported from CCS's old forum
Original Post ID: 144515750
R.J.Hamlett
Guest







Re: how Can I read the stack of the pic16F877?
PostPosted: Mon Jul 07, 2003 2:34 am     Reply with quote

:=how Can I read the stack of the pic16F877?
The basic answer would be that you don't...
As another poster has said, for debugging purposes, most tools, can allow you to see the stack contents. However the stack on these PICs, is not available to hold data from inside the program. If you look at the 'block diagram' of the chip, in it's data sheet, you will see, that the only interface 'path' to the stack, is shown as being to/from the program counter. The memory organisation diagram, shows the only interface instructions, as being call, return, retfie, and retlw. The hardware stack on the PIC, is only designed to hold program addresses for subroutine calls, rather than being available to hold values, using 'push/pop' type instructions, as is common on many other architectures.
Microchip, do have an application note, showing how to implement a software stack, if you require this type of functionality inside your code.
The latter 18 family chips, do allow a limited ability to access the hardware stack (with care...). The stack pointer itself, is available as a register, and the contents of the top register in the stack, are also available through other registers, potentially allowing the stack to be manipulated. Hence if you require this type of access, you would have to change to one of these chips.

Best Wishes
___________________________
This message was ported from CCS's old forum
Original Post ID: 144515759
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group