View previous topic :: View next topic |
Author |
Message |
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
certain && for sure disabling CAN bus 18f458 |
Posted: Sun Sep 27, 2009 2:42 pm |
|
|
OK - so i read the ccs header file for the 18f458 ( no can related entries)
and then the datasheet, which seems to say that the CAN module is not actually enabled at power on by default.
BUT darned if i can find any reference or discussion in the CCS doc on how to be dead sure that the CAN module is DISABLED 100% when using das compiler.
Having been solidly burned before by missing subtleties of PIC startup INIT coding, i'd be grateful for any comments that could point me toward a certainty of being able to init said chip but be positive that CAN was no way functional or being a pin vampire that i am not expecting.
tx |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Sep 27, 2009 3:09 pm |
|
|
The 18F458 data sheet shows that the OPMODE bits in the CANSTAT
register default to Configuration Mode. The block diagram for the i/o
pins appears to show that the CANTX signal is only enabled for output if
the OPMODE bits are in Normal Mode. Therefore, it appears that CANTX
is disabled upon power-on reset.
Compiling a short test program shows that the startup code does not
write to the CANCON register. Therefore, it appears that the CANTX
pin will remain disabled.
Code: |
.... void main()
.... {
0004: CLRF TBLPTRU
0006: BCF RCON.IPEN
0008: CLRF FSR0H
000A: CLRF FSR0L
000C: BSF ADCON1.PCFG0
000E: BSF ADCON1.PCFG1
0010: BSF ADCON1.PCFG2
0012: BCF ADCON1.PCFG3
0014: MOVLW 07
0016: MOVWF CMCON
.... while(1);
0018: BRA 0018
|
Test program:
Code: |
#include <18F458.h>
#fuses HS, PUT, BROWNOUT, NOWDT, NOLVP
#use delay(clock=20000000)
//=============================
void main()
{
while(1);
} |
|
|
|
|