Forum Menu




 


Log in Problems?
New User? Sign Up!
AVR Freaks Forum Index

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
amiraliff
PostPosted: Mar 26, 2009 - 05:19 PM
Rookie


Joined: Mar 17, 2009
Posts: 35


i follow what you ask me to do and i can build it.
but the prob is the program shows warning there

Quote:
rm -rf fyp.o fyp.elf dep/* fyp.hex fyp.eep
Build succeeded with 0 Warnings...
avr-gcc.exe -mmcu=atmega169 -Wall -gdwarf-2 -DF_CPU=1000000UL -O0 -fsigned-char -std=gnu99 -MD -MP -MT fyp.o -MF dep/fyp.o.d -c ../fyp.c
In file included from ../fyp.c:2:
../LCD_Driver.h:48:8: warning: no newline at end of file
avr-gcc.exe -mmcu=atmega169 -Wall -gdwarf-2 -DF_CPU=1000000UL -O0 -fsigned-char -std=gnu99 -MD -MP -MT LCD_Driver.o -MF dep/LCD_Driver.o.d -c ../LCD_Driver.c
In file included from ../LCD_Driver.c:21:
../LCD_Driver.h:48:8: warning: no newline at end of file
../LCD_Driver.c:255:3: warning: no newline at end of file

avr-gcc.exe -mmcu=atmega169 fyp.o LCD_Driver.o -lm -o fyp.elf
avr-objcopy -O ihex -R .eeprom fyp.elf fyp.hex
avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 --no-change-warnings -O ihex fyp.elf fyp.eep || exit 0
c:\WinAVR\bin\avr-objcopy.exe: there are no sections to be copied!

AVR Memory Usage
----------------
Device: atmega169

Program: 1718 bytes (10.5% Full)
(.text + .data + .bootloader)

Data: 33 bytes (3.2% Full)
(.data + .bss + .noinit)


Build succeeded with 3 Warnings...




what the problem with that warning
 
 View user's profile Send private message  
Reply with quote Back to top
clawson
PostPosted: Mar 26, 2009 - 05:25 PM
10k+ Postman


Joined: Jul 18, 2005
Posts: 62245
Location: (using avr-gcc in) Finchingfield, Essex, England

Quote:

warning: no newline at end of file

Well what do you THINK that warning means?

_________________
 
 View user's profile Send private message  
Reply with quote Back to top
JohanEkdahl
PostPosted: Mar 26, 2009 - 05:26 PM
10k+ Postman


Joined: Mar 27, 2002
Posts: 18537
Location: Lund, Sweden

Quote:

what the problem with that warning

The problem is exactly what the warning says. There is no newline at the end of the file. How can that be unclear?

IIRC this can be a problem for the some compilers (not seeing the last token in the file). The simple remedy is to edit those files. Go to the last line. Place the caret after that last character on the line. Hit enter. Save the file and exit. Repeat for all files that generate the warning.
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
amiraliff
PostPosted: Mar 26, 2009 - 05:29 PM
Rookie


Joined: Mar 17, 2009
Posts: 35


i follow what you ask me to do and i can build it.
but the prob is the program shows warning there

Quote:
rm -rf fyp.o fyp.elf dep/* fyp.hex fyp.eep
Build succeeded with 0 Warnings...
avr-gcc.exe -mmcu=atmega169 -Wall -gdwarf-2 -DF_CPU=1000000UL -O0 -fsigned-char -std=gnu99 -MD -MP -MT fyp.o -MF dep/fyp.o.d -c ../fyp.c
In file included from ../fyp.c:2:
../LCD_Driver.h:48:8: warning: no newline at end of file
avr-gcc.exe -mmcu=atmega169 -Wall -gdwarf-2 -DF_CPU=1000000UL -O0 -fsigned-char -std=gnu99 -MD -MP -MT LCD_Driver.o -MF dep/LCD_Driver.o.d -c ../LCD_Driver.c
In file included from ../LCD_Driver.c:21:
../LCD_Driver.h:48:8: warning: no newline at end of file
../LCD_Driver.c:255:3: warning: no newline at end of file

avr-gcc.exe -mmcu=atmega169 fyp.o LCD_Driver.o -lm -o fyp.elf
avr-objcopy -O ihex -R .eeprom fyp.elf fyp.hex
avr-objcopy -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 --no-change-warnings -O ihex fyp.elf fyp.eep || exit 0
c:\WinAVR\bin\avr-objcopy.exe: there are no sections to be copied!

AVR Memory Usage
----------------
Device: atmega169

Program: 1718 bytes (10.5% Full)
(.text + .data + .bootloader)

Data: 33 bytes (3.2% Full)
(.data + .bss + .noinit)


Build succeeded with 3 Warnings...




what the problem with that warning
 
 View user's profile Send private message  
Reply with quote Back to top
clawson
PostPosted: Mar 26, 2009 - 05:31 PM
10k+ Postman


Joined: Jul 18, 2005
Posts: 62245
Location: (using avr-gcc in) Finchingfield, Essex, England

I'm out.

_________________
 
 View user's profile Send private message  
Reply with quote Back to top
amiraliff
PostPosted: Mar 26, 2009 - 08:13 PM
Rookie


Joined: Mar 17, 2009
Posts: 35


sorry about the double post..
internet connection at my place so slow so it cause error like that

anyway thanks for the advice
my program now work properly without warning
you are really nice people
 
 View user's profile Send private message  
Reply with quote Back to top
amiraliff
PostPosted: Mar 30, 2009 - 07:34 PM
Rookie


Joined: Mar 17, 2009
Posts: 35


Hye,
I have compile both keypad and lcd butterfly code C in a AVR Studio without warning and error.
But after i downloaded to AVR there was a buzzing sound appear.
Why is it happened?? Is it my coding mistake or AVR problem?

I attach the code for reference. Hope someone can help.. Crying or Very sad
 
 View user's profile Send private message  
Reply with quote Back to top
smileymicros
PostPosted: Mar 30, 2009 - 08:28 PM
Raving lunatic


Joined: Nov 17, 2004
Posts: 6137
Location: Great Smokey Mountains.

Look at the Butterfly schematic to see which pin is attached to the piezo element (buzzer) then note which part of you code is toggling that pin at an audio frequency.

Smiley

_________________
FREE TUTORIAL: 'Quick Start Guide for Using the WinAVR C Compiler with ATMEL's AVR Butterfly' AVAILABLE AT: http://www.smileymicros.com
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
amiraliff
PostPosted: Apr 02, 2009 - 04:52 PM
Rookie


Joined: Mar 17, 2009
Posts: 35


i already change my keypad from PORTB to PORTD and i don't hear any "buzzing" sound.

but my problem now is the LCD doesn't show anything when i download the program to AVR

i'm using LCD driver which i get on the 1st thread of this forum

could anybody help me
 
 View user's profile Send private message  
Reply with quote Back to top
smileymicros
PostPosted: Apr 02, 2009 - 05:00 PM
Raving lunatic


Joined: Nov 17, 2004
Posts: 6137
Location: Great Smokey Mountains.

You really need to look at the Butterfly schematic.

Also read:
http://www.smileymicros.com/download/Bu ... tion=62:62

Smiley

_________________
FREE TUTORIAL: 'Quick Start Guide for Using the WinAVR C Compiler with ATMEL's AVR Butterfly' AVAILABLE AT: http://www.smileymicros.com
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
amiraliff
PostPosted: Apr 04, 2009 - 03:42 PM
Rookie


Joined: Mar 17, 2009
Posts: 35


i already look the butterfly schematic but i still got the problem..

my keypad cannot sent data to buttefly lcd

this is my keypad code
Quote:

#include <avr/io.h>

int main()

{

//high nibble for output(columns) low for input(rows);

DDRB=0xF0;

//enable internal pullups for PB0-PB3

PORTB=0x0F;

//Port D for indication only

DDRD=0xFF;

while (1) //loop key check forever

{

//first column

PORTB =0b01111111;

//check for rows and send key number to portD

//instead sending key number to PORTD you can use

// any function that serves pressed button

if (bit_is_set(PINB, 3)) PORTD=1;

if (bit_is_set(PINB, 2)) PORTD=2;

if (bit_is_set(PINB, 1)) PORTD=3;

if (bit_is_set(PINB, 0)) PORTD=4;

//second column

PORTB =0b10111111;

if (bit_is_set(PINB, 3)) PORTD=5;

if (bit_is_set(PINB, 2)) PORTD=6;

if (bit_is_set(PINB, 1)) PORTD=7;

if (bit_is_set(PINB, 0)) PORTD=8;

//third column

PORTB =0b11011111;

if (bit_is_set(PINB, 3)) PORTD=9;

if (bit_is_set(PINB, 2)) PORTD=10;

if (bit_is_set(PINB, 1)) PORTD=11;

if (bit_is_set(PINB, 0)) PORTD=12;

//fourth column

PORTB =0b11101111;

if (bit_is_set(PINB, 3)) PORTD=13;

if (bit_is_set(PINB, 2)) PORTD=14;

if (bit_is_set(PINB, 1)) PORTD=15;

if (bit_is_set(PINB, 0)) PORTD=16;

}

}



what's the problem of this code because i can compile it on avr studio

is there any additional connection to interface this keypad and this butterfly lcd??

i really appreciate your kindest to help me find this problem
 
 View user's profile Send private message  
Reply with quote Back to top
smileymicros
PostPosted: Apr 04, 2009 - 05:22 PM
Raving lunatic


Joined: Nov 17, 2004
Posts: 6137
Location: Great Smokey Mountains.

I must be misunderstanding your question since both the Butterfly schematics and the 'Butterfly Alternate Pin Uses' document that I provided a link to for you both show that PORTD is connected to the PORTD pad AND to 8 of the LCD pins - so as one should see on the schematic or read in the document, you cannot use PORTD for both the LCD and as an input port at the same time.

And I just looked at your code and now my question is: what function in your code is sending data to the LCD? Earlier you said you changed your keypad from PORTB to PORTD and the buzzing stopped, but your code doesn't show this. Were you trying to turn on individual LCD elements with the write to PORTD?

And looking further back, I see that Dean suggested you use his LCD driver, so now I'm even more confused about what you are asking.

Please answer:
1. Did you try to use Dean's driver?
2. If so, why doe's it not show up in you code listing?
3. If you read the Butterfly Schematics how could you not know that your code would cause the Piezo element to buzz?
4. You said that after you changed ports the buzzing stopped, but you show the same code unchanged?
4. And if you read the Schematics and the Alternate Pin Use document, how could you not know that moving the keypad to PORTD would interfere with the LCD?

Again, I must be missing something in your question.

Smiley

_________________
FREE TUTORIAL: 'Quick Start Guide for Using the WinAVR C Compiler with ATMEL's AVR Butterfly' AVAILABLE AT: http://www.smileymicros.com
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
amiraliff
PostPosted: Apr 05, 2009 - 08:33 AM
Rookie


Joined: Mar 17, 2009
Posts: 35


oh sorry..
i didn't mention it to you before..
after read the schematic i know that the Piezo element is in PINB5.
It's true that in the early i try to connect my keypad to PORTD but after reading the schematic, i change it back to PORTB because i realize PORTD will interfere the LCD.

my answer for your question..

1. yes, i 'm using dean's driver.
2. i send you the full code of my program include Dean's driver.
3. i already ask my friends.they said maybe the connection from the keypad to butterfly makes the buzzing sound.
your question 4 and 5 i already explain at above

sorry again because sending you the not update program

here i send you my new program

hope i already answer your question..

thanks
 
 View user's profile Send private message  
Reply with quote Back to top
smileymicros
PostPosted: Apr 05, 2009 - 05:08 PM
Raving lunatic


Joined: Nov 17, 2004
Posts: 6137
Location: Great Smokey Mountains.

Your keypad.c code:
Code:
#include <avr/io.h>
#include "LCD_Driver.h"

int main()

{

//high nibble for output(columns) low for input(rows);

DDRD=0xF0;

//enable internal pullups for PB0-PB3

PORTD=0x0F;

//Port D for indication only

DDRB=0xFF;

while (1) //loop key check forever

   {

      //first column

      PORTD =0b01111111;

      //check for rows and send key number to portD

      //instead sending key number to PORTD you can use

      // any function that serves pressed button

      if (bit_is_set(PIND, 3)) PORTB=1;

      if (bit_is_set(PIND, 2)) PORTB=2;

      if (bit_is_set(PIND, 1)) PORTB=3;

      if (bit_is_set(PIND, 0)) PORTB=4;

      //second column

      PORTD =0b10111111;

      if (bit_is_set(PIND, 3)) PORTB=5;

      if (bit_is_set(PIND, 2)) PORTB=6;

      if (bit_is_set(PIND, 1)) PORTB=7;

      if (bit_is_set(PIND, 0)) PORTB=8;

      //third column

      PORTD =0b11011111;

      if (bit_is_set(PIND, 3)) PORTB=9;

      if (bit_is_set(PIND, 2)) PORTB=10;

      if (bit_is_set(PIND, 1)) PORTB=11;

      if (bit_is_set(PIND, 0)) PORTB=12;

      //fourth column

      PORTD =0b11101111;

      if (bit_is_set(PIND, 3)) PORTB=13;

      if (bit_is_set(PIND, 2)) PORTB=14;

      if (bit_is_set(PIND, 1)) PORTB=15;

      if (bit_is_set(PIND, 0)) PORTB=16;

   }

}
Now I know I'm missing your question because this code has nothing in it that uses Dean's LCD code. I thought your question was about getting the output of a keypad to show on a the Butterfly LCD using Dean's code, but I don't see anywhere that you use Dean's code, so what am I missing?

Smiley

_________________
FREE TUTORIAL: 'Quick Start Guide for Using the WinAVR C Compiler with ATMEL's AVR Butterfly' AVAILABLE AT: http://www.smileymicros.com
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
amiraliff
PostPosted: Apr 06, 2009 - 09:08 AM
Rookie


Joined: Mar 17, 2009
Posts: 35


sorry..
i really confuse now..
what do you mean by this keypad code has nothing in it that uses Dean's LCD code.
am i using a wrong coding for this keypad?
what the function of #include "LCD_Driver.h"

if my keypad program is wrong, can you help and guide me how to make my project works or can you give some suggestion what link should i go and guidelines to settle this problem

thanks Confused
 
 View user's profile Send private message  
Reply with quote Back to top
clawson
PostPosted: Apr 06, 2009 - 10:28 AM
10k+ Postman


Joined: Jul 18, 2005
Posts: 62245
Location: (using avr-gcc in) Finchingfield, Essex, England

Quote:

what do you mean by this keypad code has nothing in it that uses Dean's LCD code.

Just #include'ing a .h file does NOT make use of any of the facilities it provides. This only happens when you call one or more of the functions that it documents.

To USE the LCD library you should be calling LCD_Init() near the start of your program and then later (probably) LCD_puts() to put message strings on the display. Otherwise what were you expecting to see on the display?

Cliff

_________________
 
 View user's profile Send private message  
Reply with quote Back to top
smileymicros
PostPosted: Apr 06, 2009 - 06:09 PM
Raving lunatic


Joined: Nov 17, 2004
Posts: 6137
Location: Great Smokey Mountains.

amiraliff wrote:
sorry..
i really confuse now..
what do you mean by this keypad code has nothing in it that uses Dean's LCD code.
am i using a wrong coding for this keypad?
what the function of #include "LCD_Driver.h"

if my keypad program is wrong, can you help and guide me how to make my project works or can you give some suggestion what link should i go and guidelines to settle this problem

thanks Confused


Please read:
http://www.avrfreaks.net/index.php?name ... mp;t=70673
Then get the Butterfly Quick Start Guide from my website along with the Butterfly FAQ and a few other free and helpful documents that you can use to get started. I would further suggest you look at some of the source code I provide and at the Smiley's Workshops to learn the fundamentals before attempting a keypad.

After reading all this then if you have additional questions please start a new thread on using a keypad with a Butterfly. This tread is not the appropriate place for this discussion.

Smiley

_________________
FREE TUTORIAL: 'Quick Start Guide for Using the WinAVR C Compiler with ATMEL's AVR Butterfly' AVAILABLE AT: http://www.smileymicros.com
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
amiraliff
PostPosted: Apr 24, 2009 - 05:41 PM
Rookie


Joined: Mar 17, 2009
Posts: 35


hi again
im having a problem with dean's lcd driver

when i try to compile this driver, there is an error's appear

Quote:
c:/winavr/bin/../lib/gcc/avr/4.1.1/../../../../avr/lib/avr5/crtm169p.oSad.init9+0x0): undefined reference to `main'
make: *** [lcd.elf] Error 1


hope u guys out there can help me
 
 View user's profile Send private message  
Reply with quote Back to top
clawson
PostPosted: Apr 24, 2009 - 06:24 PM
10k+ Postman


Joined: Jul 18, 2005
Posts: 62245
Location: (using avr-gcc in) Finchingfield, Essex, England

Well that's telling you that no where in the files being compiled is there a function called main() - all C programs must have this.

_________________
 
 View user's profile Send private message  
Reply with quote Back to top
amiraliff
PostPosted: Apr 24, 2009 - 06:45 PM
Rookie


Joined: Mar 17, 2009
Posts: 35


oh...

so where should i put the main() function

i try to write it but there still have an error

so can u tell me where the best place i should write this function
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits