| ??? 10/28/03 10:10 Read: times |
#57369 - Problem regardng memory models |
Hi!
I have a problem in the following programs, please help me in this regard.actually there are two programs, when I try to compile it using tiny memory model, which is by default, the error message comes, that "non-assignable", and when I try to compile it with small or compact memory model it gives the message that, "linker error" ,please guide me to solve this problem. I am using micro c compiler from http://www.bipom.com/ the first program #include <8051io.h> /* include i/o header file */ #include <8051reg.h> #include "lcddrv.c" unsigned char count; main() { delay(100); InitLcd(); Puts("8051SBC V1.0"); goto_xy(0,1); Puts("Applied Physics"); } second program #define BUSY 0x80 #define LCD_command_write (*((unsigned char *)0x0000)) #define LCD_data_write (*((unsigned char *)0x0001)) #define LCD_command_read (*((unsigned char *)0x0002)) #define LCD_data_read (*((unsigned char *)0x0003)) #define LCD 0x0A LcdReady() { char flag; while((flag=LCD_command_read & BUSY)) { if(flag == 0xFF) return -1; } return 1; } void clr_screen(void) { LcdReady(); LCD_command_write=0x01; } char InitLcd(void) { if(-1 ==LcdReady()) return -1; LCD_command_write=0x38; LcdReady(); LCD_command_write=0x0c; clr_screen(); goto_xy(0,0); } goto_xy(char x,char y) { LcdReady(); switch(y){ case 0 : LCD_command_write=0x80+x; break; case 1 : LCD_command_write=0xC0+x; break; case 2 : LCD_command_write=0x94+x; break; case 3 : LCD_command_write=0xd4+x; break; } } char *Puts(char* str) { unsigned char i; for (i=0; str[i] != ' '; i++){ LcdReady(); LCD_data_write=str[i]; } return str; } void putch_lcd(char ch) { LcdReady(); LCD_data_write=ch; } // print 4 digits decimal on LCD at current position print_4digit(int n) { char buffer[6]; int temp; if(n<0) buffer[0] = '-'; else buffer[0] = '+'; temp = n; if(n<0) { n=~temp; n++; // convert to unsigned } buffer[1] = (n/1000)+48; temp = n%1000; buffer[2] = (temp/100)+48; temp = n%100; buffer[3] = (temp/10)+48; buffer[4] = (temp%10)+48; putch_lcd(buffer[0]); putch_lcd(buffer[1]); putch_lcd(buffer[2]); putch_lcd(buffer[3]); putch_lcd(buffer[4]); } thanks |
| Topic | Author | Date |
| Problem regardng memory models | 01/01/70 00:00 | |
| RE: Problem regardng memory models | 01/01/70 00:00 | |
Formatting | 01/01/70 00:00 |



