CONFIG LCDPIN/de

From MCS Wiki AVR
< CONFIG LCDPIN
Revision as of 01:16, 25 February 2013 by Stefanhamburg (Talk | contribs)
Jump to: navigation, search

Contents

Funktion

Überschreibt die PCD-Pin Zuordnung.

 

 

Syntax

CONFIG LCDPIN = PIN , DB4= PN,DB5=PN, DB6=PN, DB7=PN, E=PN, RS=PN  [WR=PIN] [BUSY=PIN] [MODE=mode]

CONFIG LCDPIN = PIN , PORT=PORTx, E=PN, RS=PN

 

 

Remarks

PN

The name of the PORT pin such as PORTB.2 for example.

PORTX

When you want to use the LCD in 8 bit data, pin mode, you must specify the PORT to use.

PIN

A port pin that is connected to the busy pin. The busy pin is only supported by the 20x4VFD display.

MODE

A mode for the 20x4VFD display. Options :

0 : 4 bit parallel upper nibble first

1 : 4 bit parallel lower nibble first

 

You can override the PIN selection from the Compiler Settings with this statement, so a second configuration lets you not choose more pins for a second LCD display.

 

The config command is preferred over the option settings since the code makes clear which pins are used. The CONFIG statement overrides the Options setting.

 

The PIN and MODE are only for the 20x4VFD display. See also LCDAUTODIM

 

The WR pin is optional. When you select the WR pin, an alternative library will be used. This library uses the WR pin and reads the BUSY signal from the LCD.

The library lcd4busy_anypin will be used, which is based on Luciano's LUC_lcd4busy library.

Notice that since 2040 version, the compiler will generate LCD port pin info which you can use for your own libs.

 

By default the WR pin is optional and the WR signal of the LCD should be connected to ground. This saves the pin for other purposes. When you have enough pins, you better use the WR-pin.

If you do not connect the WR pin to ground but to a pin, and you do not specify the WR pin, but you set the logic level to 0 in your code, you have to use an INITLCD command after you have set the WR pin to 0.

 

 

Siehe auch

CONFIG LCD , CONFIG LCDMODE , CONFIG LCDBUS

 

 

Beispiel


'-----------------------------------------------------------------------------------------
'name : lcd.bas
'copyright : (c) 1995-2005, MCS Electronics
'purpose : demo: LCD, CLS, LOWERLINE, SHIFTLCD, SHIFTCURSOR, HOME
' CURSOR, DISPLAY
'micro : Mega8515
'suited for demo : yes
'commercial addon needed : no
'-----------------------------------------------------------------------------------------
 
$regfile = "m8515.dat" ' Benutzter Mikrocontroller
$crystal = 4000000 ' Taktfrequenz
$baud = 19200 ' Baudrate
$hwstack = 32 ' default use 32 for the hardware stack
$swstack = 10 ' default use 10 for the SW stack
$framesize = 40 ' default use 40 for the frame space
 
 
$sim
'Entfernen Sie &&SIM wenn das Programm gebrannt werden soll !!
'$sim wird für eine schnellere Simulation verwendet.
 
 
'Anmerkung: Getestet mit PIN Mode mit 4-bit
 
'Config Lcdpin = Pin , Db4 = Portb.1 , Db5 = Portb.2 , Db6 = Portb.3 , Db7 = Portb.4 , E = Portb.5 , Rs = Portb.6
Config Lcdpin = Pin , Db4 = Porta.4 , Db5 = Porta.5 , Db6 = Porta.6 , Db7 = Porta.7 , E = Portc.7 , Rs = Portc.6
'Settings für ein STK200 in PIN Mode
'Verbinden Sie DB4 bis DB7 des LCD mit dem LCD Anschluss des STK D4-D7
'Verbinden Sie E des LCD mit A15 (PORTC.7) und NICHT mit E des LCD Anschlusses
'Vervinden Sie RS, V0, GND und =5V des LCD mit dem STK LCD Anschluss
 
Rem Mit dem config lcdpin Befehl kann man die Stanfardwerte überschreiben
 
 
Dim A As Byte
Config Lcd = 16 * 2 'Konfigurieren des LC Displays.
 
 
'Andere Optionen sind 16 * 4 and 20 * 4, 20 * 2 , 16 * 1a
'Wenn nichts angegeben wird dann wird 16 * 2 angenommen
'16 * 1a wird benutzt für 16-Zeichen Displays mit über 2 Zeilen verteilten Adressen
 
'$LCD = address    Setzt das LC-Display in 8-Bit Mode
' Benutzen Sie das für uP mit externem RAM und/oder ROM
' weil die nicht die Portpins benutzen
 
Cls 'Löschen des LCD Displays
Lcd "Hello world." 'Anzeigen des Textes in der ersten Zeile
Wait 1
Lowerline 'Positionieren auf die unterste Zeile
Wait 1
Lcd "Shift this." 'Anzeigen in unterster Zeile
Wait 1
For A = 1 To 10
Shiftlcd Right 'Text nach rechts verschieben
Wait 1 'Etwas warten
Next
 
For A = 1 To 10
Shiftlcd Left 'Text nach links verschieben
Wait 1 'Einen Moment warten
Next
 
Locate 2 , 1 'Schreibmarke setzen
Lcd "*" 'Zeichen anzeigen
Wait 1 'warten
 
Shiftcursor Right 'Schreibmnarke verschieben
Lcd "@" 'Anzeigen
Wait 1 'warten
 
Home Upper 'Obere Zeile Position 1
Lcd "Replaced." 'Test anzeigen (alten überschreiben)
Wait 1 'wait a moment
 
Cursor Off Noblink 'Schreibmarke nicht anzeigen
Wait 1 'warten
Cursor On Blink 'Schreibmarke wieder anzeigen
Wait 1 'warten
Display Off 'Display ausschalten
Wait 1 'warten
Display On 'Display einschalten
'-----------------Neue Unterstützung von 4-Zeilen LC-Displays------
Thirdline
Lcd "Line 3"
Fourthline
Lcd "Line 4"
Home Third 'Gehe zu Home der dritten Zeile
Home Fourth
Home F 'Es reicht auch der erste Buchstabe
Locate 4 , 1 : Lcd "Line 4"
Wait 1
 
'Definition benutzerdefinierter Zeichen
'Die erste Ziffer ist die Zeichennummer (0-7)
'Die anderen Zahlen sind die Zeilenwerte
'Benutzen Sie das LCD Tool und Zeichen zu erstellen und diese Zahlen einzustellen
 
Deflcdchar 1 , 225 , 227 , 226 , 226 , 226 , 242 , 234 , 228 ' replace ? with number (0-7)
Deflcdchar 0 , 240 , 224 , 224 , 255 , 254 , 252 , 248 , 240 ' replace ? with number (0-7)
Cls 'Selektiere Daten RAM
Rem Es ist wichtig, dass ein CLS nach den DEFLCDCHAR Befehlen kommt weil das den LCD-Controller wieder in den Datenmode zurücksetzt.
Lcd Chr(0) ; Chr(1) 'Ausgabe von benutzterdefinierten Zeichen
 
'----------------- Benutzung einer internen Routine ------------
_temp1 = 1 'Wert in ACC
!rCall _write_lcd 'auf LCD schreiben
End

Languages   English Deutsch  
Personal tools
Namespaces
Variants
Actions
Navigation
In other languages
Language