Re: [PIC] Learning C
smplx <[email protected]>
| Newsgroups | gmane.comp.hardware.microcontrollers.pic |
|---|---|
| Message-ID | <[email protected]> |
write a function:
void * get_stack_ptr(void)
{
int x;
return &x;
}
This will return the address of the local variable x which will be on the
stack.
use it as:
if ((unsigned long)get_stack_ptr() == (unsigned long)fixed_value+N)
// where N is a constant TBD (around +/- 4 to 12)
On Fri, 15 Nov 2024, David VanHorn wrote:
> Same here. I can work with c fairly well, but some things seem unusually
> difficult in c. Like comparing the current value of the stack pointer to a
> fixed value ( used in my sanity check routine) I assume there is a way to
> get there.
>
> On Sun, Nov 10, 2024, 11:34 AM David C Brown <[email protected]> wrote:
>
>> Although I enjoy programming in Assembler, the fact that so many libraries
>> abd code examples are in C I think that the time has come for me to learn
>> that language.
>>
>> Any advice on how to do that would be welcomed, be it a book or online
>> resources.
>> I am a competent programmer having programmed in with Forth, Fortran.
>> \Pascal, Visual basic
>> __________________________________________
>> David C Brown
>> 43 Bings Road
>> Whaley Bridge
>> High Peak Phone: 01663 733236
>> Derbyshire eMail: [email protected]
>> SK23 7ND web: www.bings-knowle.co.uk/dcb
>> <http://www.jb.man.ac.uk/~dcb>
>>
>>
>>
>> *Sent from my etch-a-sketch*
>> --
>> http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
>> View/change your membership options at
>> https://mailman.mit.edu/mailman/listinfo/piclist
>>
> --
> http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
> View/change your membership options at
> https://mailman.mit.edu/mailman/listinfo/piclist
--
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
https://mailman.mit.edu/mailman/listinfo/piclist