View previous topic :: View next topic |
Author |
Message |
Luig Guest
|
can initialization problems |
Posted: Tue Jul 11, 2006 6:28 am |
|
|
I work with pic 18f4580 can library
I would like to know if I must use
can_set_functional mode
before or after can_init
I need also to know RXFILTER0 called "simple filter name" which pic register or registers point
Thank you |
|
|
iso9001
Joined: 02 Dec 2003 Posts: 262
|
|
Posted: Tue Jul 11, 2006 12:09 pm |
|
|
Look at the file.
You can see what init() does... Does init() call set_mode inside it? I don't have my ccs seat here so I can't tell you but its pretty easy to figure out.
RXFILTER0 's register is clearly defined in the datasheet as well as in the CCS driver, look for the #define RXFILTER part, near its structure.
Btw, from experience I can tell you to DUMP the ccs can driver! Its made for learning. It is not even close to efficient (even for C). It is very very easy to code your own driver and you will benifit from learning all the registers, controls, timing, and filtering on your own. It took me ~2 days to write the driver (and about a week for fully optimize it for what I'm doing). Time extremely well spent! |
|
|
Luig Guest
|
Thank you |
Posted: Tue Jul 11, 2006 2:10 pm |
|
|
I have not understood which driver You say to me it is better to use |
|
|
Luig Guest
|
|
Posted: Wed Jul 12, 2006 1:41 am |
|
|
In your reply You said nothing:
- You do not know what can_init contains
- there is no structure about RXFILTER0 only an address |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Jul 12, 2006 2:19 am |
|
|
Look in the can-18F450.h file. Look at the address of RXFILTER0
in the "simple filter names" list. Then find the same address in
the "Receive acceptance filter" list.
Quote: |
// simple filter names
#define RXFILTER0 0xF03
#define RXFILTER1 0xF07
#define RXFILTER2 0xF0B
#define RXFILTER3 0xF0F
#define RXFILTER4 0xF13 |
These are the PIC register names:
Quote: | // Receive acceptance filter n extended identifier
#byte RXF0EIDH=0xF02
#byte RXF0EIDL=0xF03
#byte RXF1EIDH=0xF06
#byte RXF1EIDL=0xF07
#byte RXF2EIDH=0xF0A
|
|
|
|
|