PIC18F248-E/L MICROCHIP [Microchip Technology], PIC18F248-E/L Datasheet - Page 206

no-image

PIC18F248-E/L

Manufacturer Part Number
PIC18F248-E/L
Description
28/40-Pin High-Performance, Enhanced Flash Microcontrollers with CAN Module
Manufacturer
MICROCHIP [Microchip Technology]
Datasheet
EXAMPLE 19-1:
DS41159E-page 204
PIC18FXX8
RXB0Interrupt
AccessBuffer
BCF
GOTO
; Copy CANCON.ICODE bits to CANSTAT.WIN bits
MOVF
ANDLW
MOVWF
MOVF
ANDLW
IORWF
; Access current buffer…
; User code
; Restore CANCON.WIN bits
MOVF
ANDLW
IORWF
MOVWF
; Do not need to restore CANSTAT - it is read-only register.
; Return from interrupt or check for another module interrupt source
PIR3, RXB0IF
AccessBuffer
CANCON, W
b’11110001’
CANCON
TempCANSTAT, W
b’00001110’
CANCON
CANCON, W
b’11110001’
TempCANCON, W
CANCON
WIN AND ICODE BITS USAGE IN INTERRUPT SERVICE ROUTINE TO ACCESS
TX/RX BUFFERS (CONTINUED)
; Clear the interrupt flag
; This is either TX or RX interrupt
; Clear CANCON.WIN bits before copying
; new ones.
; Use previously saved CANCON value to
; make sure same value.
; Copy masked value back to TempCANCON
; Retrieve ICODE bits
; Use previously saved CANSTAT value
; to make sure same value.
; Copy ICODE bits to WIN bits.
; Copy the result to actual CANCON
; Preserve current non WIN bits
; Restore original WIN bits
© 2006 Microchip Technology Inc.

Related parts for PIC18F248-E/L