Problem with library

Hi,

Thanks a lot for accepting myself in this wonderful forum!!

I realize a project that already exists " LTC2400 precission voltmeter ". The problem is that when I am going to compile the sketch with the IDE1.0.4 (I have tried with several IDE and the same thing happens), indicates me:

LTC2400_ADC_UARTLCD_out:20: error: ‘UARTLCD’ does not name a type
LTC2400_ADC_UARTLCD_out.ino: In function ‘void setup()’:
LTC2400_ADC_UARTLCD_out:43: error: ‘uartlcd’ was not declared in this scope

The code is:

//LTC2400 24bit ADC Module
//
//Application Demo: 7 digit voltmeter interfacing with CTE UART TFT LCD
//24bit ADC IC: LTC2400
//4.096 precision reference: TI REF3040
//
//By coldtears electronics
//
//LTC2400 code is adapted from Martin Nawrath
//Kunsthochschule fuer Medien Koeln
//Academy of Media Arts Cologne
//
//UART TFT Library from coldtears electronics is used
//as to display results

#include <UARTLCD.h>
#include <Stdio.h>
#include<stdlib.h>

UARTLCD uartlcd(true,false); //(single wire mode,checksum enable)

#ifndef cbi
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
#endif
#ifndef sbi
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))
#endif

#define LTC_CS 2 // LTC2400 Chip Select Pin on Portb 2
#define LTC_MISO 4 // LTC2400 SDO Select Pin on Portb 4
#define LTC_SCK 5 // LTC2400 SCK Select Pin on Portb 5

void setup() {

cbi(PORTB,LTC_SCK); // LTC2400 SCK low
sbi (DDRB,LTC_CS); // LTC2400 CS HIGH

cbi (DDRB,LTC_MISO);
sbi (DDRB,LTC_SCK);

Serial.begin(38400);
uartlcd.Clr_screen(BLACK); delay(400); //Clear screen Black color
uartlcd.Clr_screen(BLACK); delay(400); //Clear screen Black color
uartlcd.Draw_image(412,15,6); delay(100);
uartlcd.Draw_text(BLACK, PURPLE,“LTC2400 24bit”, 100, 4, 319,230, 6); delay(70);
uartlcd.Draw_text(BLACK, CYAN,"ADC Module ", 110, 35, 319,230, 6); delay(70);

// init SPI Hardware
sbi(SPCR,MSTR) ; // SPI master mode
sbi(SPCR,SPR0) ; // SPI speed
sbi(SPCR,SPR1); // SPI speed
sbi(SPCR,SPE); //SPI enable

//Serial.println(“LTC2400 ADC Test”);

}
float volt;
float v_ref=4.094; // Reference Voltage, 5.0 Volt for LT1021 or 3.0 for LP2950-3

long int ltw = 0; // ADC Data ling int
int cnt; // counter
byte b0; //
byte sig; // sign bit flag
char st1[20]; // float voltage text

/********************************************************************/
void loop() {

cbi(PORTB,LTC_CS); // LTC2400 CS Low
delayMicroseconds(1);
if (!(PINB & (1 << 4))) { // ADC Converter ready ?
// cli();
ltw=0;
sig=0;

b0 = SPI_read(); // read 4 bytes adc raw data with SPI
if ((b0 & 0x20) ==0) sig=1; // is input negative ?
b0 &=0x1F; // discard bit 25…31
ltw |= b0;
ltw <<= 8;
b0 = SPI_read();
ltw |= b0;
ltw <<= 8;
b0 = SPI_read();
ltw |= b0;
ltw <<= 8;
b0 = SPI_read();
ltw |= b0;

delayMicroseconds(1);

sbi(PORTB,LTC_CS); // LTC2400 CS Low

if (sig) ltw |= 0xf0000000; // if input negative insert sign bit
ltw=ltw/16; // scale result down , last 4 bits have no information
volt = ltw * v_ref / 16777216; // max scale
char tmp[10];
dtostrf(volt,6,6,tmp);
tmp[8]=‘V’;
tmp[9]=’\n’;
// Serial.print(cnt++);
// Serial.print("; “);
// printFloat(volt,6); // print voltage as floating number
// Serial.println(” ");
uartlcd.Draw_text(BLACK, YELLOW,tmp, 10, 100, 319, 220, 9); delay(50);

}
sbi(PORTB,LTC_CS); // LTC2400 CS hi
delay(20);

}
//
byte SPI_read()
{
SPDR = 0;
while (!(SPSR & (1 << SPIF))) ; /* Wait for SPI shift out done */
return SPDR;
}
/
/
// printFloat from tim / Arduino: Playground
// printFloat prints out the float ‘value’ rounded to ‘places’ places
//after the decimal point
void printFloat(float value, int places) {
// this is used to cast digits
int digit;
float tens = 0.1;
int tenscount = 0;
int i;
float tempfloat = value;

// if value is negative, set tempfloat to the abs value

// make sure we round properly. this could use pow from
//<math.h>, but doesn’t seem worth the import
// if this rounding step isn’t here, the value 54.321 prints as

// calculate rounding term d: 0.5/pow(10,places)
float d = 0.5;
if (value < 0)
d *= -1.0;
// divide by ten for each decimal place
for (i = 0; i < places; i++)
d/= 10.0;
// this small addition, combined with truncation will round our

tempfloat += d;

if (value < 0)
tempfloat *= -1.0;
while ((tens * 10.0) <= tempfloat) {
tens *= 10.0;
tenscount += 1;
}

// write out the negative if needed
if (value < 0)
Serial.print(’-’);

if (tenscount == 0)
Serial.print(0, DEC);

for (i=0; i< tenscount; i++) {
digit = (int) (tempfloat/tens);
Serial.print(digit, DEC);
tempfloat = tempfloat - ((float)digit * tens);
tens /= 10.0;
}

// if no places after decimal, stop now and return
if (places <= 0)
return;

// otherwise, write the point and continue on
Serial.print(’,’);

for (i = 0; i < places; i++) {
tempfloat *= 10.0;
digit = (int) tempfloat;
Serial.print(digit,DEC);
// once written, subtract off that digit
tempfloat = tempfloat - (float) digit;
}
}

I use ARDUINO UNO and 2.2" UART TFT serial.

Can help me please!!

Thanksss

LTC2400_ADC_UARTLCD_out.ino (4.82 KB)

Is there an example sketch for that UARTLCD library that works?

Where did you get the library? Where did you put the library?

One of the stupidest things things that the Arduino team has ever done was to make the failure to find an include file a warning instead of a fatal error as it is on EVERY other system, and then to compound that folly by suppressing warnings (because their code is so crappy).

One of the stupidest things things that the Arduino team has ever done was to make the failure to find an include file a warning instead of a fatal error as it is on EVERY other system …

They didn’t want to annoy beginners with lots of error messages, Paul. :wink:

@DJHERTZ: Welcome to the forum! We hope you enjoy your stay here. Please start by reading:

How to use this forum

Read this before posting a programming question

And then:

Please edit your post, select the code, and put it between [code][glow=yellw,2300]/code[/glow]] tags.

You can do that by hitting the “Code” icon above the posting area. It is the first icon, with the symbol: </>

PaulS:
failure to find an include file a warning instead of a fatal error

Are you sure?

#include <asdf.h>
void setup() {}
void loop() {}
sketch_sep20a.ino:1:18: fatal error: asdf.h: No such file or directory

PaulS:
compound that folly by suppressing warnings (because their code is so crappy).

It’s probably crappy because they have their warnings suppressed :slight_smile: Seriously though I have never run into a warning I couldn’t get rid of and I’m an amateur. I’m know there are cases where a warning just has to be ignored but I’m pretty sure a lot of these warnings in the official libraries could be fixed. I like to see no red in the output window when I compile with warnings set to All.

Are you sure?

After enough complaints, later versions of the IDE restored the fatal error status.

I'm know there are cases where a warning just has to be ignored but I'm pretty sure a lot of these warnings in the official libraries could be fixed.

They could. And there are plenty of volunteers to do it. But, the offers to help have never been accepted.

I like to see no red in the output window when I compile with warnings set to All.

In later versions of the IDE, you have the option to set the level. In earlier versions you didn't.

PaulS:
In later versions of the IDE, you have the option to set the level. In earlier versions you didn't.

And if someone could explain the difference between:

  • Default
  • None
  • More
  • All

I would be obliged.

[quote author=Nick Gammon date=1442788957 link=msg=2404927]
And if someone could explain the difference[/quote]
From the Arduino AVR boards platform.txt:

compiler.warning_flags.none=-w
compiler.warning_flags.default=
compiler.warning_flags.more=-Wall
compiler.warning_flags.all=-Wall -Wextra

compiler.warning_flags.more=-Wall
compiler.warning_flags.all=-Wall -Wextra

So more means all, and all means more than all. I get it. Is the IDE team ever going to get their heads out of there asses and do anything right?

I changed the setting on my IDE once, and now can’t remember what the original one was. Was it default?

Nick, how's it going? Are you well?

none and all, can't tell the difference?? Did a spider bite you? Maybe not, you're still alive!

default is whatever the IDE started as.
more is more than none or default

The default is None :o

Even simpler. :smiling_imp:

Wait, what? The default is not "default"?

Oh, come on.

IDE default is no warnings.

IDE 'Default' means compiler's default, no command line -Wxxx options, which produces some warnings.

Clear, huh? ;D

PaulS:
So more means all, and all means more than all. I get it. Is the IDE team ever going to get their heads out of there asses and do anything right?

You're barking up the wrong tree. You should rather blame whoever named the compiler options: -Wall does not mean every possible warning, neither does -Wall -Wextra.

Note that some warning flags are not implied by -Wall. Some of them warn about constructions that users generally do not consider questionable, but which occasionally you might wish to check for; others warn about constructions that are necessary or hard to avoid in some cases, and there is no simple way to modify the code to suppress the warning. Some of them are enabled by -Wextra but many of them must be enabled individually.

oqibidipo:
Clear, huh? ;D

Absolutely.

"We have clearence, Clarence."

@GoForSmoke - your (I presume now deleted) answer was also funny. :slight_smile:

Did a spider bite you?

Not recently. Although you have to watch out for those red-back spiders. :wink:

It's just on page 1. Was that a hint it should become hard to find? :smiling_imp:

Red back, black spider with the red hourglass? The male-eating feminist spider?

GoForSmoke:
It's just on page 1. Was that a hint it should become hard to find? :smiling_imp:

Oh, I see. I got the notification late yesterday, and couldn't find it on page 2. This forum does weird things with notifications. I got 7 notifications about a single reply yesterday in another thread.