Ahoj,
opět jsem tu já a můj další problém. Při zobrazování měřeného napětí na lcd mi nejde zobrazit hodnotu v realném tvaru a proto jsem napsal vcelku jednoduchý program na zobrazení reálného čísla na lcd.
[code]#include <htc.h>
#include “lcd.h”
#include <stdio.h>
#define _XTAL_FREQ 8000000
void main(void)
{
TRISB = 0; // PORTB all outputs
TRISC = 0;
TRISA = 0b11111111;
float cislo;
char text[16];
lcd_init();
while(1)
{
lcd_clear();
lcd_goto(0);
lcd_puts("It's working!!!");
cislo = 12.7;
sprintf(text, "Cislo: %2.5f", cislo);
lcd_goto(64);
lcd_puts(text);
__delay_ms(100);
}
}
[/code]
Ovšem mi to vyhodí X chyb, viz výpis :
Build D:\BMAM\LCD-zkusebni\LCD-Zkusebni for device 16F690
Using driver C:\Program Files (x86)\HI-TECH Software\PICC\9.83\bin\picc.exe
Make: The target “D:\BMAM\LCD-zkusebni\lcd.p1” is up to date.
Make: The target “D:\BMAM\LCD-zkusebni\main.p1” is out of date.
Executing: “C:\Program Files (x86)\HI-TECH Software\PICC\9.83\bin\picc.exe” --pass1 D:\BMAM\LCD-zkusebni\main.c -q --chip=16F690 -P --runtime=default --opt=default -D__DEBUG=1 -g --asmlist “–errformat=Error %n] %f; %l.%c %s” “–msgformat=Advisory%n] %s” “–warnformat=Warning %n] %f; %l.%c %s”
Executing: “C:\Program Files (x86)\HI-TECH Software\PICC\9.83\bin\picc.exe” -oLCD-Zkusebni.cof -mLCD-Zkusebni.map --summary=default --output=default lcd.p1 main.p1 --chip=16F690 -P --runtime=default --opt=default -D__DEBUG=1 -g --asmlist “–errformat=Error %n] %f; %l.%c %s” “–msgformat=Advisory%n] %s” “–warnformat=Warning %n] %f; %l.%c %s”
HI-TECH C Compiler for PIC10/12/16 MCUs (Lite Mode) V9.83
Copyright © 2011 Microchip Technology Inc.
(1273) Omniscient Code Generation not available in Lite mode (warning)
Error [1347] ; 0. can’t find 0x76 words (0x76 withtotal) for psect “text536” in class “CODE” (largest unused contiguous range 0x44)
Error [1347] ; 0. can’t find 0x6E words (0x6e withtotal) for psect “text532” in class “CODE” (largest unused contiguous range 0x44)
Error [1347] ; 0. can’t find 0x6C words (0x6c withtotal) for psect “text533” in class “CODE” (largest unused contiguous range 0x44)
Error [1347] ; 0. can’t find 0x66 words (0x66 withtotal) for psect “text531” in class “CODE” (largest unused contiguous range 0x44)
Error [1347] ; 0. can’t find 0x5E words (0x5e withtotal) for psect “text535” in class “CODE” (largest unused contiguous range 0x44)
Error [1347] ; 0. can’t find 0x5A words (0x5a withtotal) for psect “maintext” in class “CODE” (largest unused contiguous range 0x44)
Error [1347] ; 0. can’t find 0x48 words (0x48 withtotal) for psect “text520” in class “CODE” (largest unused contiguous range 0x44)
Error [1347] ; 0. can’t find 0x25 words (0x25 withtotal) for psect “text525” in class “CODE” (largest unused contiguous range 0x14)
Error [1347] ; 0. can’t find 0x1D words (0x1d withtotal) for psect “text521” in class “CODE” (largest unused contiguous range 0x14)
Error [1347] ; 0. can’t find 0x1A words (0x1a withtotal) for psect “text530” in class “CODE” (largest unused contiguous range 0x14)
Error [1347] ; 0. can’t find 0x1A words (0x1a withtotal) for psect “text540” in class “CODE” (largest unused contiguous range 0x14)
Error [1347] ; 0. can’t find 0xC words (0xc withtotal) for psect “text534” in class “CODE” (largest unused contiguous range 0x3)
Error [1347] ; 0. can’t find 0xA words (0xa withtotal) for psect “text524” in class “CODE” (largest unused contiguous range 0x3)
********** Build failed! **********
Když tam dál celé číslo int a do sprintf dám %d, tak to funguje bez problému, ale zobrazit reálné čislo ne a ne.
Za připomínky děkuji.