Hello. I attach the Makefile I use for the project, just do "make" and "make sim". This is a driver for the T6963 LCD screen. You just need to simulate it to see that something is wrong. I'm using sdcc 2.8.0 on Debian Etch.
When making the simulation, please, put a Breakpoint on line 578: CLRF _TRISB
Then, Run it and when it starts a loop, put two logical ones on input ports B0 and B1, this is to simulate the behaviour of the LCD. Then, when it reaches line 578, see that STK00 is zero, it is correct because if you read at the code variable "carmelomelo" (this strange name is to assure it's different from everything else) is initialized with zero on toggle_led.c:142: dt2(0,0);
But repeat the process two more times, Run and when it stops, Step by and see the output of PORTB. You'll see that the following one is also zero, which is correct, but then, it's one, and it should be 0x40!! (toggle_led.c:143)
I think that the problem is that the compiler uses the same STK00 register for all the parameters that all functions use through the program, and this gets overwritten before using it, because yo do something like:
do nothing but return;
sleep(50000); // Now, STK00 so data is overwritten.
PORTB = data; // Wrong value, not zero.
Log in to post a comment.