ALIAS/de

From MCS Wiki AVR
< ALIAS(Difference between revisions)
Jump to: navigation, search
(Syntax)
(Example)
 
(2 intermediate revisions by one user not shown)
Line 15: Line 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
  
 
|}
 
|}
Line 36: Line 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>
Line 48: Line 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]]
Line 56: Line 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">
Line 68: Line 66:
 
'-------------------------------------------------------------------------------
 
'-------------------------------------------------------------------------------
 
$regfile = "m48def.dat"
 
$regfile = "m48def.dat"
$crystal = 4000000 ' 4 MHz crystal
+
$crystal = 4000000 ' 4 MHz Takt
 
   
 
   
 
Const On = 1
 
Const On = 1

Latest revision as of 01:32, 27 February 2013

Contents

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  
Personal tools
Namespaces
Variants
Actions
Navigation
In other languages
Language