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

PIC18F4580-I/PT 参数 Datasheet PDF下载

PIC18F4580-I/PT图片预览
型号: PIC18F4580-I/PT
PDF下载: 下载PDF文件 查看货源
内容描述: 28 /40/ 44引脚增强型闪存微控制器与ECAN技术, 10位A / D和纳瓦技术 [28/40/44-Pin Enhanced Flash Microcontrollers with ECAN Technology, 10-Bit A/D and nanoWatt Technology]
分类和应用: 闪存微控制器和处理器外围集成电路时钟
文件页数/大小: 490 页 / 8912 K
品牌: MICROCHIP [ MICROCHIP ]
 浏览型号PIC18F4580-I/PT的Datasheet PDF文件第288页浏览型号PIC18F4580-I/PT的Datasheet PDF文件第289页浏览型号PIC18F4580-I/PT的Datasheet PDF文件第290页浏览型号PIC18F4580-I/PT的Datasheet PDF文件第291页浏览型号PIC18F4580-I/PT的Datasheet PDF文件第293页浏览型号PIC18F4580-I/PT的Datasheet PDF文件第294页浏览型号PIC18F4580-I/PT的Datasheet PDF文件第295页浏览型号PIC18F4580-I/PT的Datasheet PDF文件第296页  
PIC18F2480/2580/4480/4580  
EXAMPLE 24-3:  
TRANSMITTING A CAN MESSAGE USING BANKED METHOD  
; Need to transmit Standard Identifier message 123h using TXB0 buffer.  
; To successfully transmit, CAN module must be either in Normal or Loopback mode.  
; TXB0 buffer is not in access bank. And since we want banked method, we need to make sure  
; that correct bank is selected.  
BANKSEL TXB0CON  
; One BANKSEL in beginning will make sure that we are  
; in correct bank for rest of the buffer access.  
; Now load transmit data into TXB0 buffer.  
MOVLW  
MOVWF  
MY_DATA_BYTE1  
TXB0D0  
; Load first data byte into buffer  
; Compiler will automatically set “BANKED” bit  
; Load rest of data bytes - up to 8 bytes into TXB0 buffer.  
...  
; Load message identifier  
MOVLW  
MOVWF  
MOVLW  
MOVWF  
60H  
TXB0SIDL  
24H  
; Load SID2:SID0, EXIDE = 0  
; Load SID10:SID3  
TXB0SIDH  
; No need to load TXB0EIDL:TXB0EIDH, as we are transmitting Standard Identifier Message only.  
; Now that all data bytes are loaded, mark it for transmission.  
MOVLW  
MOVWF  
B’00001000’  
TXB0CON  
; Normal priority; Request transmission  
; If required, wait for message to get transmitted  
BTFSC  
BRA  
TXB0CON, TXREQ  
$-2  
; Is it transmitted?  
; No. Continue to wait...  
; Message is transmitted.  
EXAMPLE 24-4:  
TRANSMITTING A CAN MESSAGE USING WIN BITS  
; Need to transmit Standard Identifier message 123h using TXB0 buffer.  
; To successfully transmit, CAN module must be either in Normal or Loopback mode.  
; TXB0 buffer is not in access bank. Use WIN bits to map it to RXB0 area.  
MOVF  
CANCON, W  
; WIN bits are in lower 4 bits only. Read CANCON  
; register to preserve all other bits. If operation  
; mode is already known, there is no need to preserve  
; other bits.  
ANDLW  
IORLW  
MOVWF  
B’11110000’  
B’00001000’  
CANCON  
; Clear WIN bits.  
; Select Transmit Buffer 0  
; Apply the changes.  
; Now TXB0 is mapped in place of RXB0. All future access to RXB0 registers will actually  
; yield TXB0 register values.  
; Load transmit data into TXB0 buffer.  
MOVLW  
MOVWF  
MY_DATA_BYTE1  
RXB0D0  
; Load first data byte into buffer  
; Access TXB0D0 via RXB0D0 address.  
; Load rest of the data bytes - up to 8 bytes into “TXB0” buffer using RXB0 registers.  
...  
; Load message identifier  
MOVLW  
MOVWF  
MOVLW  
MOVWF  
60H  
RXB0SIDL  
24H  
; Load SID2:SID0, EXIDE = 0  
; Load SID10:SID3  
RXB0SIDH  
; No need to load RXB0EIDL:RXB0EIDH, as we are transmitting Standard Identifier Message only.  
; Now that all data bytes are loaded, mark it for transmission.  
MOVLW  
MOVWF  
B’00001000’  
RXB0CON  
; Normal priority; Request transmission  
; If required, wait for message to get transmitted  
BTFSC  
BRA  
RXB0CON, TXREQ  
$-2  
; Is it transmitted?  
; No. Continue to wait...  
; Message is transmitted.  
; If required, reset the WIN bits to default state.  
DS39637D-page 292  
© 2009 Microchip Technology Inc.  
 复制成功!