Page 1 of 1

gLCD in Macro Issue

Posted: Mon Oct 25, 2010 2:30 pm
by swatzy
Hi all,
I'm have a EB058/057 gLCD display, all set up and running using a PIC16F877A all works fine when I call the the commands in the main program. However when I move these calls into a Macro the last print command scrolls and overwrites itself. I'm using Flowcode4 with PIC_gLCD.c version 300410 as instructed from this forum.
Any clues??
swatzy

Re: gLCD in Macro Issue

Posted: Mon Oct 25, 2010 6:04 pm
by Jan Lichtenbelt
A stack overflow?

Re: gLCD in Macro Issue

Posted: Tue Oct 26, 2010 8:12 am
by swatzy
It feels something like that,
I guess the big question is Why does me calling it as a macro cause this sort of error.

Re: gLCD in Macro Issue

Posted: Tue Oct 26, 2010 8:50 am
by Jan Lichtenbelt
Put your flowcode file as attachment. That makes is easier to help you.

Re: gLCD in Macro Issue

Posted: Tue Oct 26, 2010 9:22 am
by Benj
Hello,

The 16F877 has only around 8 layers of hardware stack. Each jump to a macro or interrupt routine will consume one layer of the stack.

This topic details how to implement the BoostC software stack.
http://www.matrixmultimedia.com/mmforum ... ack#p19591

I will look into the code to see if I can spot why this is causing stack errors when it is running inside a macro.

Re: gLCD in Macro Issue

Posted: Tue Oct 26, 2010 3:33 pm
by swatzy
Here's the sourcecode. Thanks for replies so far.

Re: gLCD in Macro Issue

Posted: Thu Oct 28, 2010 9:01 am
by swatzy
It was indeed the stack, added -swcs 6 2 to the linker parameters in the compiler options and it all goes. I think I'll need to use an 18 series PIC tho'
Thanks for help