BAUD1

Aus MCS Wiki AVR
(Weitergeleitet von BAUD1-BAUDx)
Wechseln zu: Navigation, Suche

Inhaltsverzeichnis

Action

Changes the baud rate for the second hardware UART.

 

 

Syntax

BAUD1 = var

BAUD1 #x , const


Xmega Syntax

BAUDx = constant

 

 

Remarks

Var

The baud rate that you want to use.

X

The channel number of the software UART.

Const

A numeric constant for the baud rate that you want to use.

 

Do not confuse the BAUD1 statement with the $BAUD1 compiler directive.

 

And do not confuse $CRYSTAL and CRYSTAL

 

$BAUD1 overrides the compiler setting for the baud rate and BAUD1 will change the current baud rate.

BAUD1 = ... will work on the hardware UART.

BAUD #x, yyyy will work on the software UART.

 

Xmega

For the xmega, the X represents the UART number. BAUD means, the first UART, BAUD1 the second UART, and BAUD7 is the last UART. A channel number is not supported.

For the Xmega you need to use a constant for the baud rate. Variables are not supported. 

See also

$CRYSTAL , $BAUD , $BAUD1 , BAUD

 

 

ASM

NONE

 

 

Example


'-------------------------------------------------------------------------------
'copyright : (c) 1995-2005, MCS Electronics
'micro : Mega162
'suited for demo : yes
'commercial addon needed : no
'purpose : demonstrates BAUD1 directive and BAUD1 statement
 
'-------------------------------------------------------------------------------
$regfile = "M162def.dat"
$baud1 = 2400
$crystal= 14000000 ' 14 MHz crystal
 
Open "COM2:" For BINARY As #1
 
Print #1 , "Hello"
'Now change the baud rate in a program
Baud1 = 9600 '
Print #1 , "Did you change the terminal emulator baud rate too?"
Close #1
End

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