??? 02/20/08 07:54 Read: times |
#151190 - Display, C code problem |
I try to move from assembly code to C programming, so i make or i copy some small programs to train my self.
I found this program in a book and i use keil and sdcc (with some changes) to compile it. But both ,unfortunately shows some (same) wrong messages that i can not understand . Maybe you can from your expirience ,if you compile it, point me why these happen. Thanks for every help .#include <reg51.h> #define uchar unsigned char #define uint unsigned int sbit ena=0x81; sbit rs=0x82; sbit rd_wr=0x80; rd_wr=1; //i want this bit always 1 but point me wrong message void lcddatwr(uchar dbyte){ rs=1; ena=1; P1=dbyte; ena=0; rd_wr=1; } void lcdcmdwr(uchar dbyte){ rs=1; ena=1; P1=dbyte; ena=0; } void display (uchar startloc, uchar *s){ lcdcmdwr(0x80 | startloc); while(*s) {lcddatwr(*s++); } } //This funktion stil try to understand its funktionality void numdsp(uchar startloc, uint number, bit dpt){ lcdcmdwr(0x80 | startloc); uint m=1000; bit ldgzero=0; //hear shows also wrong do{ if((((number/m)>0) || (m==1)) || ((m==100) && (dpt==1))) ldgzero=1; if (ldgzero == 1) lcddatwr(number/m+'0'); else lcddatwr(' '); number %=m; if ((dpt==1) && (m==100)){ lcddatwr('.'); } }while((m/=10)>0); } void initialize(void){ lcdcmdwr(0x30); } void main(void){ uint x=0; initialize(); display(0, "test"); for(;;){ numdsp(69,x++,0); } } |
Topic | Author | Date |
Display, C code problem | 01/01/70 00:00 | |
RE: wrong messages? | 01/01/70 00:00 | |
that sounds strange | 01/01/70 00:00 | |
stranger | 01/01/70 00:00 | |
I 'know' it would not, however | 01/01/70 00:00 | |
sdcc | 01/01/70 00:00 | |
the wrong messages | 01/01/70 00:00 | |
error messages![]() | 01/01/70 00:00 |