Introducing the World's First Color LCD for AVR BASCOM Applications!
![]() |
+
|
BASCOM |
+ |
|
= |
COLOR LCD on Your BASCOM AVR Project
|
|
AVR STK500 (or any AVR board!) |
EzLCD-001 (Shown with eval Board) |
What is it? ezLCD is a low cost intelligent 2.7" 240 x 160 reflective color TFT LCD with LED front light that takes simple commands to display windows type fonts, bitmaps and intelligent graphic commands.
How much does it cost? ezLCD-001 cost $149 and can be bought online at EarthLCD.com
Do I need the ezLCD-001-EDK? Yes you should buy one because it gives you the eval board with an ezLCD and cables to hook the ezLCD-001 to hook to a P.C. for programming options, downloading fonts and upgrading firmware. Also there will be many applications for using the ezLCD as a secondary info display on a P.C. Once you have your project done you can use the eval board in the EDK for updating and testing displays. Of course after that you will design your project with direct connections to the headers on the ezLCD-001 module.
How do I hook ezLCD to my AVR STK501?
Do you have a support forum for ezLCD? Yes at http://groups.yahoo.com/group/ezlcd/
Is there sample code? Yes cut and paste the code below to your BASCOM editor. Check this website for more updates.
'*******************************************************
' ezLCD COMMAND CONSTANTS for BASCOM-AVR
' with description - single byte commands unless stated otherwise
' (C) 2004 Earth Computer Technologies, Inc. http://www.EarthLCD.com
'Revised 09/28/04 version 1.2 Tested!
'*******************************************************
Const Cls = &H21 'Clears screen by filling it with the Current Color
Const Light_on = &H22 'Turns on the light
Const Light_off = &H23 'Turns off the light
Const Set_color = &H24 'Sets the Current - 2ND COLOR BYTE REQUIRED
'
' 7 6 5 4 3 2 1 0
' +-+-+-+-+-+-+-+-+
' | B | G | R |
' +-+-+-+-+-+-+-+-+
' blue green red
'SENDING Setcolor,Green,Cls will fill entire screen with green
' The following sequence will fill the whole display with green
'
' SET_COLOR 24 hex
' GREEN 00111000 bin
' CLS 21 hex
'
Const Red = &H07
Const Green = &H38
Const Blue = &HC0
Const Yellow = &H3F
Const White = &HFF
Const Black = &H0
Const Gray = &HA4
'
Const Set_bg_color = &H34 'Sets background color - 2 BYTE COMMAND, FOLLOW WITH
COLOR
Const Set_xy = &H25 'Sets Current Position - 3 BYTE COMMAND,FOLLOW WITH X & Y
COORDINATE
Const Plot = &H26 'Description: Plots a point at Current Position in Current
Color
Const Plot_xy = &H27 'Plots a point in Current Color, at specified position,- 3
BYTE COMMAND, FOLLOW WITH X & Y COORDINATE
Const Line_to_xy = &H28 'Draws a line in Current Color, from Current Position to
specified position - 3 BYTE COMMAND, FOLLOW WITH X & Y COORDINATE
Const Circle_r = &H29 'Draws a circle in Current Color at Current Position - 2ND
RADIUS BYTE REQUIRED
Const Circle_r_fill = &H39 'Draws a filled circle in Current Color at Current
Position - 2ND RADIUS BYTE REQUIRED
Const Select_font = &H2B 'Selects Current Font - 2 BYTE COMMAND,FOLLOW WITH
FONT#
Const Print_char = &H2C 'Prints a single character - 2 BYTE COMMAND,FOLLOW WITH
CHARACTER
Const Print_string = &H2D 'Prints null-terminated String - N BYTES + NULL
REQUIRED Send ascii string folllowed by NULL (zero byte)
Const Null = &H0
Const Print_char_bg = &H3C 'Prints a single character on defined background - 2
BYTE COMMAND, FOLLOW WITH CHARACTER
Const Print_string_bg = &H3D 'Prints null-terminated String on defined
background - N BYTES REQUIRED - Send ascii string folllowed by NULL (zero byte)
Const Put_bitmap = &H2E 'Puts Bitmap on the screen Starting at Current
Position,then UP and RIGHT - N BYTES REQUIRED (CMD+BMP_WIDTH+BMP_HEIGHT+N
PIXELS)
'Total number of bytes is: width*height + 3
Const Arc = &H2F 'Draws an Arc at Current Position in Current Color - 4 BYTE
COMMAND+RADIUS+BEGIN_ARC+END_ARC (ARC ANGLE = Angle_deg * 45 / 32)
Const H_line = &H40 'Draws a horizontal line in Current Color, from Current
Position of specified length - 2 BYTE COMMAND, FOLLOW WITH LENGTH
Const V_line = &H41 'Draws a vertical line in Current Color, from Current
Position of specified length - 2 BYTE COMMAND, FOLLOW WITH LENGTH
Const Box = &H42 'Draws a box in Current Color, with upper left corner at
Current Position - 3 BYTE COMMAND, FOLLOW WITH X & Y DIMENSIONS
Const Box_fill = &H43 'Draws a filled box in Current Color, with upper left
corner at Current Position - 3 BYTE COMMAND, FOLLOW WITH X & Y DIMENSIONS
Const Picture_rom = &H50 'To be supported in firmware revision by end of 2004.
Similar to PUT_BITMAP.
'*************************************************** END ezLCD CONSTANTS
' Note ezLCD-001 shipped before Oct 2004 need to set serial port to 9600 baud
using files in F9600.zip
' sample bascom code
'---------------------------------------------------
'STK500 sample
'This sample is only intended to show how communication
'with the STK500 work
'the default xtal is 3.68 MHz
' ezLCD RX pin is connected to pin 2 of RS-232 SPARE connector on STK500 PORTD.1
thru RS-232 when using a 8515(txd pin)
' NOTE: this is done by hooking jumper cable from portd connector PD1 to RS232
SPARE TXD ON STK500
$crystal = 3680000
$baud = 9600
Doit:
Printbin Light_on ; Set_color ; Red ; Cls ; Light_on ' Make screen all red and
turn on Front Light
Printbin Set_xy ; 80 ; 80 ; Set_color ; White ; Select_font ; 1 ; Print_string ;
'Set cursor, color and do print string command
Print " ezLCD Rocks!" ; ' Print text
Printbin Null ' Sent null to signify string end
End