DPRG
DPRG List  



[DPRG] HELP with 68HC11 stack problem

Subject: [DPRG] HELP with 68HC11 stack problem
From: Randy Carter rwcarter at foxinternet.net
Date: Thu Jun 21 11:07:39 CDT 2001

I have read the other responses and would like to add my 2 cents
worth.  

There are 4 types of stack mechanisms.  They are pre increment,
post increment, pre decrement and post decrement.  Pre refers to
whether the pointer is changed before the write to memory and
post refers to after the write.  Then there is incrementing and
decrementing which is self explanatory.

The 68HC11 uses a post decrement type of stack pointer.  The data
byte is written then the pointer is decremented.  When the stack
is set up you want the pointer at the last address of the RAM
memory.  $4000 doesn't sound right.  It sounds like the beginning
address of a memory space and there my not be memory chip there
to write the first by on the stack to.  $3FFF sounds like a more
reasonable pointer.

I agree there are a couple of other things to check.  Make sure
you have the MODA and MODB pins set correctly.  This gets
complicated when your program starts from internal memory.  Your
program can turn on the external memory by writing to one of the
configuration registers (I don't have the data here to give you
the details).

Clay Timmons wrote:
> 
> HELP!   I'm having a problem with a 68HC11 microcontroller board.
> I consider myself a near expert on the 68HC11 but this one has me baffled.
> I'm not even sure of the most basic question.  Is this a software or hardware
> problem.   I've spent about 3 hours tracking down this one and still haven't
> found it.  For reference I'm using a New Micros NMIY-0020 board and
> Imagecraft ICC11 C-compiler.
> 
> My code runs fine when the very first instruction is  LDS #0x00FF
> which loads the stack pointer to the 256 byte RAM internal to the HC11 itself.
> 
> When I cange the code to LDS #0x4000 to initalize the stack pointer
> to external RAM  I have a problem.   On powerup nothing happens
> but then if I hit the reset button it works fine.   I can't figure out why
> it would hang on powerup but work after reset?  Powerup should be
> the same as reset right...  I also really wonder what its doing when
> it appears to hang.
> 
> Anyone ever set the stack to external memory?    Any advantage/disadvantage?
> I think everything should work the same with the stack in external or internal
> memory.  My code has grown and grown and now I'm needing more stack space.
> 
> The external memory is a ST Microelectronics NVSRAM.   I started to suspect
> that it takes some time after powerup before you can access it.  I added some
> delay in the code to compensate but it had no effect.  So much for that idea.
> 
> Any ideas, even crazy ones, are appreciated,
> 
> -Clay Timmons-
> 
> _______________________________________________
> DPRGlist mailing list
> DPRGlist at dprg.org
> http://nimon.ncc.com/mailman/listinfo/dprglist


More information about the DPRG mailing list