On Sat, Apr 05, 2014 at 07:33:37PM -0400, John J. McDonough wrote: > It is generally considered good form to declare as few variables as > global as possible. In "proper" C, local variables are allocated on the > stack, which takes essentially no overhead (the compiler increments the > stack pointer by n+1 instead of 1). However, on the PIC12, 16 and 18 > there really is no proper stack, and there is precious little RAM to > create some sort of virtual stack, so the behavior becomes very compiler > dependent. Some compilers allocate a a region of memory for automatic > variables but this can affect reentrancy. Others, especially for the > 18F, attempt to create a virtual stack. >=20 > This is one reason (of many) to consider the 16 or 32 bit parts when you > switch to C, especially as a hobbyist. On the dsPIC, PIC24 and PIC32 > you can write "proper" C without concern for any compiler peculiarities. > XC16 and XC32 are ports of the gcc compiler, which is the gold standard. After spending the last month writing a Forth interpreter for the PIC24FV family, I wholeheartedly agree with the above. The 16 and 32 bit parts are much better architected for high level languages such as C. It has both the register space (15 GP registers + 1 stack pointer), memory layout, and addressing modes to optimize compilation of high level code. Specifically the PIC24FV family is a 5V chip that comes in the 28 pin PDIP. So it's really hobby friendly. All it requires is the addition of a single capacitor to be run off a 5V supply. BAJ --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .