Author | William Welch Copyright © 2009, all rights reserved. |
Adapted-by | |
Compiler | 2.4m |
The MCP2515 is an external CAN controller with Slave SPI interface. The controller has 3 transmit buffers and 2 receive buffers.
No dependency found
const CAN_TX1IF = 0x08
const CAN_TXB1D2 = 0x48
const CAN_CLKOUT_PS8 = 0x03
const CAN_CLKOUT_PS4 = 0x02
const CAN_TXB2D7 = 0x5D
const CAN_RXB1D1 = 0x77
const CAN_RXB0D6 = 0x6C
const CAN_RXM1SIDL = 0x25
const CAN_LOAD_TX0 = 0x40
const CAN_RXF5EID0 = 0x1B
const CAN_RXB0DLC = 0x65
const CAN_RXB1SIDH = 0x71
const CAN_TXB1D3 = 0x49
const CAN_SJW1 = 0x00
const CAN_RXB0SIDL = 0x62
const CAN_MODE_SLEEP = 0x20
const CAN_TXB2D0 = 0x56
const CAN_SOF_ENABLE = 0x80
const CAN_CLKOUT_DISABLE = 0x00
const CAN_TXB0SIDH = 0x31
const CAN_TXB2DLC = 0x55
const CAN_RXB1EID0 = 0x74
const CAN_TXB0D1 = 0x37
const CAN_RXF2SIDL = 0x09
const CAN_RXM1EID8 = 0x26
const CAN_ERRIE = 0x20
const CAN_SJW2 = 0x40
const CAN_TX0IF = 0x04
const CAN_MODE_CONFIG = 0x80
const CAN_CNF3 = 0x28
const CAN_TXB0EID0 = 0x34
const CAN_TXB0D7 = 0x3D
const CAN_RXB0EID8 = 0x63
const CAN_RXF5SIDL = 0x19
const CANINTE = 0x2B
const CAN_TXB1CTRL = 0x40
const CAN_ERRIF = 0x20
const CAN_WRITE_CMD = 0x02
const CAN_RX1IE = 0x02
const CAN_TXB1SIDL = 0x42
const CAN_MODE_MASK = 0xE0
const CAN_RXB0D7 = 0x6D
const CAN_RXF1EID8 = 0x06
const CAN_READ_RX1_DATA = 0x96
const CAN_TXB2EID0 = 0x54
const CAN_RXB1D5 = 0x7B
const CAN_RTS_TX2 = 0x84
const CANINTF = 0x2C
const CAN_TXB2SIDH = 0x51
const CANSTAT = 0x0E
const CAN_TXB1D7 = 0x4D
const CAN_TXB2SIDL = 0x52
const CAN_TXB2D6 = 0x5C
const CAN_RX_STATUS_CMD = 0xB0
const CAN_RXB1D2 = 0x78
const CAN_SJW4 = 0xC0
const CAN_MERRF = 0x80
const CAN_EFLG = 0x2D
const CAN_TXB0D4 = 0x3A
const CAN_TXB2D3 = 0x59
const CAN_TEC = 0x1C
const CAN_RXF3EID0 = 0x13
const CAN_RXM0EID0 = 0x23
const CAN_RXB1SIDL = 0x72
const CAN_RXB0D0 = 0x66
const CAN_TXB1D5 = 0x4B
const CAN_TXB2D1 = 0x57
const CAN_RXM1EID0 = 0x27
const CAN_RXB0D5 = 0x6B
const CAN_LOAD_TX2 = 0x44
const CAN_TXB1SIDH = 0x41
const CAN_RXF1SIDL = 0x05
const CAN_WAKFIL_ENABLE = 0x40
const CAN_RXF2EID0 = 0x0B
const CAN_RXM0SIDL = 0x21
const CAN_RX1IF = 0x02
const CAN_TXB1EID8 = 0x43
const CAN_RXM0EID8 = 0x22
const CAN_TXB0D3 = 0x39
const CAN_SJW3 = 0x80
const CAN_RXF4EID0 = 0x17
const CAN_CNF1 = 0x2A
const CAN_MODE_ONESHOT = 0x08
const CAN_RXB0D2 = 0x68
const CAN_RXF3EID8 = 0x12
const CAN_RXB1D7 = 0x7D
const CAN_TXB1D4 = 0x4A
const CAN_RXB1D0 = 0x76
const CAN_RXF4SIDL = 0x15
const CAN_TXB1D0 = 0x46
const CAN_RTS_ALL = 0x87
const CAN_TXB0SIDL = 0x32
const CAN_RX0IE = 0x01
const CAN_CLKOUT_ENABLE = 0x04
const CAN_TXB0DLC = 0x35
const CAN_RXB1EID8 = 0x73
const CAN_RXB1DLC = 0x75
const CAN_RXF4EID8 = 0x16
const CAN_TXB0D0 = 0x36
const CAN_REC = 0x1D
const CAN_SAMPLE_3X = 0x40
const CAN_WAKIE = 0x40
const CAN_RXB1CTRL = 0x70
const CAN_CNF2 = 0x29
const CAN_RXB0CTRL = 0x60
const CAN_TX0IE = 0x04
const CAN_WAKIF = 0x40
const CAN_TXB1D6 = 0x4C
const CAN_RXB1D3 = 0x79
const CAN_TX1IE = 0x08
const CAN_BTLMODE = 0x80
const CAN_SAMPLE_1X = 0x00
const CAN_SOF_DISABLE = 0x00
const CAN_TXB0D6 = 0x3C
const CAN_TX2IF = 0x10
const CAN_RXB1D4 = 0x7A
const CAN_RXF1EID0 = 0x07
const CAN_RXF0EID0 = 0x03
const CAN_RXF5SIDH = 0x18
const CAN_RXF3SIDH = 0x10
const CAN_RXF0EID8 = 0x02
const CAN_CLKOUT_PS1 = 0x00
const CAN_RXF3SIDL = 0x11
const CAN_RXB0D3 = 0x69
const CAN_CLKOUT_PS2 = 0x01
const CAN_ABORT_TX = 0x10
const CAN_RXM0SIDH = 0x20
const CAN_READ_CMD = 0x03
const CAN_READ_STATUS_CMD = 0xA0
const CAN_TXB0EID8 = 0x33
const CAN_TXB1D1 = 0x47
const CAN_RXB1D6 = 0x7C
const CAN_TXB2D5 = 0x5B
const CAN_LOAD_TX1 = 0x42
const CAN_RXF1SIDH = 0x04
const CAN_TXB1DLC = 0x45
const CAN_RXM1SIDH = 0x24
const CAN_READ_RX0_DATA = 0x92
const CAN_RXF5EID8 = 0x1A
const CAN_RXB0SIDH = 0x61
const CAN_TXB2EID8 = 0x53
const CAN_TXB1EID0 = 0x44
const CANCTRL = 0x0F
const CAN_TXB2CTRL = 0x50
const CAN_BITMOD = 0x05
const CAN_RTS_TX1 = 0x82
const CAN_TXB2D2 = 0x58
const CAN_RXB0D1 = 0x67
const CAN_RXF0SIDL = 0x01
const CAN_RXF0SIDH = 0x00
const CAN_RXF2SIDH = 0x08
const CAN_TXB0D2 = 0x38
const CAN_RX0IF = 0x01
const CAN_MERRE = 0x80
const CAN_MODE_LOOPBACK = 0x40
const CAN_TXB2D4 = 0x5A
const CAN_TXB0D5 = 0x3B
const CAN_RXB0EID0 = 0x64
const CAN_MODE_NORMAL = 0x00
const CAN_WAKFIL_DISABLE = 0x00
const CAN_RXB0D4 = 0x6A
const CAN_TXB0CTRL = 0x30
const CAN_RXF4SIDH = 0x14
const CAN_TX2IE = 0x10
const CAN_RESET_CMD = 0xC0
const CAN_MODE_LISTENONLY = 0x60
const CAN_MODE_POWERUP = 0xE0
const CAN_RTS_TX0 = 0x81
const CAN_RXF2EID8 = 0x0A
can_encode_std_id(dword in out can_id)
can_set_rxb1_filter3(byte in sidh, byte in sidl, byte in eid8, byte in eid0)
can_encode_ext_id(dword in out can_id)
can_encode_rtr_id(dword in out can_id)
can_set_rxb0_filter0(byte in sidh, byte in sidl, byte in eid8, byte in eid0)
can_write(byte in addr, byte in data)
can_set_rxb1_filter4(byte in sidh, byte in sidl, byte in eid8, byte in eid0)
can_set_rxb0_filter1(byte in sidh, byte in sidl, byte in eid8, byte in eid0)
can_set_rxb1_filter2(byte in sidh, byte in sidl, byte in eid8, byte in eid0)
can_set_rxb1_filter5(byte in sidh, byte in sidl, byte in eid8, byte in eid0)
can_set_rxb1_mask(byte in sidh, byte in sidl, byte in eid8, byte in eid0)
can_reset()
can_set_config(byte in p1, byte in p2, byte in p3)
can_set_rxb0_mask(byte in sidh, byte in sidl, byte in eid8, byte in eid0)
can_send(byte in buf_no, dword in can_id, byte in buf[8], byte in len) return bit
can_is_ext_id(dword in can_id) return bit
can_is_rtr_id(dword in can_id) return bit
can_rx_status() return byte
can_read_status() return byte
can_is_error_id(dword in can_id) return bit
can_read(byte in addr) return byte
can_is_std_id(dword in can_id) return bit
can_receive(byte in buf_no, dword out can_id, byte out buf[8], byte out len) return bit
const CAN_TX1IF = 0x08
No documentation found
const CAN_TXB1D2 = 0x48
No documentation found
const CAN_CLKOUT_PS8 = 0x03
No documentation found
const CAN_CLKOUT_PS4 = 0x02
No documentation found
const CAN_TXB2D7 = 0x5D
No documentation found
const CAN_RXB1D1 = 0x77
No documentation found
const CAN_RXB0D6 = 0x6C
No documentation found
const CAN_RXM1SIDL = 0x25
No documentation found
const CAN_LOAD_TX0 = 0x40
No documentation found
const CAN_RXF5EID0 = 0x1B
No documentation found
const CAN_RXB0DLC = 0x65
No documentation found
const CAN_RXB1SIDH = 0x71
No documentation found
const CAN_TXB1D3 = 0x49
No documentation found
const CAN_SJW1 = 0x00
No documentation found
const CAN_RXB0SIDL = 0x62
No documentation found
const CAN_MODE_SLEEP = 0x20
No documentation found
const CAN_TXB2D0 = 0x56
No documentation found
const CAN_SOF_ENABLE = 0x80
No documentation found
const CAN_CLKOUT_DISABLE = 0x00
No documentation found
const CAN_TXB0SIDH = 0x31
No documentation found
const CAN_TXB2DLC = 0x55
No documentation found
const CAN_RXB1EID0 = 0x74
No documentation found
const CAN_TXB0D1 = 0x37
No documentation found
const CAN_RXF2SIDL = 0x09
No documentation found
const CAN_RXM1EID8 = 0x26
No documentation found
const CAN_ERRIE = 0x20
No documentation found
const CAN_SJW2 = 0x40
No documentation found
const CAN_TX0IF = 0x04
No documentation found
const CAN_MODE_CONFIG = 0x80
No documentation found
const CAN_CNF3 = 0x28
CNF3 and fields
const CAN_TXB0EID0 = 0x34
No documentation found
const CAN_TXB0D7 = 0x3D
No documentation found
const CAN_RXB0EID8 = 0x63
No documentation found
const CAN_RXF5SIDL = 0x19
No documentation found
const CANINTE = 0x2B
CANINTE register and fields
const CAN_TXB1CTRL = 0x40
No documentation found
const CAN_ERRIF = 0x20
No documentation found
const CAN_WRITE_CMD = 0x02
MCP2515 Instructions ( SPI interface )
const CAN_RX1IE = 0x02
No documentation found
const CAN_TXB1SIDL = 0x42
No documentation found
const CAN_MODE_MASK = 0xE0
No documentation found
const CAN_RXB0D7 = 0x6D
No documentation found
const CAN_RXF1EID8 = 0x06
No documentation found
const CAN_READ_RX1_DATA = 0x96
No documentation found
const CAN_TXB2EID0 = 0x54
No documentation found
const CAN_RXB1D5 = 0x7B
No documentation found
const CAN_RTS_TX2 = 0x84
No documentation found
const CANINTF = 0x2C
CANINTF register and fields
const CAN_TXB2SIDH = 0x51
No documentation found
const CANSTAT = 0x0E
other misc registers
const CAN_TXB1D7 = 0x4D
No documentation found
const CAN_TXB2SIDL = 0x52
No documentation found
const CAN_TXB2D6 = 0x5C
No documentation found
const CAN_RX_STATUS_CMD = 0xB0
No documentation found
const CAN_RXB1D2 = 0x78
No documentation found
const CAN_SJW4 = 0xC0
No documentation found
const CAN_MERRF = 0x80
No documentation found
const CAN_EFLG = 0x2D
No documentation found
const CAN_TXB0D4 = 0x3A
No documentation found
const CAN_TXB2D3 = 0x59
No documentation found
const CAN_TEC = 0x1C
No documentation found
const CAN_RXF3EID0 = 0x13
No documentation found
const CAN_RXM0EID0 = 0x23
No documentation found
const CAN_RXB1SIDL = 0x72
No documentation found
const CAN_RXB0D0 = 0x66
No documentation found
const CAN_TXB1D5 = 0x4B
No documentation found
const CAN_TXB2D1 = 0x57
No documentation found
const CAN_RXM1EID0 = 0x27
No documentation found
const CAN_RXB0D5 = 0x6B
No documentation found
const CAN_LOAD_TX2 = 0x44
No documentation found
const CAN_TXB1SIDH = 0x41
No documentation found
const CAN_RXF1SIDL = 0x05
No documentation found
const CAN_WAKFIL_ENABLE = 0x40
No documentation found
const CAN_RXF2EID0 = 0x0B
No documentation found
const CAN_RXM0SIDL = 0x21
No documentation found
const CAN_RX1IF = 0x02
No documentation found
const CAN_TXB1EID8 = 0x43
No documentation found
const CAN_RXM0EID8 = 0x22
No documentation found
const CAN_TXB0D3 = 0x39
No documentation found
const CAN_SJW3 = 0x80
No documentation found
const CAN_RXF4EID0 = 0x17
No documentation found
const CAN_CNF1 = 0x2A
Bit-rate and related registers and fields. Big topic. See datasheet. CNF1 register and fields
const CAN_MODE_ONESHOT = 0x08
No documentation found
const CAN_RXB0D2 = 0x68
No documentation found
const CAN_RXF3EID8 = 0x12
No documentation found
const CAN_RXB1D7 = 0x7D
No documentation found
const CAN_TXB1D4 = 0x4A
No documentation found
const CAN_RXB1D0 = 0x76
No documentation found
const CAN_RXF4SIDL = 0x15
No documentation found
const CAN_TXB1D0 = 0x46
No documentation found
const CAN_RTS_ALL = 0x87
No documentation found
const CAN_TXB0SIDL = 0x32
No documentation found
const CAN_RX0IE = 0x01
No documentation found
const CAN_CLKOUT_ENABLE = 0x04
No documentation found
const CAN_TXB0DLC = 0x35
No documentation found
const CAN_RXB1EID8 = 0x73
No documentation found
const CAN_RXB1DLC = 0x75
No documentation found
const CAN_RXF4EID8 = 0x16
No documentation found
const CAN_TXB0D0 = 0x36
No documentation found
const CAN_REC = 0x1D
No documentation found
const CAN_SAMPLE_3X = 0x40
No documentation found
const CAN_WAKIE = 0x40
No documentation found
const CAN_RXB1CTRL = 0x70
No documentation found
const CAN_CNF2 = 0x29
CNF2 register and fields
const CAN_RXB0CTRL = 0x60
Each receive buffer has a control register, header registers, length register and (up to ) eight bytes of payload.
const CAN_TX0IE = 0x04
No documentation found
const CAN_WAKIF = 0x40
No documentation found
const CAN_TXB1D6 = 0x4C
No documentation found
const CAN_RXB1D3 = 0x79
No documentation found
const CAN_TX1IE = 0x08
No documentation found
const CAN_BTLMODE = 0x80
No documentation found
const CAN_SAMPLE_1X = 0x00
No documentation found
const CAN_SOF_DISABLE = 0x00
No documentation found
const CAN_TXB0D6 = 0x3C
No documentation found
const CAN_TX2IF = 0x10
No documentation found
const CAN_RXB1D4 = 0x7A
No documentation found
const CAN_RXF1EID0 = 0x07
No documentation found
const CAN_RXF0EID0 = 0x03
No documentation found
const CAN_RXF5SIDH = 0x18
RXB1 filter #5
const CAN_RXF3SIDH = 0x10
RXB1 filter #3
const CAN_RXF0EID8 = 0x02
No documentation found
const CAN_CLKOUT_PS1 = 0x00
No documentation found
const CAN_RXF3SIDL = 0x11
No documentation found
const CAN_RXB0D3 = 0x69
No documentation found
const CAN_CLKOUT_PS2 = 0x01
No documentation found
const CAN_ABORT_TX = 0x10
No documentation found
const CAN_RXM0SIDH = 0x20
RXB0 mask
const CAN_READ_CMD = 0x03
No documentation found
const CAN_READ_STATUS_CMD = 0xA0
No documentation found
const CAN_TXB0EID8 = 0x33
No documentation found
const CAN_TXB1D1 = 0x47
No documentation found
const CAN_RXB1D6 = 0x7C
No documentation found
const CAN_TXB2D5 = 0x5B
No documentation found
const CAN_LOAD_TX1 = 0x42
No documentation found
const CAN_RXF1SIDH = 0x04
RXB0 filter #1
const CAN_TXB1DLC = 0x45
No documentation found
const CAN_RXM1SIDH = 0x24
RXB1 mask
const CAN_READ_RX0_DATA = 0x92
No documentation found
const CAN_RXF5EID8 = 0x1A
No documentation found
const CAN_RXB0SIDH = 0x61
No documentation found
const CAN_TXB2EID8 = 0x53
No documentation found
const CAN_TXB1EID0 = 0x44
No documentation found
const CANCTRL = 0x0F
CANCTRL register and fields
const CAN_TXB2CTRL = 0x50
No documentation found
const CAN_BITMOD = 0x05
No documentation found
const CAN_RTS_TX1 = 0x82
No documentation found
const CAN_TXB2D2 = 0x58
No documentation found
const CAN_RXB0D1 = 0x67
No documentation found
const CAN_RXF0SIDL = 0x01
No documentation found
const CAN_RXF0SIDH = 0x00
RXB0 filter #0
const CAN_RXF2SIDH = 0x08
RXB1 filter #2
const CAN_TXB0D2 = 0x38
No documentation found
const CAN_RX0IF = 0x01
No documentation found
const CAN_MERRE = 0x80
No documentation found
const CAN_MODE_LOOPBACK = 0x40
No documentation found
const CAN_TXB2D4 = 0x5A
No documentation found
const CAN_TXB0D5 = 0x3B
No documentation found
const CAN_RXB0EID0 = 0x64
No documentation found
const CAN_MODE_NORMAL = 0x00
No documentation found
const CAN_WAKFIL_DISABLE = 0x00
No documentation found
const CAN_RXB0D4 = 0x6A
No documentation found
const CAN_TXB0CTRL = 0x30
Three transmit buffers. Each transmit buffer has a control register, header registers, length register and (up to ) eight bytes of payload.
const CAN_RXF4SIDH = 0x14
RXB1 filter #4
const CAN_TX2IE = 0x10
No documentation found
const CAN_RESET_CMD = 0xC0
No documentation found
const CAN_MODE_LISTENONLY = 0x60
No documentation found
const CAN_MODE_POWERUP = 0xE0
No documentation found
const CAN_RTS_TX0 = 0x81
No documentation found
const CAN_RXF2EID8 = 0x0A
No documentation found
can_encode_std_id(dword in out can_id)
No documentation found
can_set_rxb1_filter3(byte in sidh, byte in sidl, byte in eid8, byte in eid0)
set RXB1 acceptance filter #3
can_encode_ext_id(dword in out can_id)
No documentation found
can_encode_rtr_id(dword in out can_id)
No documentation found
can_set_rxb0_filter0(byte in sidh, byte in sidl, byte in eid8, byte in eid0)
set RXB0 acceptance filter #0
can_write(byte in addr, byte in data)
mcp2515 write instruction (single byte) writes the value to the specified register
can_set_rxb1_filter4(byte in sidh, byte in sidl, byte in eid8, byte in eid0)
set RXB1 acceptance filter #4
can_set_rxb0_filter1(byte in sidh, byte in sidl, byte in eid8, byte in eid0)
set RXB0 acceptance filter #1
can_set_rxb1_filter2(byte in sidh, byte in sidl, byte in eid8, byte in eid0)
set RXB1 acceptance filter #2
can_set_rxb1_filter5(byte in sidh, byte in sidl, byte in eid8, byte in eid0)
set RXB1 acceptance filter #5
can_set_rxb1_mask(byte in sidh, byte in sidl, byte in eid8, byte in eid0)
set RX acceptance mask for buffer RXB1 N.B. calling with 0,0,0,0 will pass all messages
can_reset()
mcp2515 Reset instruction. Puts the mcp2515 in Configuration Mode.
can_set_config(byte in p1, byte in p2, byte in p3)
set bit-rate and related can bus configuration. see datasheet for details. N.B. The chip must already be in 'configuration mode'.
can_set_rxb0_mask(byte in sidh, byte in sidl, byte in eid8, byte in eid0)
set RX acceptance mask for buffer RXB0 N.B. calling with 0,0,0,0 will pass all messages
can_send(byte in buf_no, dword in can_id, byte in buf[8], byte in len) return bit
send CAN frame Non-blocking -- function returns immediately if buffer is busy (in-use) FIXME. this is ugly code
can_is_ext_id(dword in can_id) return bit
No documentation found
can_is_rtr_id(dword in can_id) return bit
No documentation found
can_rx_status() return byte
mcp2515 RX status instruction
can_read_status() return byte
mcp2515 read status instruction
can_is_error_id(dword in can_id) return bit
FIXME: will we ever need this?
can_read(byte in addr) return byte
mcp2515 read instruction (single byte) returns the current value of the specified register
can_is_std_id(dword in can_id) return bit
No documentation found
can_receive(byte in buf_no, dword out can_id, byte out buf[8], byte out len) return bit
receive CAN frame, sets can_id flag bits as to standard/extended, error, and remote. Non-blocking -- function returns immediately if no message is available. FIXME. this is ugly code
16f819 | 16f819_mcp2515_can_monitor.jal |
16f819 | 16f819_canopen_mcp2515_txhb.jal |
16f819 | 16f819_mcp2515_canid4_monitor.jal |