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
nickkennedy
PostPosted: May 28, 2011 - 09:48 PM
Rookie


Joined: Aug 26, 2008
Posts: 27
Location: Arkansas

I also had trouble getting the LCD_WriteChar() function to work until I added universalist's macro and took "static inline" off of the original definition. Which I don't understand but guess I don't need to at this point. It took me a couple of tries to see that the order of the arguments was reversed ... not sure if that was intentional.

I appreciate Dean's tutorial. I'm new to using C on MCUs although I've been playing with them in assembler for quite some time. Lots to learn! I'm pursing two paths: first, starting with tiny programs that, for example, beep the piezo sounder when the joystick is moved, and second, trying to use other people's code (such as this driver) -- which I suppose is one of the big advantages of C.

Nick
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
Flops_
PostPosted: May 29, 2011 - 09:13 AM
Newbie


Joined: Apr 28, 2011
Posts: 6


Works very well! Thanks for posting it.
 
 View user's profile Send private message  
Reply with quote Back to top
hakagiri
PostPosted: Jul 08, 2011 - 03:42 PM
Newbie


Joined: Jul 01, 2011
Posts: 14


hi,

i wanna ask about how to add LCD_UpdateRequired function to dean's code..

thanks..
 
 View user's profile Send private message  
Reply with quote Back to top
smileymicros
PostPosted: Jul 08, 2011 - 11:26 PM
Raving lunatic


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

hakagiri wrote:
hi,

i wanna ask about how to add LCD_UpdateRequired function to dean's code..

thanks..
Please start a new thread or at least continue with the thread you already started at:
http://www.avrfreaks.net/index.php?name ... 267#845267

The purpose of the tutorial threads is to discuss the tutorial, not solve unrelated problems.

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
hakagiri
PostPosted: Jul 09, 2011 - 01:56 AM
Newbie


Joined: Jul 01, 2011
Posts: 14


oh.. okay, i'm sorry... Very Happy
 
 View user's profile Send private message  
Reply with quote Back to top
clawson
PostPosted: Jul 09, 2011 - 02:23 PM
10k+ Postman


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

Quote:

The purpose of the tutorial threads is to discuss the tutorial, not solve unrelated problems.


As such I'm going to lock this thread. If anyone has anything to add to the original article PM js, plons or clawson and ask us to temporarily unlock this.

Moderator

_________________
 
 View user's profile Send private message  
Reply with quote Back to top
abcminiuser
PostPosted: Jul 10, 2011 - 06:31 AM
Moderator


Joined: Jan 23, 2004
Posts: 9816
Location: Trondheim, Norway

Quote:

i wanna ask about how to add LCD_UpdateRequired function to dean's code..


It would just be something simple like:

Code:
void LCD_UpdateRequired(void)
{
    UpdateDisplay = true;
}


Added to the driver code.

- Dean Twisted Evil

_________________
Atmel Studio 6.1 is now released, grab it here.
Report AS6/ASF bugs here.
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
Scarletpimpernal
PostPosted: Sep 11, 2011 - 07:55 AM
Rookie


Joined: Aug 28, 2007
Posts: 35


Thanks for this LCD driver, it allowed me to get characters on the screen with next to zero nowledge of C Cool
I noticed that
Code:
LCD_WAIT_FOR_SCROLL_DONE();

Does not check if the text is long enough to scroll, and if it isnt, waits forever...

For the solar hotwater controller that I am building I need the numbers (and eventially will need the arrows). I was going to ask if you could do it for me, but I have come up with a brute force hack on your code, without really understanding it too well that gives the numbers 1-5 sequentially. i.e if 3 then you get 3,2,1. I'me sure theres a much nicer way of doing it. I havnt check the 3 as R200(?) is desoldered atm


Code:

diff /usr/src/AVR/include/LCD_Driver.c /usr/src/AVR/butterfly/LCD-test/LCD_Driver.c
29a30
>       volatile uint8_t  LCDNumbers      = 5;
228,229c229,264
<     if (Byte != LCD_SPACE_OR_INVALID_CHAR)              // Null indicates invalid character or space
<       SegData = pgm_read_word(&LCD_SegTable[Byte]);   
---
>     if (Byte != LCD_SPACE_OR_INVALID_CHAR) {             // Null indicates invalid character or space
>     /* To adds pecial characters to scrolling display we have thre cases
>      * for 1-5:
>      * 1 and 2, OR 0x4 to Digit 0 and 1 (2 and 3 on LCD) respectivly
>      * 4 and 5, OR 0x2 to Digit 2 and 3 (4 and 5 on LCD) respectivly
>      * 3, set LCDDR3=0x1, as I think this is not written to for normal CSS characters
>      * Ime sure theres a better way (and there is for just 1 and 2...
>      * But ime doing this with a long list of if statements...
>      */   
>       if (LCDNumbers >= 5 && Digit == 3)
>          SegData = pgm_read_word(&LCD_SegTable[Byte])|0x2;
>       else if (LCDNumbers >= 4 && Digit == 2)
>          SegData = pgm_read_word(&LCD_SegTable[Byte])|0x2;
>       else if (LCDNumbers >= 2 && Digit == 1)
>         SegData = pgm_read_word(&LCD_SegTable[Byte])|0x4;
>       else if (LCDNumbers >= 1 && Digit == 0)
>         SegData = pgm_read_word(&LCD_SegTable[Byte])|0x4;
>       else
>         SegData = pgm_read_word(&LCD_SegTable[Byte]);        
>     }
>     else
>        if (LCDNumbers >= 5 && Digit == 3)
>          SegData = 0x2;
>       else if (LCDNumbers >= 4 && Digit == 2)
>          SegData = 0x2;
>       else if (LCDNumbers >= 2 && Digit == 1)
>         SegData = 0x4;
>       else if (LCDNumbers >= 1 && Digit == 0)
>         SegData = 0x4;
>       else
>         SegData = 0x0 ;   
>        
>    if (LCDNumbers >= 3 && Digit == 0)
>       LCDDR3 = 0x1;
>     else
>       LCDDR3 = 0x0;
253a289,300
>     UpdateDisplay = true;
>  }
>
>  /*
>   NAME:      | LCD_ShowNumbers
>   PURPOSE:   | Routine to sequentially turn on the LCD's numbers
>   ARGUMENTS: | Highest number, 0 for none
>   RETURNS:   | None
>  */
>  void LCD_ShowNumbers( uint8_t LNumbers)
>  {
>     LNumbers    = LCDNumbers;

the LCD_ShowNumbers() thing doesn't work, but setting the value LCDNumbers seems to, again due to my complete ignorance of C.

If you could improve on this and perhaps do it in a way that allowed for more general orring of bits to LCDDR* then I could try and fill in the rest to get arrows working. I can see myself doing it with another heap of if statements, which doesnt feel very eloquent.
I guess its more general to call LCD_Numbers(<number>) and have just this number appear, and as such LCD_Arrows(<number>) and have the corresponding arrow appear.

and... theres always one more thing... I would like to use portD, which means making sure that there is no way that anything gets put on segments 5,6,and 7 (All special segments except 9 are ok tho). How can I be sure of this by modifying your driver?

TIA
 
 View user's profile Send private message  
Reply with quote Back to top
Basil_87
PostPosted: Apr 05, 2012 - 01:28 PM
Newbie


Joined: Apr 05, 2012
Posts: 1


Hi there!
I've got a Butterfly, and I'm trying since fife weeks to write something on the display...
I'm new on AVR but I know the C-Language well. I've tried to make a new Project with AVRStudio 5 and copied the code from Dean (first comment) I've made a headerfile for the LDC_Driver.h but nothing works... Sad
The only thing I can do, is to put the programm which was on it at first.
I'm becoming desperate of trying...
Can somebody help, even when it's a old thread??

THX in advence
 
 View user's profile Send private message  
Reply with quote Back to top
kevinme
PostPosted: Sep 30, 2012 - 06:26 PM
Newbie


Joined: Sep 30, 2012
Posts: 5


Will this code work with my Atmega169?

Thanks
 
 View user's profile Send private message  
Reply with quote Back to top
clawson
PostPosted: Sep 30, 2012 - 06:30 PM
10k+ Postman


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

Depends if it's attached to an LCD with the same segment layout as the Atmel Butterfly or not.

However even if the segment layout is different the general technique should be adaptable.

_________________
 
 View user's profile Send private message  
Reply with quote Back to top
kevinme
PostPosted: Sep 30, 2012 - 06:36 PM
Newbie


Joined: Sep 30, 2012
Posts: 5


clawson wrote:
Depends if it's attached to an LCD with the same segment layout as the Atmel Butterfly or not.

However even if the segment layout is different the general technique should be adaptable.


Well, it is an AVR Butterly board.

Please let me know what you mean by "LCd with the same segment layout as the Atmel Butteryfly or not."

Thanks
 
 View user's profile Send private message  
Reply with quote Back to top
abcminiuser
PostPosted: Sep 30, 2012 - 06:45 PM
Moderator


Joined: Jan 23, 2004
Posts: 9816
Location: Trondheim, Norway

Quote:


Well, it is an AVR Butterly board.


This is a joke right? It's a LCD driver for the Butterfly board, which has the ATMEGA169 on it. Therefore, if you have a Butterfly board with said MEGA169 on it there's a fairly good chance it will be compatible.

- Dean Twisted Evil

_________________
Atmel Studio 6.1 is now released, grab it here.
Report AS6/ASF bugs here.
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
studyembedded
PostPosted: Oct 21, 2012 - 03:07 PM
Rookie


Joined: Oct 21, 2012
Posts: 26
Location: India

Thanks buddy....it helped me a lot!

_________________
Success is optional, choose wisely!
 
 View user's profile Send private message Visit poster's website 
Reply with quote Back to top
djpage1
PostPosted: Jan 04, 2013 - 06:17 PM
Newbie


Joined: Oct 08, 2012
Posts: 1


Thank you Dean for posting the LCD driver - it worked for me perfectly the first time.
 
 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