From: roelof 't H. <ro...@it...> - 2003-04-07 09:37:44
|
Hi, Strange problem : When I insert, in main(), the next piece of code the whole thing just stops : if(teller>9) { teller=0; } When I take this code out the program just writes a lot of garbage to the display module. But then at least it starts and run's the program. There seems to be nothing wrong looking at the .asm, .rst and .lst output. Appart from a lot of extra "push ar2" and "pop ar2" lines. I'm using a snapshot from 20 march on my debian linux system. The program is supposed to write to a 16x2 LCD module connected to the p4 IO port of the 80c552 uC. The 3 control lines are connected to p10, p11 and p12. Ok : now I know why there are so many "push ar2" and "pop ar2" in the output files, I cleared the variable directly after declaring it in the top part of the program. I changed that to just before the while(1) loop and now there are just a few push and pop's in the resulting code. --------------------------------------------------------------- #include <stdio.h> #include <80c552.h> unsigned char multi[4]; void write(char getal) { p1_1=0; p4=getal; p1_2=1; p1_2=0; } void delay(int wacht) { int x; for(x=wacht;x>0;x--); } void main(void) { char teller=0; p1_0=0; write(0x38); delay(200); write(0x06); delay(100); write(0x0f); delay(100); write(0x01); delay(100); write(0x02); delay(100); p1_0=1; while(1) { write(teller+'0'); teller++; if(teller>9) { teller=0; } delay(65535); }; } -- roelof 't Hooft --------------------------------------------------------- Electronische kompassen voor navigatie in de beroepsvaart --------------------------------------------------------- I.T. Holland tel : +31 (0)172 445607 Houtweg 18 fax : +31 (0)172 436290 2461GR Ter Aar http://www.itholland.com/ Holland ro...@it... --------------------------------------------------------- |