CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

certain && for sure disabling CAN bus 18f458

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

certain && for sure disabling CAN bus 18f458
PostPosted: Sun Sep 27, 2009 2:42 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Sun Sep 27, 2009 3:09 pm     Reply with quote

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);
}
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group