Hello all, I'm running into trouble (once more) when executing my app. I attach the code so you can see.
The problem arises from my interrupt, which is calling some functions outside of it. It almost works, I explain myself: This application shows a menu with some options on screen, so you can select between them with an encoder. This encoder is read by the temete2.c:testEncoder() function, which enters a loop and uses global variable BYTE encoderStatus and local BYTE key[2] to put the old and both old and new encoder values, respectively. These values are taken from some input gates (specifically, from RC6, RD3, RD2). These input gates are only used for this purpose, and connected to the output of the encoder. And they are only called from this function, nowhere else. I have checked it throughfully. Some gates from PORTD are called from other places, but not Gates 2 nor 3. And TRISD is only used once, and switched to '0x0c' (So RD2, RD3 are inputs, the others are all outputs). Well, for the other side, we have a countdown, which draws some numbers on LCD screen via software I2C. To achieve this, I have written an interrupt, called temete1c:Intr(), which calls some functions to draw these values (temete4.c:PaintChar(), for example). Then, PaintChar calls other functions, until the low-level ones are reached. The problem is that I have observed that this interrupt actually modifies RD2's value, always to the opposite. So, while the testEncoder loop is running, key[] (and maybe the encoderStatus) variable is magically changed, like if the encoder was pressed. So, a menu option gets selected each time the clock is updated, and then, it gets unselected again. I'm speaking without the user actually pressing the encoder. I have observed no other strange behaviour, only this. It does not change RD3's value, indeed, which is very very curious. Am I incorrectly calling these functions from my interrupt? Have I made some other mistake? I think it's not possible to put all the code directly inside the interrupt, it's just too big, too repetitive. It's better put in a function. But it seems not to work 100%. Thank you.
temete-0.2.tar.gz
Description: GNU Zip compressed data
------------------------------------------------------------------------------ The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your production scanning environment may not be a perfect world - but thanks to Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 Series Scanner you'll get full speed at 300 dpi even with all image processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________ Sdcc-user mailing list Sdcc-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sdcc-user