> From: John Dammeyer > [cut] > Some of it is hit and miss. Think about it though; the underlying machine > your compiling code for. The C language implimented for a PIC as you get it > is nowhere near real C and can't ever be that. True, an implimentation > using pseudo heaps and stacks is possible for passing huge arrays and lots > of local variables but then you still only have a few bytes of RAM > available. No complete implimentation of an HLL like C can run with so > little code and data space. That was one of the first things I had to > re-orient myself to. I wasn't writing in C I was writing in a simple > Algorithmic language that had much of the syntax of C. Only then did I > become more productive and have fewer problems. > > For example, It's just not worth passing parameters to functions in most > cases. The two byte size parameters are immediately placed into the W and > the FSR, then your function is called and then inside your function put into > the local RAM storage. Except you can't overlay that RAM with any other > locals so it's gone forever. Takes less code to just set the parameters > into overlayed locals yourself and then call the function ala assembler. > Not as neat but takes less space. ...all of which ties in nicely with my usual recommendation to stick with assembler for small microcontrollers - especially the ones with less RAM than a BULL paddock. Tell me, what is the point of interposing another layer of inscrutable software between you and the machine? The PIC has a wonderful RISC flavour; you can learn all its instructions in a few hours. Better to spend time doing this rather than bashing your head against a wall trying to figure out what the compiler has done to your nice algorithm. Also, tell me what is the point of using a language which is so nobbled by limitations of the machine? C without a stack, heap, float, qsort() and int ((**)(void ***)) pointers is like (to quote a well known Aussie song) a pub with no beer. I say this in spite of having written over 100,000 lines of C (and loving it). However, horses for courses and the horse for the PIC course is Microchip Assembler, of course -- no offence to all the compiler developers out there (you're doing a great job fellas, don't give up on it just yet). Naturally, the assembler has to be the dinkum one - not the yucky Intel lookalike or whatever it is. Regards, SJH Canberra, Australia