LCD-display, driven by an I2c-IC PCF8574(A).
On the same flat cable there is a connector for a keyboard.
On the software-section you will find an example of driving 4-bits LCD through I2c.

Below: Connection of the LCD-display on the LCD-board
seen from the
component side

14 13 12 11 10 9 8 7 6 5 4 3 2 1
DB7 DB6 DB5 DB4 NC NC NC NC E R/W RS VO +5 GND

Below: Connection of a LCD with a 2 x 7 connector.
You will have to design your own LCD-board.


The VO-connection. To adjust the contrast.


I have chosen the DMC 20215A from OPTREX,
but you can also use the following LCD-displays:

Type Size Manufacturer
H2570 1 x 16 char. Hitachi
H2572 1 x 40 char. Hitachi
LM016L

2 x 16 char.

Sharp
LM018L 2 x 40 char. Sharp
LM038L 1 x 20 char. Sharp
LM1615A 1 x 16 char. Sharp
VK2116L 1 x 16 char. Vikay
LTN211F-10 2 x 16 char. Philips

Prototyping on a new LCD-displayboard. A display board with a display of 4 x 20 characters from DataVision.


Some extra info about two different LCD's

This is how I connected a PCF8574 to a LCD


Here some pictures of LCD I connected to several boards

From www.btinternet.com/~e2one I bought a 8 x 24 LCD




 

and from www.display3000.com I bought a graphic display,
here connected to the AVR Ethernet I/O board

132 x 132 pixels, 65535 colors. 11 mm thick.



 

Only 4 wires, SD, SC, CS and RS to connect the little PCB at the right to a Atmel microcontroller. And lots of nice examples in Bascom-AVR

 


ARP here in Holland is selling a very nice display, including a small sandwich board with Atmega88, max232 and a bootloader. 

ARP in Tilburg verkoopt een erg mooi 16 x 2 LCD display inclusief een printplaat met daarop een AVR Atmega88, een MAX232 en een bootloader.

And here how it works

hieronder een korte handleiding hoe het werkt

The display, 16 x 2 with green/yellow backlight
Het display, 16 x 2 met geel/groene verlichte achtergrond

And the sandwich board with all components. Atmega88 with bootloader, MAX232 for serial communication, 7805 powerregulator. 

De print die achterop het LCD is gemonteerd. Atmega88 microcontroller met daarin een bootloader en een voorbeeldprogramma, MAX232 voor seriele communicatie, 7805 voor de 5 volt spanningsverzorging.

This is the program that is inside the flash of the Atmega88. It is made with the demo version of Bascom-AVR which can be downloaded from www.mcselec.com

Hier het programma dat in het flashgeheugen van de Atmega88 zit. Het is gemaakt met de demoversie van Bascom-AVR dat is te downloaden via www.mcselec.com


$regfile = "m88def.dat"
$crystal = 8000000
$baud = 9600

Dim X As Byte

Config Lcd = 16 * 2
Config Lcdpin = Pin , Db4 = Portc.2 , Db5 = Portc.3 , Db6 = Portc.4 , Db7 = Portc.5 ,_
 E = Portc.1 , Rs = Portc.0

Cursor Off

Do

Home
Cls

Lcd "LCD-bouwpakket"
Lowerline
Lcd "ARP - Tilburg"

For X = 1 To 16
Shiftlcd Right
Waitms 500
Next X

For X = 1 To 16
Shiftlcd Left
Waitms 500
Next X

For X = 1 To 10
Display Off
Waitms 500
Display On
Waitms 500
Next X

Loop

End

Oke, nice to know, but I want to put my own text on the LCD.

Leuk om te weten, maar ik wil mijn eigen tekst op het LCD kunnen zetten.

If you download the demoversion of Bascom-AVR and install it on your PC, you can change the example code and upload it through the serial port of the sandwich board. You have to take the next steps.

Als je de demo versie van Bascom-AVR op je PC hebt geïnstalleerd dan kun je het voorbeeldprogramma naar wens aanpassen en daarna via de seriele kabel uploaden naar de print met daarop de Atmega88 microcontroller. Je dient de volgende stappen te nemen:

Choose at the Bascom-AVR options/programmer the MCS Bootloader

Kies bij de opties van Bascom-AVR, bij programmer de MCS Bootloader

Take care of the settings of the COM-port, it should be the same as the connection of your communicationcable.

Let op dat je de juiste COM-poort selecteert.

Change the example Bascom-AVR code, compile it and run the programmer.

Pas in Bascom-AVR het bovenstaande programma aan, compileer dit, en stuur het via de programmer (die geselecteerd staat op MCS Bootloader) naar het LCD-boardje.

If you start the programmer and cycle the power of the LCD-board you should see this

Als je de programmer start en even de spanning van het LCD-board afhaalt, dan dien je dit op het scherm te zien

Your new text should appear on the LCD right away.

De nieuwe tekst zou direct op het scherm dienen te verschijnen.

 


Bill of Material (from Eagle)

Stukslijst

Part Value Device Package Description 
F09HP F09HP SUB-D 
9-12V DC DC21P DCSKTP DC 2.1 mm Power Socket Positive Centre
BL PINHD-1X2 1X02 PIN HEADER 
C1 1uF CPOL-USE POLARIZED CAPACITOR, American symbol
C2 1uF CPOL-USE POLARIZED CAPACITOR, American symbol 
C3 1uF CPOL-USE POLARIZED CAPACITOR, American symbol 
C4 1uF CPOL-USE POLARIZED CAPACITOR, American symbol 
C5 100nF C-EU C1206 C1206 CAPACITOR, European symbol 
C7 100nF C-EUC1206 C1206 CAPACITOR, European symbol 
C8  100nF C-EUC1206  C1206 CAPACITOR, European symbol 
IC1 ATMEGA 88/168  ATMEGA88/168-20P DIL28-3 MICROCONTROLLER
IC3 7805 78XXS VOLTAGE REGULATOR 
IC4  MAX232  MAX232_TIN DIL16 MAX232
LCD PINHD-1X16 1X16 PIN HEADER
R1 10K R-EU_M1206 M1206 RESISTOR, European symbol 
R2 15 R-EU_M1206 M1206 RESISTOR, European symbol 
R3 10K TRIM_EU-LI10  LI10 POTENTIOMETER 
PCB    


PCB looks like this

Print ziet er zo uit

 

And this is the way it is assembled

En zo wordt ie in elkaar gezet

SMD and sockets

SMD en IC-voetjes

 

Elcos, powerconnector and potentionmeter

 

Pinheaders and DB9 female connector

 

And at last the LCD-display

 

Here some extra background information about the board
and the bootloader option....

Hier nog wat achtergrondinformatie over het sandwich board en de gebruikte bootloader. Is voor het gebruik van het board niet echt nodig, maar mocht je de smaak van Bascom-AVR te pakken krijgen en zelf aan de slag willen dan weet je waar je op moet letten.

You don't need this if you just want to work with Bascom-AVR demo and the samples. This is some extra information about the bootloader.

Je hebt onderstaand niet echt nodig, het is wat extra informatie over de bootloader.

Every AVR microcontroller uses fuse-bits. With a regular programmer it is possible to change these fusebits. On the LCD-ARP there is room to place a crystal. Now the internal RC Osc. of 8 Mhz is used, and this clock isn't divided by 8. You can however put a crystal in the socket on the board to work with a real clock. 11.059.200 hz is frequently used. If you don't want others to copy your chip (flash or EEPROM) you can set the memory lock bits. The flash or EEPROM can only be erased and reprogrammed, it can not be read. 

Elke AVR Microcontroller heeft zogenaamde fusebits. Met een 'echte'  programmer (i.p.v. een bootloader die we nu gebruiken) is het mogelijk deze fusebits aan te passen. Op het LCD-ARP board is plaats voor een extern crystal (inclusief 2 x 22 pf condensator). Nu wordt gebruik gemaakt van een interne RC oscillator van 8 Mhz. Een extern crystal van 11.059.200 hertz wordt regelmatig gebruikt op dit soort printen. Met de fusebits is het ook mogelijk om er voor te zorgen dat de inhoud van de chip niet gecopieerd kan worden. Dat doe je met de memory lock bits. De microcontroller kan dan wel opnieuw gewist worden en herprogrammeerd, hij kan echter niet worden uitgelezen.

Because we are using a bootloaderprogram to easy reprogram the example to show different text, some bytes are used in flash for the bootloader. Also we have to tell the microcontroller that it has to start with the bootloader before it runs its main program. Giving us the change to flash the new program in the microcontroller. That is done with the fusebits shown here.

Omdat we een bootloader gebruiken om een programma makkelijk via de seriele kabel in de microcontroller te kunnen zetten, worden een aantal bytes in flash gebruikt voor deze bootloader. We dienen daarvoor een aantal fusebits om te zetten. Ook geven we aan dat de microcontroller bij het opstarten eerst even deze bootloader moet starten voordat het het hoofdprogramma uitvoert.

And how does this bootloader looks like?
This bootloader is stored in a seperate part of the flash and will not be overwritten by the program you put in the microcontroller by the serial cable.

En hoe ziet die bootloader er dan uit?
Deze bootloader wordt geplaatst in een apart stuk van het flashgeheugen en zal niet worden overschreven wanneer je zelf via de seriele kabel een programma in de microcontroller zet.


'-----------------------------------------------------------------
' (c) 1995-2005, MCS
' Boot_LCD_ARP_88_9600BAUD.bas
' This Bootloader is for the BASCOM-AVR
' VERSION 3 of the BOOTLOADER.
'-----------------------------------------------------------------
'This sample will be extended to support other chips with bootloader
'The loader is supported from the IDE

$crystal = 8000000
$baud = 9600 'this loader uses serial com
'It is VERY IMPORTANT that the baud rate matches the one of the boot loader
'do not try to use buffered com as we can not use interrupts

Disable Interrupts

'$regfile = "m8def.dat"
'Const Loaderchip = 8

'$regfile = "m168def.dat"
'Const Loaderchip = 168

'$regfile = "m16def.dat"
'Const Loaderchip = 16

'$regfile = "m32def.dat"
'Const Loaderchip = 32

$regfile = "m88def.dat"
Const Loaderchip = 88

'$regfile = "m162def.dat"
'Const Loaderchip = 162

'$regfile = "m128def.dat"
'Const Loaderchip = 128

'$regfile = "m64def.dat"
'Const Loaderchip = 64

#if Loaderchip = 88 'Mega88
$loader = $c00 'this address you can find in the datasheet
'the loader address is the same as the boot vector address
Const Maxwordbit = 5
Const Maxpages = 96 - 1 ' total WORD pages available for program
Config Com1 = Dummy , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0
#endif

#if Loaderchip = 168 'Mega168
$loader = $1c00 'this address you can find in the datasheet
'the loader address is the same as the boot vector address
Const Maxpages = 112 - 1 ' total WORD pages available for program
Const Maxwordbit = 6
Config Com1 = Dummy , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0
#endif

#if Loaderchip = 32 ' Mega32
$loader = $3c00 ' 1024 words
Const Maxwordbit = 6 'Z6 is maximum bit '
Config Com1 = Dummy , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0
#endif
#if Loaderchip = 8 ' Mega8
$loader = $c00 ' 1024 words
Const Maxwordbit = 5 'Z5 is maximum bit '
Config Com1 = Dummy , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0
#endif
#if Loaderchip = 161 ' Mega161
$loader = $1e00 ' 1024 words
Const Maxwordbit = 6 'Z6 is maximum bit '
#endif
#if Loaderchip = 162 ' Mega162
$loader = $1c00 ' 1024 words
Const Maxwordbit = 6 'Z6 is maximum bit '
Config Com1 = Dummy , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0
#endif

#if Loaderchip = 64 ' Mega64
$loader = $7c00 ' 1024 words
Const Maxwordbit = 7 'Z7 is maximum bit '
Config Com1 = Dummy , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0
#endif

#if Loaderchip = 128 ' Mega128
$loader = &HFC00 ' 1024 words
Const Maxwordbit = 7 'Z7 is maximum bit '
Config Com1 = Dummy , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0
#endif

#if Loaderchip = 16 ' Mega16
$loader = $1c00 ' 1024 words
Const Maxwordbit = 6 'Z6 is maximum bit '
Config Com1 = Dummy , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0
#endif



Const Maxword =(2 ^ Maxwordbit) * 2 '128
Const Maxwordshift = Maxwordbit + 1
Const Cdbg = 0 ' leave this to 0

#if Cdbg
Print Maxword
Print Maxwordshift
' Print Maxpages
#endif



'Dim the used variables
Dim Bstatus As Byte , Bretries As Byte , Bblock As Byte , Bblocklocal As Byte
Dim Bcsum1 As Byte , Bcsum2 As Byte , Buf(128) As Byte , Csum As Byte
Dim J As Byte , Spmcrval As Byte ' self program command byte value

Dim Z As Long 'this is the Z pointer word
Dim Vl As Byte , Vh As Byte ' these bytes are used for the data values
Dim Wrd As Word , Page As Word 'these vars contain the page and word address
Dim Bkind As Byte , Bstarted As Byte
'Mega 88 : 32 words, 128 pages



Disable Interrupts 'we do not use ints


'Waitms 100 'wait 100 msec sec
'We start with receiving a file. The PC must send this binary file

'some constants used in serial com
Const Nak = &H15
Const Ack = &H06
Const Can = &H18

'we use some leds as indication in this sample , you might want to remove it
'Config Pind.7 = Output
'Portd.7 = 0

$timeout = 200000 'we use a timeout
'When you get LOADER errors during the upload, increase the timeout value
'for example at 16 Mhz, use 200000

Bretries = 5 'we try 5 times
Testfor123:
#if Cdbg
Print "Try " ; Bretries
Print "Wait"
#endif
Bstatus = Waitkey() 'wait for the loader to send a byte
#if Cdbg
Print "Got "
#endif

Print Chr(bstatus);

If Bstatus = 123 Then 'did we received value 123 ?
Bkind = 0 'normal flash loader
Goto Loader
Elseif Bstatus = 124 Then ' EEPROM
Bkind = 1 ' EEPROM loader
Goto Loader
Elseif Bstatus <> 0 Then
Decr Bretries
If Bretries <> 0 Then Goto Testfor123 'we test again
End If

For J = 1 To 10 'this is a simple indication that we start the normal reset vector
' Toggle Portd.7 : Waitms 100
Next

#if Cdbg
Print "RESET"
#endif
Goto _reset 'goto the normal reset vector at address 0


'this is the loader routine. It is a Xmodem-checksum reception routine
Loader:
#if Cdbg
Print "Clear buffer"
#endif
Do
Bstatus = Waitkey()
Loop Until Bstatus = 0


For J = 1 To 3 'this is a simple indication that we start the normal reset vector
' Toggle Portd.7 : Waitms 250
Next

If Bkind = 0 Then
Spmcrval = 3 : Gosub Do_spm ' erase the first page
Spmcrval = 17 : Gosub Do_spm ' re-enable page
End If


Bretries = 10 'number of retries

Do
Bstarted = 0 ' we were not started yet
Csum = 0 'checksum is 0 when we start
Print Chr(nak); ' firt time send a nack
Do

Bstatus = Waitkey() 'wait for statuse byte

Select Case Bstatus
Case 1: ' start of heading, PC is ready to send
Incr Bblocklocal 'increase local block count
Csum = 1 'checksum is 1
Bblock = Waitkey() : Csum = Csum + Bblock 'get block
Bcsum1 = Waitkey() : Csum = Csum + Bcsum1 'get checksum first byte
For J = 1 To 128 'get 128 bytes
Buf(j) = Waitkey() : Csum = Csum + Buf(j)
Next
Bcsum2 = Waitkey() 'get second checksum byte
If Bblocklocal = Bblock Then 'are the blocks the same?
If Bcsum2 = Csum Then 'is the checksum the same?
Gosub Writepage 'yes go write the page
Print Chr(ack); 'acknowledge
Else 'no match so send nak
Print Chr(nak);
End If
Else
Print Chr(nak); 'blocks do not match
End If
Case 4: ' end of transmission , file is transmitted
If Wrd > 0 Then 'if there was something left in the page
Wrd = 0 'Z pointer needs wrd to be 0
Spmcrval = 5 : Gosub Do_spm 'write page
Spmcrval = 17 : Gosub Do_spm ' re-enable page
End If
Print Chr(ack); ' send ack and ready

' Portd.7 = 0 ' simple indication that we are finished and ok
Waitms 20
Goto _reset ' start new program
Case &H18: ' PC aborts transmission
Goto _reset ' ready
Case 123 : Exit Do 'was probably still in the buffer
Case 124 : Exit Do
Case Else
Exit Do ' no valid data
End Select
Loop
If Bretries > 0 Then 'attempte left?
Waitms 1000
Decr Bretries 'decrease attempts
Else
Goto _reset 'reset chip
End If
Loop



'write one or more pages
Writepage:
If Bkind = 0 Then
For J = 1 To 128 Step 2 'we write 2 bytes into a page
Vl = Buf(j) : Vh = Buf(j + 1) 'get Low and High bytes
lds r0, {vl} 'store them into r0 and r1 registers
lds r1, {vh}
Spmcrval = 1 : Gosub Do_spm 'write value into page at word address
Wrd = Wrd + 2 ' word address increases with 2 because LS bit of Z is not used
If Wrd = Maxword Then ' page is full
Wrd = 0 'Z pointer needs wrd to be 0
Spmcrval = 5 : Gosub Do_spm 'write page
Spmcrval = 17 : Gosub Do_spm ' re-enable page


If Page < Maxpages Then 'only if we are not erasing the bootspace
Page = Page + 1 'next page
Spmcrval = 3 : Gosub Do_spm ' erase next page
Spmcrval = 17 : Gosub Do_spm ' re-enable page
Else
' Portd.7 = 0 : Waitms 200
End If
End If
Next

Else 'eeprom
For J = 1 To 128
Writeeeprom Buf(j) , Wrd
Wrd = Wrd + 1
Next
End If
' Toggle Portd.7 : Waitms 10 : Toggle Portd.7 'indication that we write
Return


Do_spm:
Bitwait Spmcsr.0 , Reset ' check for previous SPM complete
Bitwait Eecr.1 , Reset 'wait for eeprom

Z = Page 'make equal to page
Shift Z , Left , Maxwordshift 'shift to proper place
Z = Z + Wrd 'add word
lds r30,{Z}
lds r31,{Z+1}

#if Loaderchip = 128
lds r24,{Z+2}
sts rampz,r24 ' we need to set rampz also for the M128
#endif

Spmcsr = Spmcrval 'assign register
spm 'this is an asm instruction
nop
nop
Return


'How you need to use this program:
'1- compile this program
'2- program into chip with sample elctronics programmer
'3- select MCS Bootloader from programmers
'4- compile a new program for example M88.bas
'5- press F4 and reset your micro
' the program will now be uploaded into the chip with Xmodem Checksum
' you can write your own loader.too
'A stand alone command line loader is also available


'How to call the bootloader from your program without a reset ???
'Do
' Print "test"
' Waitms 1000
' If Inkey() = 27 Then
' Print "boot"
' Goto &H1C00
' End If
'Loop

'The GOTO will do the work, you need to specify the correct bootloader address
'this is the same as the $LOADER statement.


Some examples using the LCD_ARP - Enkele voorbeelden van handige programma's

QTH-Locator

Connect a GPS mouse with on the serial port and get Lon, Lat, Speed, Direction and QTH-location.

 

Under construction

LCD_ARP I/O-board with Ps2-keyboard connector, 
Bluetooth (BTM-112), USB (FT232RL), keys, SFH506-36 RC5 receiver and buzzer.

Top and bottom of the bare LCD_ARP I/O board

RC5 at work

Combined. LCD_ARP and LCD_ARP I/O-board and an external antenna.

Lots of I/O. Ps2-keyboard, RS232, IR, Bluetooth, USB

If you get in trouble while building the board, or while programming the microcontroller with the serial cable, just mail me and I will try to get things going. Perhaps a review this documentation.

Mocht je in de problemen komen bij het bouwen van het board, of tijdens het programmeren van de microcontroller met de seriele kabel mail me dan. Dan zal ik kijken hoe het één en ander op te lossen en wellicht de beschrijving aanpassen.