$CRYSTAL/de
(Difference between revisions)
m (1 revision) |
(→(**COPIED FROM ENGLISH PAGE**) =) |
||
Line 1: | Line 1: | ||
− | + | = <span class="f_Header">Funktion</span><br/> = | |
− | + | Compileranweisung zum Überschreiben der Standard-Taktfrequenz aus den BASCOM-Optionen. | |
<span style="font-family: 'Arial'; color: #000000"> </span> | <span style="font-family: 'Arial'; color: #000000"> </span> |
Revision as of 01:45, 18 February 2013
Contents |
Funktion
Compileranweisung zum Überschreiben der Standard-Taktfrequenz aus den BASCOM-Optionen.
Syntax
$CRYSTAL = var
Remarks
var |
A numeric constant with the Frequency of the crystal. |
The frequency is selectable from the Options Compiler Communication. It is stored in a configuration file. The $CRYSTAL directive overrides this setting.
It is best to use the $CRYSTAL directive as the used crystal frequency is visible in your program that way.
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.
Most new AVR chips have an internal oscillator that is enabled by default. Check the data sheet for the default value.
See also
$BAUD , BAUD , CONFIG CLOCKDIV
Example
$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 |
---|