CONFIG LCDPIN/de

(Difference between revisions)
Jump to: navigation, search
m (1 revision)
(Example)
Line 92: Line 92:
 
<span style="font-family: Arial;">&nbsp;</span>
 
<span style="font-family: Arial;">&nbsp;</span>
  
= <span class="f_Header">Example</span> =
+
= <span class="f_Header">Beispiel</span> =
  
 
<br/><source lang="bascomavr">
 
<br/><source lang="bascomavr">
Line 105: Line 105:
 
'-----------------------------------------------------------------------------------------
 
'-----------------------------------------------------------------------------------------
 
   
 
   
$regfile = "m8515.dat" ' specify the used micro
+
$regfile = "m8515.dat" ' Benutzter Mikrocontroller
$crystal = 4000000 ' used crystal frequency
+
$crystal = 4000000 ' Taktfrequenz
$baud = 19200 ' use baud rate
+
$baud = 19200 ' Baudrate
 
$hwstack = 32 ' default use 32 for the hardware stack
 
$hwstack = 32 ' default use 32 for the hardware stack
 
$swstack = 10 ' default use 10 for the SW stack
 
$swstack = 10 ' default use 10 for the SW stack
Line 114: Line 114:
 
   
 
   
 
$sim
 
$sim
'REMOVE the above command for the real program !!
+
'Entfernen Sie &&SIM wenn das Programm gebrannt werden soll !!
'$sim is used for faster simulation
+
'$sim wird für eine schnellere Simulation verwendet.
 
   
 
   
 
   
 
   
'note : tested in PIN mode with 4-bit
+
'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 = 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
 
Config Lcdpin = Pin , Db4 = Porta.4 , Db5 = Porta.5 , Db6 = Porta.6 , Db7 = Porta.7 , E = Portc.7 , Rs = Portc.6
'These settings are for the STK200 in PIN mode
+
'Settings für ein STK200 in PIN Mode
'Connect only DB4 to DB7 of the LCD to the LCD connector of the STK D4-D7
+
'Verbinden Sie DB4 bis DB7 des LCD mit dem LCD Anschluss des STK D4-D7
'Connect the E-line of the LCD to A15 (PORTC.7) and NOT to the E line of the LCD connector
+
'Verbinden Sie E des LCD mit A15 (PORTC.7) und NICHT mit E des LCD Anschlusses
'Connect the RS, V0, GND and =5V of the LCD to the STK LCD connector
+
'Vervinden Sie RS, V0, GND und =5V des LCD mit dem STK LCD Anschluss
 
   
 
   
Rem with the config lcdpin statement you can override the compiler settings
+
Rem Mit dem config lcdpin Befehl kann man die Stanfardwerte überschreiben
 
   
 
   
 
   
 
   
 
Dim A As Byte
 
Dim A As Byte
Config Lcd = 16x2 'configure lcd screen
+
Config Lcd = 16 * 2 'Konfigurieren des LC Displays.
 
   
 
   
 
   
 
   
'other options are 16 * 4 and 20 * 4, 20 * 2 , 16 * 1a
+
'Andere Optionen sind 16 * 4 and 20 * 4, 20 * 2 , 16 * 1a
'When you dont include this option 16 * 2 is assumed
+
'Wenn nichts angegeben wird dann wird 16 * 2 angenommen
'16 * 1a is intended for 16 character displays with split addresses over 2 lines
+
'16 * 1a wird benutzt für 16-Zeichen Displays mit über 2 Zeilen verteilten Adressen
 
   
 
   
'$LCD = address will turn LCD into 8-bit databus mode
+
'$LCD = address   Setzt das LC-Display in 8-Bit Mode
' use this with uP with external RAM and/or ROM
+
' Benutzen Sie das für uP mit externem RAM und/oder ROM
' because it aint need the port pins !
+
' weil die nicht die Portpins benutzen
 
   
 
   
Cls 'clear the LCD display
+
Cls 'Löschen des LCD Displays
Lcd "Hello world." 'display this at the top line
+
Lcd "Hello world." 'Anzeigen des Textes in der ersten Zeile
 
Wait 1
 
Wait 1
Lowerline 'select the lower line
+
Lowerline 'Positionieren auf die unterste Zeile
 
Wait 1
 
Wait 1
Lcd "Shift this." 'display this at the lower line
+
Lcd "Shift this." 'Anzeigen in unterster Zeile
 
Wait 1
 
Wait 1
 
For A = 1 To 10
 
For A = 1 To 10
Shiftlcd Right 'shift the text to the right
+
Shiftlcd Right 'Text nach rechts verschieben
Wait 1 'wait a moment
+
Wait 1 'Etwas warten
 
Next
 
Next
 
   
 
   
 
For A = 1 To 10
 
For A = 1 To 10
Shiftlcd Left 'shift the text to the left
+
Shiftlcd Left 'Text nach links verschieben
Wait 1 'wait a moment
+
Wait 1 'Einen Moment warten
 
Next
 
Next
 
   
 
   
Locate 2 , 1 'set cursor position
+
Locate 2 , 1 'Schreibmarke setzen
Lcd "*" 'display this
+
Lcd "*" 'Zeichen anzeigen
Wait 1 'wait a moment
+
Wait 1 'warten
 
   
 
   
Shiftcursor Right 'shift the cursor
+
Shiftcursor Right 'Schreibmnarke verschieben
Lcd "@" 'display this
+
Lcd "@" 'Anzeigen
Wait 1 'wait a moment
+
Wait 1 'warten
 
   
 
   
Home Upper 'select line 1 and return home
+
Home Upper 'Obere Zeile Position 1
Lcd "Replaced." 'replace the text
+
Lcd "Replaced." 'Test anzeigen (alten überschreiben)
 
Wait 1 'wait a moment
 
Wait 1 'wait a moment
 
   
 
   
Cursor Off Noblink 'hide cursor
+
Cursor Off Noblink 'Schreibmarke nicht anzeigen
Wait 1 'wait a moment
+
Wait 1 'warten
Cursor On Blink 'show cursor
+
Cursor On Blink 'Schreibmarke wieder anzeigen
Wait 1 'wait a moment
+
Wait 1 'warten
Display Off 'turn display off
+
Display Off 'Display ausschalten
Wait 1 'wait a moment
+
Wait 1 'warten
Display On 'turn display on
+
Display On 'Display einschalten
'-----------------NEW support for 4-line LCD------
+
'-----------------Neue Unterstützung von 4-Zeilen LC-Displays------
 
Thirdline
 
Thirdline
 
Lcd "Line 3"
 
Lcd "Line 3"
 
Fourthline
 
Fourthline
 
Lcd "Line 4"
 
Lcd "Line 4"
Home Third 'goto home on line three
+
Home Third 'Gehe zu Home der dritten Zeile
 
Home Fourth
 
Home Fourth
Home F 'first letteer also works
+
Home F 'Es reicht auch der erste Buchstabe
 
Locate 4 , 1 : Lcd "Line 4"
 
Locate 4 , 1 : Lcd "Line 4"
 
Wait 1
 
Wait 1
 
   
 
   
'Now lets build a special character
+
'Definition benutzerdefinierter Zeichen
'the first number is the characternumber (0-7)
+
'Die erste Ziffer ist die Zeichennummer (0-7)
'The other numbers are the rowvalues
+
'Die anderen Zahlen sind die Zeilenwerte
'Use the LCD tool to insert this line
+
'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 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)
 
Deflcdchar 0 , 240 , 224 , 224 , 255 , 254 , 252 , 248 , 240 ' replace ? with number (0-7)
Cls 'select data RAM
+
Cls 'Selektiere Daten RAM
Rem it is important that a CLS is following the deflcdchar statements because it will set the controller back in datamode
+
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) 'print the special character
+
Lcd Chr(0) ; Chr(1) 'Ausgabe von benutzterdefinierten Zeichen
 
   
 
   
'----------------- Now use an internal routine ------------
+
'----------------- Benutzung einer internen Routine ------------
_temp1 = 1 'value into ACC
+
_temp1 = 1 'Wert in ACC
!rCall _write_lcd 'put it on LCD
+
!rCall _write_lcd 'auf LCD schreiben
 
End
 
End
 
</source><br/>{{Languages}}
 
</source><br/>{{Languages}}
  
 
[[Category:BASCOM Language Reference/de]]
 
[[Category:BASCOM Language Reference/de]]

Revision as of 01:14, 25 February 2013

Contents

= (**COPIED FROM ENGLISH PAGE**) === Action

Override the LCD-PIN select options.

 

 

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.

 

 

See also

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