saucompeng
Joined: 19 Jul 2011 Posts: 4
|
Canbus Can-18xx8.c How to customise ? |
Posted: Tue Jul 19, 2011 1:26 am |
|
|
Hi ;
I make a electronic circuit for read Can messages from can network. I must read 1Mbit/s can network , but my circuit doesn't read. I used 18F4585( 20mhz osc) +MCP2551.
I think, this code don't agree for my system.
Code: |
void can_set_baud(void) {
BRGCON1.brp=CAN_BRG_PRESCALAR;
BRGCON1.sjw=CAN_BRG_SYNCH_JUMP_WIDTH;
BRGCON2.prseg=CAN_BRG_PROPAGATION_TIME;
BRGCON2.seg1ph=CAN_BRG_PHASE_SEGMENT_1;
BRGCON2.sam=CAN_BRG_SAM;
BRGCON2.seg2phts=CAN_BRG_SEG_2_PHASE_TS;
BRGCON3.seg2ph=CAN_BRG_PHASE_SEGMENT_2;
BRGCON3.wakfil=CAN_BRG_WAKE_FILTER;
}
void can_set_mode(CAN_OP_MODE mode) {
CANCON.reqop=mode;
while( (CANSTAT.opmode) != mode );
} |
Please, customise can-18xx8.c for me, and send me?
Thanks a lot. Wait for your codes. |
|