$CRYSTAL/de

(Difference between revisions)
Jump to: navigation, search
(Created page with "= <span class="f_Header">Action</span><br/> = Instruct the compiler to override the crystal frequency options setting. <span style="font-family: 'Arial'; color: #000000">&n...")
 
m (1 revision)

Revision as of 21:06, 15 February 2013

Contents

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

Instruct the compiler to override the crystal frequency options setting.

 

 

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.

 

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