PIC18F4680-H/ML Microchip Technology, PIC18F4680-H/ML Datasheet - Page 288

no-image

PIC18F4680-H/ML

Manufacturer Part Number
PIC18F4680-H/ML
Description
IC MCU 8BIT 64KB FLASH 44QFN
Manufacturer
Microchip Technology
Series
PIC® 18Fr
Datasheet

Specifications of PIC18F4680-H/ML

Core Processor
PIC
Core Size
8-Bit
Speed
25MHz
Connectivity
CAN, I²C, SPI, UART/USART
Peripherals
Brown-out Detect/Reset, HLVD, POR, PWM, WDT
Number Of I /o
36
Program Memory Size
64KB (32K x 16)
Program Memory Type
FLASH
Eeprom Size
1K x 8
Ram Size
3.25K x 8
Voltage - Supply (vcc/vdd)
4.2 V ~ 5.5 V
Data Converters
A/D 11x10b
Oscillator Type
Internal
Operating Temperature
-40°C ~ 150°C
Package / Case
44-VQFN Exposed Pad
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
PIC18F2585/2680/4585/4680
EXAMPLE 23-3:
EXAMPLE 23-4:
DS39625C-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...
© 2007 Microchip Technology Inc.
Read CANCON
If operation

Related parts for PIC18F4680-H/ML