Rev 91 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 91 | Rev 96 | ||
|---|---|---|---|
| Line 2... | Line 2... | ||
| 2 | * |
2 | * |
| 3 | * Main application |
3 | * Main application |
| 4 | * |
4 | * |
| 5 | ********************************************************************* |
5 | ********************************************************************* |
| 6 | * FileName: $HeadURL: https://svn.auml.se/svn/HomeAutomation/trunk/EmbeddedSoftware/PIC/canBoot/Source/Main.c $ |
6 | * FileName: $HeadURL: https://svn.auml.se/svn/HomeAutomation/trunk/EmbeddedSoftware/PIC/canBoot/Source/Main.c $ |
| 7 | * Last changed: $LastChangedDate: 2006-11-14 |
7 | * Last changed: $LastChangedDate: 2006-11-14 21:11:45 +0100 (Tue, 14 Nov 2006) $ |
| 8 | * By: $LastChangedBy: johboh $ |
8 | * By: $LastChangedBy: johboh $ |
| 9 | * Revision: $Revision: |
9 | * Revision: $Revision: 96 $ |
| 10 | ********************************************************************/ |
10 | ********************************************************************/ |
| 11 | 11 | ||
| 12 | #include <compiler.h> |
12 | #include <compiler.h> |
| 13 | #include <stackTasks.h> |
13 | #include <stackTasks.h> |
| 14 | #include <CANdefs.h> |
14 | #include <CANdefs.h> |
| Line 410... | Line 410... | ||
| 410 | BRGCON3bits.SEG2PH2 = 0; |
410 | BRGCON3bits.SEG2PH2 = 0; |
| 411 | BRGCON3bits.SEG2PH1 = 0; |
411 | BRGCON3bits.SEG2PH1 = 0; |
| 412 | BRGCON3bits.SEG2PH0 = 1; |
412 | BRGCON3bits.SEG2PH0 = 1; |
| 413 | 413 | ||
| 414 | ECANCON=0; |
414 | ECANCON=0; |
| 415 | ECANCONbits.MDSEL1 = |
415 | ECANCONbits.MDSEL1 = 1; |
| 416 | ECANCONbits.MDSEL0 = |
416 | ECANCONbits.MDSEL0 = 0; |
| 417 | 417 | ||
| 418 | 418 | ||
| 419 | // FILTERS AND MASKS |
419 | // FILTERS AND MASKS |
| 420 | RXB0CONbits.RXM1=1; |
420 | RXB0CONbits.RXM1=1; |
| 421 | RXB0CONbits.RXM0=0; |
421 | RXB0CONbits.RXM0=0; |
| Line 460... | Line 460... | ||
| 460 | */ |
460 | */ |
| 461 | BOOL canGetPacket() |
461 | BOOL canGetPacket() |
| 462 | { |
462 | { |
| 463 | 463 | ||
| 464 | // Get which buffer that is ful. |
464 | // Get which buffer that is ful. |
| 465 |
|
465 | ECANCON=(ECANCON&0b00000)|(0b10000|(CANCON&0x0F)); |
| 466 | else if (RXB1CONbits.RXFUL) { ECANCON=(ECANCON&0b00000)|0b10001; } |
- | |
| 467 | else if (B0CONbits.RXFUL) { ECANCON=(ECANCON&0b00000)|0b10010; } |
- | |
| 468 | else if (B1CONbits.RXFUL) { ECANCON=(ECANCON&0b00000)|0b10011; } |
- | |
| 469 | else if (B2CONbits.RXFUL) { ECANCON=(ECANCON&0b00000)|0b10100; } |
- | |
| 470 | else if (B3CONbits.RXFUL) { ECANCON=(ECANCON&0b00000)|0b10101; } |
- | |
| 471 | else if (B4CONbits.RXFUL) { ECANCON=(ECANCON&0b00000)|0b10110; } |
- | |
| 472 | else if (B5CONbits.RXFUL) { ECANCON=(ECANCON&0b00000)|0b10111; } |
- | |
| 473 |
|
466 | if (!RXB0CONbits.RXFUL) return FALSE; |
| 474 | - | ||
| 475 | 467 | ||
| 476 | //RXB0SIDH 28 27 26 25 24 23 22 21 |
468 | //RXB0SIDH 28 27 26 25 24 23 22 21 |
| 477 | //RXB0SIDL 20 19 18 xx xx xx 17 16 |
469 | //RXB0SIDL 20 19 18 xx xx xx 17 16 |
| 478 | //RXB0EIDH 15 14 13 12 11 10 09 08 |
470 | //RXB0EIDH 15 14 13 12 11 10 09 08 |
| 479 | //RXB0EIDL 07 06 05 04 03 02 01 00 |
471 | //RXB0EIDL 07 06 05 04 03 02 01 00 |