avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Re: Passing a string variable to lcd_puts


From: David VanHorn
Subject: Re: [avr-gcc-list] Re: Passing a string variable to lcd_puts
Date: Mon, 30 Mar 2009 14:48:26 -0400

I know what *I* am missing - the source code!  How is anyone supposed to help you with your problem until you post the actual compilable code snippet?  We need a compilable code sample which demonstrates the problem, along with the compiler flags you used and also the compiler version you used.  Getting a warning for int8_t but not for "signed char" is not expected behaviour, and I think many people (as well as you) would be interested to find out if that is really the case, and if so, if there is some strange compiler issue.  But we need the code so that other people can test this.
 
Fine.. I thought I must be doing something fairly trivial wrong, this IS only my second project in C...
I expected to be told that I was using lcd_puts wrong, or declaring something improperly, or some other noob mistake.
What I'm seeing is certainly unexpected to ME.
 
I'm very reluctant to throw out bunches of code, when the problem is likely to be some trivial thing that "everyone knows".
 
 
/**************************************************************************
  Special test case for lcd_puts.
  Primary boggle: Compiler warns about mismatched signedness when I pass
  unit8_t or int8_t but accepts char.
  Secondary boggle, why does it want signed data at all?
  FWIW: Same results when targeted for M32 or M644
**************************************************************************/
//System header files (in <>s)
#include <stdint.h>   //
#include <avr/io.h>   //
#include <avr/pgmspace.h> // Ability to put strings in pgm space rather than ram
#include <util/delay.h>  // from c:\WinAVR\avr\include\util
// Application specific header files (in ""s)
#include "avr/interrupt.h" //
#include "lcd.h"    // Add lcd.c to the makefile in the SRC= ""
#ifndef F_CPU
/* prevent compiler error by supplying a default */
# warning "F_CPU not defined before MagSensor.c"
# define F_CPU 20000000
#endif
// LCD display support variables
//
#define LCD_Line_Len 16        // Actual screen char length
 // These two are accepted without warnings:
 // char LCD_String[LCD_Line_Len + 1];  // Ram buffer for LCD display
 // signed char  LCD_String[LCD_Line_Len + 1];
 // These all generate warnings.
 //../LCDtest.c:55: warning: pointer targets in passing argument 1 of 'lcd_puts' differ in signedness
 //int8_t  LCD_String[LCD_Line_Len + 1];  
 //uint8_t  LCD_String[LCD_Line_Len + 1]; 
 //unsigned char  LCD_String[LCD_Line_Len + 1]; 
 //Shouldn't int8_t be the same as signed char?
 //                                    0123456789ABCDEF
 uint8_t  BootString[]   PROGMEM = ">>> TEST MSG <<<";
void Delay_QS(void);
void main(void)

 uint8_t i=0;
 while (1){
  lcd_init(LCD_DISP_ON);    // init the display
  lcd_clrscr();     //  
  lcd_home();      //
  
  for (i=0; 16 > i; i++) {
   lcd_putc(pgm_read_byte_near(&(BootString[i]))); 
  }
 
 Delay_QS(); // Visually nicer than just dumping out
 }
}
//
//******************************************************************************************
//
// Delay_ms has a fundamental limit of 13mS at 20 MHz!
//
void Delay_QS(void)
{
 uint8_t i=0;
 for (i=0; i<25; i++){ _delay_ms(10); } 
}
 
Compiler flags:  I tried not to change this from the defaults any more than I thought absolutely necessary.
 
-Wall
-gdwarf-2
-std=gnu99
-ffreestanding
-Wextra
-Wunreachable-code
-g
-mcall-prologues
-W
-Wundef
-Wstrict-prototypes
-Wmissing-prototypes
-Wmissing-declarations
-save-temps
-mmcu=atmega644
-DF_CPU=20000000UL
-Os
-funsigned-char
-funsigned-bitfields
-fpack-struct
-fshort-enums
 
WinAVR-20081205
 
 
 
 
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]