Цитата
19.5 USART Initialization
...
The following simple USART initialization code examples show one assembly and one C function
that are equal in functionality. The examples assume asynchronous operation using polling
(no interrupts enabled) and a fixed frame format. The baud rate is given as a function parameter.
For the assembly code, the baud rate parameter is assumed to be stored in the r17:r16 registers.
When the function writes to the UCSRC Register, the URSEL bit (MSB) must be set due to
the sharing of I/O location by UBRRH and UCSRC.
Цитата
19.10.2 Read Access
Doing a read access to the UBRRH or the UCSRC Register is a more complex operation. However,
in most applications, it is rarely necessary to read any of these registers.
The read access is controlled by a timed sequence. Reading the I/O location once returns the
UBRRH Register contents. If the register location was read in previous system clock cycle, reading
the register in the current clock cycle will return the UCSRC contents. Note that the timed
sequence for reading the UCSRC is an atomic operation. Interrupts must therefore be controlled
(for example by disabling interrupts globally) during the read operation.
The following code example shows how to read the UCSRC Register contents.
По русски:
запрещены прерывания во время записи и чтения регистров UBRRH и UCSRC.
для записи в UBRRH бит URSEL должен быть равен 0, для записи в регистр UCSRC бит URSEL должен быть равен 1.
для чтения UBRRH его надо считать первым. повторное чтение данного регистра вернет содержимое регистра UCSRC.
Цитата
Студия некорректно отбражает этот регистр - читайе описание ее багов в хелпе. Смею предположить, что и JTAGICE и JTAGICE mkII при отображении в окнах регистров также отображают UCSRC неправильно, ибо читает его как и все остальные регистры - однократным чтением.
подтверждаю )
Всем спасибо, разобрался
Сообщение отредактировал pimen - Jul 13 2009, 19:45