欢迎访问ic37.com |
会员登录 免费注册
发布采购

MEGA128CAN 参数 Datasheet PDF下载

MEGA128CAN图片预览
型号: MEGA128CAN
PDF下载: 下载PDF文件 查看货源
内容描述: 微控制器,带有ISP功能的Flash和CAN控制器128K字节 [Microcontroller WITH 128K BYTES OF ISP FLASH AND CAN CONTROLLER]
分类和应用: 微控制器
文件页数/大小: 413 页 / 5507 K
品牌: ATMEL [ ATMEL ]
 浏览型号MEGA128CAN的Datasheet PDF文件第174页浏览型号MEGA128CAN的Datasheet PDF文件第175页浏览型号MEGA128CAN的Datasheet PDF文件第176页浏览型号MEGA128CAN的Datasheet PDF文件第177页浏览型号MEGA128CAN的Datasheet PDF文件第179页浏览型号MEGA128CAN的Datasheet PDF文件第180页浏览型号MEGA128CAN的Datasheet PDF文件第181页浏览型号MEGA128CAN的Datasheet PDF文件第182页  
Data Transmission –  
USART Transmitter  
The USARTn Transmitter is enabled by setting the Transmit Enable (TXENn) bit in the  
UCSRnB Register. When the Transmitter is enabled, the normal port operation of the  
TxDn pin is overridden by the USARTn and given the function as the Transmitter’s serial  
output. The baud rate, mode of operation and frame format must be set up once before  
doing any transmissions. If synchronous operation is used, the clock on the XCKn pin  
will be overridden and used as transmission clock.  
Sending Frames with 5 to 8  
Data Bit  
A data transmission is initiated by loading the transmit buffer with the data to be trans-  
mitted. The CPU can load the transmit buffer by writing to the UDRn I/O location. The  
buffered data in the transmit buffer will be moved to the Shift Register when the Shift  
Register is ready to send a new frame. The Shift Register is loaded with new data if it is  
in idle state (no ongoing transmission) or immediately after the last stop bit of the previ-  
ous frame is transmitted. When the Shift Register is loaded with new data, it will transfer  
one complete frame at the rate given by the Baud Register, U2Xn bit or by XCKn  
depending on mode of operation.  
The following code examples show a simple USART0 transmit function based on polling  
of the Data Register Empty (UDRE0) flag. When using frames with less than eight bits,  
the most significant bits written to the UDR0 are ignored. The USART0 has to be initial-  
ized before the function can be used. For the assembly code, the data to be sent is  
assumed to be stored in Register R16  
.
Assembly Code Example(1)  
USART0_Transmit:  
; Wait for empty transmit buffer  
lds r17, UCSR0A  
sbrs r17, UDRE0  
rjmp USART0_Transmit  
; Put data (r16) into buffer, sends the data  
sts  
ret  
UDR0, r16  
C Code Example(1)  
void USART0_Transmit (unsigned char data )  
{
/* Wait for empty transmit buffer */  
while ( ! ( UCSRA0 & (1<<UDRE0)))  
;
/* Put data into buffer, sends the data */  
UDR0 = data;  
}
Note:  
1. The example code assumes that the part specific header file is included.  
The function simply waits for the transmit buffer to be empty by checking the UDRE0  
flag, before loading it with new data to be transmitted. If the Data Register Empty inter-  
rupt is utilized, the interrupt routine writes the data into the buffer.  
178  
AT90CAN128  
4250E–CAN–12/04  
 复制成功!