$CRYSTAL/de

From MCS Wiki AVR
< $CRYSTAL(Difference between revisions)
Jump to: navigation, search
m (1 revision)
(Example)
 
(3 intermediate revisions by one user not shown)
Line 1: Line 1:
== (**COPIED FROM ENGLISH PAGE**) === <span class="f_Header">Action</span><br/> =
+
= <span class="f_Header">Funktion</span><br/> =
  
Instruct the compiler to override the crystal frequency options setting.
+
Compileranweisung zum Überschreiben der Standard-Taktfrequenz aus den BASCOM-Optionen.
  
 
<span style="font-family: 'Arial';  color: #000000">&nbsp;</span>
 
<span style="font-family: 'Arial';  color: #000000">&nbsp;</span>
Line 15: Line 15:
 
<span style="font-family: 'Arial';  color: #000000">&nbsp;</span>
 
<span style="font-family: 'Arial';  color: #000000">&nbsp;</span>
  
= <span class="f_Header">Remarks</span><br/> =
+
= <span class="f_Header">Anmerkungen</span><br/> =
 
<div style="text-align: left;  text-indent: 0px;  padding: 0px 0px 0px 0px;  margin: 0px 0px 0px 4px">
 
<div style="text-align: left;  text-indent: 0px;  padding: 0px 0px 0px 0px;  margin: 0px 0px 0px 4px">
 
{| style="border: solid 2px #000000;  border-spacing:0px;  border-collapse: collapse" border="1" cellpadding="1" cellspacing="0" width="604"
 
{| style="border: solid 2px #000000;  border-spacing:0px;  border-collapse: collapse" border="1" cellpadding="1" cellspacing="0" width="604"
Line 23: Line 23:
  
 
| style="width:100%;  border: solid 1px #000000" valign="top" width="100%" |  
 
| style="width:100%;  border: solid 1px #000000" valign="top" width="100%" |  
A numeric constant with the Frequency of the crystal.
+
Taktfrequenz als numerische Konstante.  
  
 
|}
 
|}
Line 29: Line 29:
 
<span style="font-family: 'Arial';  color: #000000">&nbsp;</span>
 
<span style="font-family: 'Arial';  color: #000000">&nbsp;</span>
  
The frequency is selectable from the [[Options Compiler Communication]]. It is stored in a configuration file. The $CRYSTAL directive overrides this setting.
+
Die Frequenz ist einstellbar in [[Options Compiler Communication]]. Sie wird in einer Konfigurationsdatei gespeichert. Die $CRYSTAL Direktive überschreibt diese Einstellung.
  
It is best to use the $CRYSTAL directive as the used crystal frequency is visible in your program that way.
+
Es ist sinnvoll, die $CRYSTAL Direktive im Programm zu benutzen weil dadurch die verwendete Frequenz deutlich wird.
  
 
<span style="font-family: 'Arial';  color: #000000">&nbsp;</span>
 
<span style="font-family: 'Arial';  color: #000000">&nbsp;</span>
  
[[File:Notice.jpg|left|Notice.jpg]]&nbsp;The $CRYSTAL directive only informs the compiler about the used frequency. It does not set any fuse bit. The frequency must be know by the compiler for a number of reasons. First when you use serial communications, and you specify [[$BAUD]], the compiler can calculate the proper settings for the UBR register. And second there are a number of routines like [[WAITMS]], that use the execution time of a loop to generate a delay. When you specify $CRYSTAL = 1000000 (1 MHz) but in reality, connect a 4 MHz XTAL, you will see that everything will work 4 times as quick.
+
[[File:Notice.jpg|left|Notice.jpg]]&nbsp;Die $CRYSTAL Direktive teilt dem Compiler lediglich die Frequenz mit. Sie setzt kein Fuse-Bit. Die Frequenz muss dem Compiler aus verschiedenen Gründen bekannt sein. Erstens kann der Compiler bei Verwendung serieller Kommunikation und Spezifizierung von [[$BAUD]] den passenden Wert für das UBR-Register berechnen. Zweitens gibt es einige interne Routinen wie zum Beispiel [[WAITMS]] die die Ausführungszeiten von Schleifen nutzen um Wartezeiten zu erzeugen. Wenn $CRYSTAL = 1000000 (1 MHz) im Programm steht aber in Wirklichkeit ein 4 MHz Takt angeschlossen ist dann kann man feststellen, dass alles 4 mal schneller läuft.
  
 
<span style="font-family: 'Arial';  color: #000000">&nbsp;</span>
 
<span style="font-family: 'Arial';  color: #000000">&nbsp;</span>
  
Most new AVR chips have an internal oscillator that is enabled by default. Check the data sheet for the default value.
+
Die meisten neueren AVR Mikrocontroller haben einen internen Oszillator der standardmäßig aktiviert ist. Die Standardeinstellungen stehen im jeweiligen Datenblatt.
  
 
<span style="font-family: 'Arial';  color: #000000">&nbsp;</span>
 
<span style="font-family: 'Arial';  color: #000000">&nbsp;</span>
Line 45: Line 45:
 
<span style="font-family: 'Arial';  color: #000000">&nbsp;</span>
 
<span style="font-family: 'Arial';  color: #000000">&nbsp;</span>
  
= <span class="f_Header">See also</span><br/> =
+
= <span class="f_Header">Siehe auch</span><br/> =
  
 
[[$BAUD]] , [[BAUD]] , [[CONFIG CLOCKDIV|CONFIG CLOCKDIV]]
 
[[$BAUD]] , [[BAUD]] , [[CONFIG CLOCKDIV|CONFIG CLOCKDIV]]
Line 53: Line 53:
 
<span style="font-family: 'Arial';  color: #000000">&nbsp;</span>
 
<span style="font-family: 'Arial';  color: #000000">&nbsp;</span>
  
= <span class="f_Header">Example</span><br/> =
+
= <span class="f_Header">Beispiel</span><br/> =
  
 
<source lang="bascomavr">
 
<source lang="bascomavr">

Latest revision as of 02:06, 18 February 2013

Contents

Funktion

Compileranweisung zum Überschreiben der Standard-Taktfrequenz aus den BASCOM-Optionen.

 

 

Syntax

$CRYSTAL = var

 

 

Anmerkungen

var

Taktfrequenz als numerische Konstante.

 

Die Frequenz ist einstellbar in Options Compiler Communication. Sie wird in einer Konfigurationsdatei gespeichert. Die $CRYSTAL Direktive überschreibt diese Einstellung.

Es ist sinnvoll, die $CRYSTAL Direktive im Programm zu benutzen weil dadurch die verwendete Frequenz deutlich wird.

 

Notice.jpg
 Die $CRYSTAL Direktive teilt dem Compiler lediglich die Frequenz mit. Sie setzt kein Fuse-Bit. Die Frequenz muss dem Compiler aus verschiedenen Gründen bekannt sein. Erstens kann der Compiler bei Verwendung serieller Kommunikation und Spezifizierung von $BAUD den passenden Wert für das UBR-Register berechnen. Zweitens gibt es einige interne Routinen wie zum Beispiel WAITMS die die Ausführungszeiten von Schleifen nutzen um Wartezeiten zu erzeugen. Wenn $CRYSTAL = 1000000 (1 MHz) im Programm steht aber in Wirklichkeit ein 4 MHz Takt angeschlossen ist dann kann man feststellen, dass alles 4 mal schneller läuft.

 

Die meisten neueren AVR Mikrocontroller haben einen internen Oszillator der standardmäßig aktiviert ist. Die Standardeinstellungen stehen im jeweiligen Datenblatt.

 

 

Siehe auch

$BAUD , BAUD , CONFIG CLOCKDIV

 

 

Beispiel

$regfile = "m48def.dat"
$crystal = 4000000
$baud = 19200
 
Config Com1 = Dummy , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0
 
Print "Hello world"
End
Languages   English Deutsch  
Personal tools
Namespaces
Variants
Actions
Navigation
In other languages
Language