| Author |
Message |
|
|
Posted: May 28, 2011 - 09:48 PM |
|

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 |
|
|
| |
|
|
|
|
|
Posted: May 29, 2011 - 09:13 AM |
|

Joined: Apr 28, 2011
Posts: 6
|
|
| Works very well! Thanks for posting it. |
|
|
| |
|
|
|
|
|
Posted: Jul 08, 2011 - 03:42 PM |
|


Joined: Jul 01, 2011
Posts: 14
|
|
hi,
i wanna ask about how to add LCD_UpdateRequired function to dean's code..
thanks.. |
|
|
| |
|
|
|
|
|
Posted: Jul 08, 2011 - 11:26 PM |
|


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


Joined: Jul 01, 2011
Posts: 14
|
|
oh.. okay, i'm sorry...  |
|
|
| |
|
|
|
|
|
Posted: Jul 09, 2011 - 02:23 PM |
|


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 |
_________________
|
| |
|
|
|
|
|
Posted: Jul 10, 2011 - 06:31 AM |
|


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  |
_________________ Atmel Studio 6.1 is now released, grab it here.
Report AS6/ASF bugs here.
|
| |
|
|
|
|
|
Posted: Sep 11, 2011 - 07:55 AM |
|

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
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 |
|
|
| |
|
|
|
|
|
Posted: Apr 05, 2012 - 01:28 PM |
|

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...
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 |
|
|
| |
|
|
|
|
|
Posted: Sep 30, 2012 - 06:26 PM |
|

Joined: Sep 30, 2012
Posts: 5
|
|
Will this code work with my Atmega169?
Thanks |
|
|
| |
|
|
|
|
|
Posted: Sep 30, 2012 - 06:30 PM |
|


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. |
_________________
|
| |
|
|
|
|
|
Posted: Sep 30, 2012 - 06:36 PM |
|

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 |
|
|
| |
|
|
|
|
|
Posted: Sep 30, 2012 - 06:45 PM |
|


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  |
_________________ Atmel Studio 6.1 is now released, grab it here.
Report AS6/ASF bugs here.
|
| |
|
|
|
|
|
Posted: Oct 21, 2012 - 03:07 PM |
|


Joined: Oct 21, 2012
Posts: 26
Location: India
|
|
| Thanks buddy....it helped me a lot! |
_________________ Success is optional, choose wisely!
|
| |
|
|
|
|
|
Posted: Jan 04, 2013 - 06:17 PM |
|

Joined: Oct 08, 2012
Posts: 1
|
|
| Thank you Dean for posting the LCD driver - it worked for me perfectly the first time. |
|
|
| |
|
|
|
|
|