ALIAS/de

Aus MCS Wiki AVR
< ALIAS(Unterschied zwischen Versionen)
Wechseln zu: Navigation, Suche
(Created page with "= <span class="f_Header">Action</span> = Indicates that the variable can be referenced with another name. <span style="font-family: Arial;"> </span> <span style="font-...")
 
(Example)
 
(5 dazwischenliegende Versionen von 2 Benutzern werden nicht angezeigt)
Zeile 1: Zeile 1:
== (**COPIED FROM ENGLISH PAGE**) === <span class="f_Header">Action</span> =
+
= <span class="f_Header">Funktion</span> =
  
Indicates that the variable can be referenced with another name.
+
Ermöglicht das Ansprechen einer Variablen oder Port(-Pins) unter einem anderen Namen.
  
 
<span style="font-family: Arial;">&nbsp;</span>
 
<span style="font-family: Arial;">&nbsp;</span>
Zeile 9: Zeile 9:
 
= <span class="f_Header">Syntax</span> =
 
= <span class="f_Header">Syntax</span> =
  
newvar&nbsp;<span class="f_Syntax">ALIAS</span>&nbsp;oldvar
+
neuevariable&nbsp;<span class="f_Syntax">ALIAS</span>&nbsp;altevariable
  
 
<span style="font-family: Arial;">&nbsp;</span>
 
<span style="font-family: Arial;">&nbsp;</span>
Zeile 15: Zeile 15:
 
<span style="font-family: Arial;">&nbsp;</span>
 
<span style="font-family: Arial;">&nbsp;</span>
  
= <span class="f_Header">Remarks</span> =
+
= <span class="f_Header">Anmerkungen</span> =
 
<div style="padding: 0px; margin: 0px 0px 0px 4px;">
 
<div style="padding: 0px; margin: 0px 0px 0px 4px;">
 
{| width="604" cellspacing="0" cellpadding="1" border="1" style="border: 2px solid rgb(0, 0, 0); border-spacing: 0px; border-collapse: collapse;"
 
{| width="604" cellspacing="0" cellpadding="1" border="1" style="border: 2px solid rgb(0, 0, 0); border-spacing: 0px; border-collapse: collapse;"
 
|- style="vertical-align: top;"
 
|- style="vertical-align: top;"
 
| valign="top" width="14%" style="width: 81px; border: 1px solid rgb(0, 0, 0);" |  
 
| valign="top" width="14%" style="width: 81px; border: 1px solid rgb(0, 0, 0);" |  
oldvar
+
altevariable
  
 
| valign="top" width="100%" style="width: 514px; border: 1px solid rgb(0, 0, 0);" |  
 
| valign="top" width="100%" style="width: 514px; border: 1px solid rgb(0, 0, 0);" |  
Name of the variable such as PORTB.1
+
Name der Variablen wie zum Beispiel PORTB.1
  
 
|- style="vertical-align: top;"
 
|- style="vertical-align: top;"
 
| valign="top" width="14%" style="width: 81px; border: 1px solid rgb(0, 0, 0);" |  
 
| valign="top" width="14%" style="width: 81px; border: 1px solid rgb(0, 0, 0);" |  
newvar
+
neuevariable
  
 
| valign="top" width="100%" style="width: 514px; border: 1px solid rgb(0, 0, 0);" |  
 
| valign="top" width="100%" style="width: 514px; border: 1px solid rgb(0, 0, 0);" |  
New name of the variable such as direction
+
Neuer Name der Variablen/des Portpins wie zum Beispiel Richtung
  
 
|}
 
|}
Zeile 36: Zeile 36:
 
<span style="font-family: Arial;">&nbsp;</span>
 
<span style="font-family: Arial;">&nbsp;</span>
  
Aliasing port pins can give the pin names a more meaningful name. &nbsp;For example, when your program uses 4 different pins to control 4 different relays, you could name them portb.1, portb.2, portb.3 and portb.4.
+
Mit ALIAS kann man Portpins sinnvollere Namen geben. Wenn ein Programm zum Beispiel 4 verschiedene Pins verwendet um 4 verschiedene Relais anzusteuern dann kann man die Relais mit portb.1, portb.2, portb.3 und portb.4 ansprechen aber es ist einfacher, sie im Programm mit relais1, relais2, relais3 und relais4 anzusprechen.
 
+
But it would be more convenient to refer to them as relais1, relais2, relais3 and realais4.
+
  
 
<span style="font-family: Arial;">&nbsp;</span>
 
<span style="font-family: Arial;">&nbsp;</span>
  
When you later on change your PCB and decide that relays 4 must be connected to portD.4 instead of portb.4, you only need to change the ALIAS line, and not your whole program.
+
Wenn später das Leiterplatten-Design geändert werden muss und Relais 4 nun mit PortD.4 statt mit PortB.4 angesprochen werden soll dann muss nur die ALIAS-Zeile geändert werden und nicht alle Stellen im Programm.
  
 
<span style="font-family: Arial;">&nbsp;</span>
 
<span style="font-family: Arial;">&nbsp;</span>
Zeile 48: Zeile 46:
 
<span style="font-family: Arial;">&nbsp;</span>
 
<span style="font-family: Arial;">&nbsp;</span>
  
= <span class="f_Header">See also</span> =
+
= <span class="f_Header">Siehe auch</span> =
  
 
[[CONST]]
 
[[CONST]]
Zeile 56: Zeile 54:
 
<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">
Zeile 68: Zeile 66:
 
'-------------------------------------------------------------------------------
 
'-------------------------------------------------------------------------------
 
$regfile = "m48def.dat"
 
$regfile = "m48def.dat"
$crystal = 4000000 ' 4 MHz crystal
+
$crystal = 4000000 ' 4 MHz Takt
 
   
 
   
 
Const On = 1
 
Const On = 1

Aktuelle Version vom 27. Februar 2013, 01:32 Uhr

Inhaltsverzeichnis

Funktion

Ermöglicht das Ansprechen einer Variablen oder Port(-Pins) unter einem anderen Namen.

 

 

Syntax

neuevariable ALIAS altevariable

 

 

Anmerkungen

altevariable

Name der Variablen wie zum Beispiel PORTB.1

neuevariable

Neuer Name der Variablen/des Portpins wie zum Beispiel Richtung

 

Mit ALIAS kann man Portpins sinnvollere Namen geben. Wenn ein Programm zum Beispiel 4 verschiedene Pins verwendet um 4 verschiedene Relais anzusteuern dann kann man die Relais mit portb.1, portb.2, portb.3 und portb.4 ansprechen aber es ist einfacher, sie im Programm mit relais1, relais2, relais3 und relais4 anzusprechen.

 

Wenn später das Leiterplatten-Design geändert werden muss und Relais 4 nun mit PortD.4 statt mit PortB.4 angesprochen werden soll dann muss nur die ALIAS-Zeile geändert werden und nicht alle Stellen im Programm.

 

 

Siehe auch

CONST

 

 

Beispiel


'-------------------------------------------------------------------------------
'copyright : (c) 1995-2005, MCS Electronics
'micro : Mega48
'suited for demo : yes
'commercial addon needed : no
'purpose : demonstrates ALIAS
 
'-------------------------------------------------------------------------------
$regfile = "m48def.dat"
$crystal = 4000000 ' 4 MHz Takt
 
Const On = 1
Const Off = 0
 
Config Portb = Output
Relais1 Alias Portb.1
Relais2 Alias Portb.2
Relais3 Alias Portd.5
Relais4 Alias Portd.2
 
Set Relais1
Relais2 = 0
Relais3 = On
Relais4 = Off
 
End

Languages   English Deutsch  
Meine Werkzeuge
Namensräume
Varianten
Aktionen
Navigation
In anderen Sprachen
Sprache