Well, I've connected the board to a PC using a CANUSB adapter listening at 100Kbps, but does not receive anything. This is the code (18F258+MCP2510 20Mhz):
Code:
define OSC 20
TRISB = %000001000 'portb.2 output, portb.3 input
CANCON = $80 'configuration mode
'Set Data Rate based on 20Mhz to get 100 kbs:
BRGCON1 = $04
BRGCON2 = $BF
BRGCON3 = $02
CIOCON = $10
TXB0SIDH = $0
TXB0SIDL = $1
CANCON = $0 'normal mode
'
' Program
'
Main:
TXB0DLC = 8
TXB0D0 = 65
TXB0D1 = 66
TXB0D2 = 67
TXB0D3 = 68
TXB0D4 = 69
TXB0D5 = 70
TXB0D6 = 71
TXB0D7 = 72
TXB0CON = 8
pause 1000
Goto main
End
What's wrong?
Bookmarks