Jeg kan selvfølgelig opdele integeren og og derefter indlæse en teksttreng med if sætninger, men det virker også som en virkelig dårlig og ikke særlig pladsbesparende kode.
[51] inputvar = 127; gram = (inputvar*196)/100; newton = (gram*982)/100;
sprintf(&buf,"%d",inputvar); lcd_puts(buf); lcd_goto(0x0C); // Gå til gram lcd_puts("123"); lcd_goto(0x4C); // Gå til newton lcd_puts(newton); DelayUs(10000); }
//unsigned int tarevar; //Tare variabel - indeholder vægt-forskydningen unsigned int inputvar; //Variabel indeholdende inputtet unsigned int gram; //Variabel vægten i gram unsigned int newton; //Variabel vægten i newton char buf[11];
void main(void) { DelayUs(1000); lcd_init(); lcd_goto(0); // select first line lcd_puts(" Gram"); lcd_goto(0x40); // Select second line lcd_puts(" Newton");
for(;;){ inputvar = 127; gram = (inputvar*196)/100; newton = (gram*982)/100;
sprintf(&buf,"%d",inputvar); lcd_puts(buf); lcd_goto(0x0C); // Gå til gram lcd_puts("123"); lcd_goto(0x4C); // Gå til newton lcd_puts(newton); DelayUs(10000); }
Warning[359] Z:\ny PIC\main.c 33 : illegal conversion between pointer types Executing: "C:\Programmer\HI-TECH Software\PICC\9.50\BIN\PICC.EXE" -E"LCD.lde" "Z:\ny PIC\delay.obj" "Z:\ny PIC\lcd.obj" "Z:\ny PIC\main.obj" -M"LCD.map" -O"LCD.cof" -O"LCD.hex" -Q -MPLAB -16F57 Advisory[1207] : some of the command line options you are using are now obsolete Advisory[1208] : use --help option or refer to the user manual for option details Error[491] : can't find 0x22 words for psect "rbss_0" in segment "BANK0" Error[491] : can't find 0x7 words for psect "temp" in segment "COMBANK" Error[593] : can't find 0x1 words (0x1 withtotal) for psect "code_ptr" in segment "BANK0" BUILD FAILED: Mon May 15 20:42:21 2006
> (1)I get this error when I'm compiling my program for a PIC:
::Can't find space for psect rbss_0 in segment BANK0 (error)
> What does this mean exactly?
It means that you have run out of space in RAM bank 0 (hence the rbss_0 name). It might also mention the class COMBANK, depending on the circumstances. What you probably need to do is move some variables into banks 1, 2 or 3. You do this by prefixing some global variable declarations with a qualifier like bank1, e.g.
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.