gLCD in Macro Issue

For E-blocks user to discuss using E-blocks and programming for them.

Moderators: Benj, Mods

Post Reply
swatzy
Posts: 10
Joined: Wed Sep 22, 2010 6:53 am
Has thanked: 2 times
Contact:

gLCD in Macro Issue

Post 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

User avatar
Jan Lichtenbelt
Posts: 797
Joined: Tue Feb 17, 2009 8:35 pm
Location: Haren GN, the Netherlands
Has thanked: 128 times
Been thanked: 264 times
Contact:

Re: gLCD in Macro Issue

Post by Jan Lichtenbelt »

A stack overflow?

swatzy
Posts: 10
Joined: Wed Sep 22, 2010 6:53 am
Has thanked: 2 times
Contact:

Re: gLCD in Macro Issue

Post 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.

User avatar
Jan Lichtenbelt
Posts: 797
Joined: Tue Feb 17, 2009 8:35 pm
Location: Haren GN, the Netherlands
Has thanked: 128 times
Been thanked: 264 times
Contact:

Re: gLCD in Macro Issue

Post by Jan Lichtenbelt »

Put your flowcode file as attachment. That makes is easier to help you.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: gLCD in Macro Issue

Post 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.

swatzy
Posts: 10
Joined: Wed Sep 22, 2010 6:53 am
Has thanked: 2 times
Contact:

Re: gLCD in Macro Issue

Post by swatzy »

Here's the sourcecode. Thanks for replies so far.
Attachments
testglcd2.fcf
glcd call macro
(10.5 KiB) Downloaded 333 times

swatzy
Posts: 10
Joined: Wed Sep 22, 2010 6:53 am
Has thanked: 2 times
Contact:

Re: gLCD in Macro Issue

Post 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

Post Reply