PIC18F 80K CAN总F 线说明书资料

上传人:f****u 文档编号:113645684 上传时间:2019-11-09 格式:PDF 页数:64 大小:10.24MB
返回 下载 相关 举报
PIC18F 80K CAN总F 线说明书资料_第1页
第1页 / 共64页
PIC18F 80K CAN总F 线说明书资料_第2页
第2页 / 共64页
PIC18F 80K CAN总F 线说明书资料_第3页
第3页 / 共64页
PIC18F 80K CAN总F 线说明书资料_第4页
第4页 / 共64页
PIC18F 80K CAN总F 线说明书资料_第5页
第5页 / 共64页
点击查看更多>>
资源描述

《PIC18F 80K CAN总F 线说明书资料》由会员分享,可在线阅读,更多相关《PIC18F 80K CAN总F 线说明书资料(64页珍藏版)》请在金锄头文库上搜索。

1、 2011 Microchip Technology Inc.DS39977C_CN395 PIC18F66K80 27.0ECAN PIC18F66K80 Enhanced Controller Area Network ECAN ECANPIC18CXX8PIC18FXX8 CANPIC18FXX80ECAN CAN ECANBOSCH CAN 2.0ABCAN 1.2 CAN 2.0A CAN 2.0B PassiveCAN 2.0B Active CAN CANBOSCH CAN CANCAN 1.2 CAN 2.0ACAN 2.0B DeviceNetTM 0- 8 1 Mb/s P

2、IC18XXX8 CAN -0 -1DeviceNet -2DeviceNetFIFO 6RXTX 16/ 4 2 1 3 CAN 27.1 CAN CANCAN CAN CAN CANRB2/CANTXRB3/CANRX CANCANMXCONFIG3H 1CANTXCANRXI/O PIC18F2XK80PIC18F4XK80 RC6/CANTXRC7/CANRXPIC18F6XK80 RE4/CANRXRE5/CANTX CANCANTX TRISCANRXTRIS1 27.1.1 CAN 27- 1 ECAN 1.RXTX CANLATTRIS 2.ECAN 3.ECAN 4. 5.

3、6.ECAN 2014/12/19 16:34:59 共 64 页 第 1 页 PIC18F66K80 DS39977C_CN396 2011 Microchip Technology Inc. 27- 1CAN MSGREQ TXB2 ABTF MLOA TXERR MTXBUFF MSGREQ TXB1 ABTF MLOA TXERR MTXBUFF MSGREQ TXB0 ABTF MLOA TXERR MTXBUFF RXF0- RXF05 RXF06- RXF15 M A B 16 - 41MUX 0 12 6TX/RX 2RX CRC REC TEC TXRX 0 12 RXF15

4、 VCC RXM0RXM1 2014/12/19 16:35:00 共 64 页 第 2 页 2011 Microchip Technology Inc.DS39977C_CN397 PIC18F66K80 27.2CAN CAN TX/RXRTR I/O 27.2.1CAN CAN CAN 2014/12/19 16:35:00 共 64 页 第 3 页 PIC18F66K80 DS39977C_CN398 2011 Microchip Technology Inc. 27- 1CANCONCAN 0 R/W- 1R/W- 0R/W- 0R/S- 0R/W- 0R/W- 0R/W- 0U-

5、0 REQOP2REQOP1REQOP0ABATWIN2WIN1WIN0 1 R/W- 1R/W- 0R/W- 0R/S- 0U0U- 0U- 0U- 0 REQOP2REQOP1REQOP0ABAT 2 R/W- 1R/W- 0R/W- 0R/S- 0R- 0R- 0R- 0R- 0 REQOP2REQOP1REQOP0ABATFP3FP2FP1FP0 bit 7bit 0 S = 1 R = W = U = 0 - n = POR1 = 10 = x = bit 7- 5 REQOPCAN 1xx = 011 = 010 = 001 = / 000 = bit 4 ABAT 1 = (1)

6、 0 = bit 3- 1 0 WIN CAN ICODEWIN 27- 2 111 = 0 110 = 0 101 = 1 100 = 0 011 = 1 010 = 2 001 = 0 000 = 0 bit 0 0 0 bit 4- 0 1 0 2 FPFIFO 0000 = 0 0001 = 1 0010 = 2 0011 = 3 0100 = 4 0101 = 5 0110 = 6 0111 = 7 1000:1111 1 2014/12/19 16:35:01 共 64 页 第 4 页 2011 Microchip Technology Inc.DS39977C_CN399 PIC

7、18F66K80 27- 2CANSTATCAN 0 R- 1R- 0R- 0R- 0R- 0R- 0R- 0U- 0 OPMODE2(1)OPMODE1(1)OPMODE0(1)ICODE2ICODE1ICODE0 12 R- 1R- 0R- 0R- 0R- 0R- 0R- 0R- 0 OPMODE2(1)OPMODE1(1)OPMODE0(1)EICODE4EICODE3EICODE2EICODE1EICODE0 bit 7bit 0 R = W = U = 0 - n = POR1 = 10 = x = bit 7- 5 OPMODE (1) 111 = 110 = 101 = 100

8、= 011 = 010 = 001 = / 000 = bit 4 0 0 bit 3- 1,4- 0 0 ICODE ICODEWIN0EICODEEWIN12 27- 2 5 bit 0 0 0 bit 4- 0 12 EICODE ICODE 1/CANCAN / 2EICODE10000 012 000000000000000 CAN 000100001000010 TXB2 001000010000100 TXB1 001100011000110 TXB0 010000100001000 RXB1 0101010001- RXB0 011001000010000 0001001110

9、01110 RXB0 -1000010000 RXB1 -1000110000 RX/TX B0 -1001010010(2) RX/TX B1 -1001110011(2) RX/TX B2 -1010010100(2) RX/TX B3 -1010110101(2) RX/TX B4 -1011010110(2) RX/TX B5 -1011110111(2) 2014/12/19 16:35:01 共 64 页 第 5 页 PIC18F66K80 DS39977C_CN400 2011 Microchip Technology Inc. 27- 1 27- 2WINICODETX/RX

10、; Request Configuration mode. MOVLWB10000000; Set to Configuration Mode. MOVWFCANCON ; A request to switch to Configuration mode may not be immediately honored. ; Module will wait for CAN bus to be idle before switching to Configuration Mode. ; Request for other modes such as Loopback, Disable etc.

11、may be honored immediately. ; It is always good practice to wait and verify before continuing. ConfigWait: MOVFCANSTAT, W; Read current mode state. ANDLWB10000000; Interested in OPMODE bits only. TSTFSZWREG; Is it Configuration mode yet? BRAConfigWait; No. Continue to wait. ; Module is in Configurat

12、ion mode now. ; Modify configuration registers as required. ; Switch back to Normal mode to be able to communicate. ; Save application required context. ; Poll interrupt flags and determine source of interrupt ; This was found to be CAN interrupt ; TempCANCON and TempCANSTAT are variables defined in

13、 Access Bank low MOVFFCANCON, TempCANCON; Save CANCON.WIN bits ; This is required to prevent CANCON ; from corrupting CAN buffer access ; in-progress while this interrupt ; occurred MOVFFCANSTAT, TempCANSTAT; Save CANSTAT register ; This is required to make sure that ; we use same CANSTAT value rath

14、er ; than one changed by another CAN ; interrupt. MOVFTempCANSTAT, W; Retrieve ICODE bits ANDLWB00001110 ADDWFPCL, F; Perform computed GOTO ; to corresponding interrupt cause BRANoInterrupt; 000 = No interrupt BRAErrorInterrupt; 001 = Error interrupt BRATXB2Interrupt; 010 = TXB2 interrupt BRATXB1Int

15、errupt; 011 = TXB1 interrupt BRATXB0Interrupt; 100 = TXB0 interrupt BRARXB1Interrupt; 101 = RXB1 interrupt BRARXB0Interrupt; 110 = RXB0 interrupt ; 111 = Wake-up on interrupt WakeupInterrupt BCFPIR3, WAKIF; Clear the interrupt flag ; ; User code to handle wake-up procedure ; ; ; Continue checking fo

16、r other interrupt source or return from here NoInterrupt ; PC should never vector here.User may ; place a trap such as infinite loop or pin/port ; indication to catch this error. 2014/12/19 16:35:01 共 64 页 第 6 页 2011 Microchip Technology Inc.DS39977C_CN401 PIC18F66K80 27- 2WINICODETX/RX ErrorInterrupt BCFPIR3, ERRIF; Clear the interrupt flag ; Handle error. RETFIE TXB2Interrup

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 办公文档 > 其它办公文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号