PIC18F2480 MICROCHIP [Microchip Technology], PIC18F2480 Datasheet - Page 288

no-image

PIC18F2480

Manufacturer Part Number
PIC18F2480
Description
28/40/44-Pin Enhanced Flash Microcontrollers with ECAN Technology, 10-Bit A/D and nanoWatt Technology
Manufacturer
MICROCHIP [Microchip Technology]
Datasheet

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
PIC18F2480-E/ML
Manufacturer:
MICROCHIP
Quantity:
1 001
Part Number:
PIC18F2480-E/SO
Manufacturer:
Microchip Technology
Quantity:
135
Part Number:
PIC18F2480-I/SO
Manufacturer:
Microchi
Quantity:
9 999
Part Number:
PIC18F2480-I/SO
Manufacturer:
MIC
Quantity:
20 000
Part Number:
PIC18F2480-I/SO
0
Part Number:
PIC18F2480-I/SP
Manufacturer:
TDK
Quantity:
64
Part Number:
PIC18F2480-I/SP
Manufacturer:
MICROCHIP/微芯
Quantity:
20 000
PIC18F2480/2580/4480/4580
EXAMPLE 23-3:
EXAMPLE 23-4:
DS39637A-page 286
; 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.
; that correct bank is selected.
BANKSEL TXB0CON
; Now load transmit data into TXB0 buffer.
MOVLW
MOVWF
; Load rest of data bytes - up to 8 bytes into TXB0 buffer.
...
; Load message identifier
MOVLW
MOVWF
MOVLW
MOVWF
; 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
; If required, wait for message to get transmitted
BTFSC
BRA
; Message is transmitted.
; 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.
MOVF
ANDLW
IORLW
MOVWF
; Now TXB0 is mapped in place of RXB0.
; yield TXB0 register values.
; Load transmit data into TXB0 buffer.
MOVLW
MOVWF
; Load rest of the data bytes - up to 8 bytes into “TXB0” buffer using RXB0 registers.
...
; Load message identifier
MOVLW
MOVWF
MOVLW
MOVWF
; 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
; If required, wait for message to get transmitted
BTFSC
BRA
; Message is transmitted.
; If required, reset the WIN bits to default state.
CANCON, W
B’11110000’
B’00001000’
CANCON
MY_DATA_BYTE1
RXB0D0
60H
RXB0SIDL
24H
RXB0SIDH
B’00001000’
RXB0CON
RXB0CON, TXREQ
$-2
MY_DATA_BYTE1
TXB0D0
60H
TXB0SIDL
24H
TXB0SIDH
B’00001000’
TXB0CON
TXB0CON, TXREQ
$-2
TRANSMITTING A CAN MESSAGE USING BANKED METHOD
TRANSMITTING A CAN MESSAGE USING WIN BITS
Preliminary
; One BANKSEL in beginning will make sure that we are
; in correct bank for rest of the buffer access.
; Load first data byte into buffer
; Compiler will automatically set “BANKED” bit
; Load SID2:SID0, EXIDE = 0
; Load SID10:SID3
; Normal priority; Request transmission
; Is it transmitted?
; No.
; WIN bits are in lower 4 bits only.
; register to preserve all other bits.
; mode is already known, there is no need to preserve
; other bits.
; Clear WIN bits.
; Select Transmit Buffer 0
; Apply the changes.
; Load first data byte into buffer
; Access TXB0D0 via RXB0D0 address.
; Load SID2:SID0, EXIDE = 0
; Load SID10:SID3
; Normal priority; Request transmission
; Is it transmitted?
; No.
And since we want banked method, we need to make sure
Use WIN bits to map it to RXB0 area.
All future access to RXB0 registers will actually
Continue to wait...
Continue to wait...
 2004 Microchip Technology Inc.
Read CANCON
If operation

Related parts for PIC18F2480