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 CCS Technical Support

Solved: Compiler bug for PIC18F26K22

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



Joined: 08 Jan 2010
Posts: 137
Location: Michigan

View user's profile Send private message Visit poster's website

Solved: Compiler bug for PIC18F26K22
PostPosted: Thu Apr 14, 2011 11:47 am     Reply with quote

Just a heads up:

With the 4.120 compiler

I'm almost positive that the compiler has a bug at least for this chip. If you try to enable WDT either in hardware or under software control, it will not actually set the relevant config bits and you won't really have WDT enabled. You have to manually set the bits in the output hex file.

If anyone else is using a K22 chip it would be interesting to have confirmation if it's happening to anyone else or if an older compiler version doesn't mess up.


Last edited by collink on Thu Apr 14, 2011 1:09 pm; edited 1 time in total
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Apr 14, 2011 11:50 am     Reply with quote

If using you're "ICD=TRUE", or the DEBUG fuse, or possibly other means,
this will put the PIC in debug mode, and WDT is not allowed in that mode.
It will be disabled for you (without informing you of this).

Are you in Debug mode ?
collink



Joined: 08 Jan 2010
Posts: 137
Location: Michigan

View user's profile Send private message Visit poster's website

PostPosted: Thu Apr 14, 2011 11:56 am     Reply with quote

PCM programmer wrote:
If using you're "ICD=TRUE", or the DEBUG fuse, or possibly other means,
this will put the PIC in debug mode, and WDT is not allowed in that mode.
It will be disabled for you (without informing you of this).

Are you in Debug mode ?


Shouldn't be either one.

I have "#fuse NODEBUG" and I do not have ICD=TRUE
collink



Joined: 08 Jan 2010
Posts: 137
Location: Michigan

View user's profile Send private message Visit poster's website

PostPosted: Thu Apr 14, 2011 11:58 am     Reply with quote

In fact, for completeness, here are my fuses:

#fuses INTRC

#fuses WDT_SW //enable software control of WDT
#fuses WDT32 //32x prescaler
#fuses NOPLLEN //Allow the code to turn PLL on or off. Defaults to off
#fuses NOMCLR,NOWDT,NOBROWNOUT,BORV20,NOLVP
#fuses NODEBUG //don't enable chip level debugging
//fuses related to code and data protection:
#fuses PROTECT,CPD,CPB,NOWRT,NOWRTD,NOWRTB,NOWRTC,NOEBTR,NOEBTRB

I'm reasonably sure that those should all be kosher.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Apr 14, 2011 12:35 pm     Reply with quote

This test program does set WDT in the Config bits. (With vs. 4.120)
Code:

#include <18F26K22.h>
#fuses INTRC_IO, WDT, NOPLLEN 
#use delay(clock=4M)

//===================================
void main()
{

while(1);
}
 

Quote:

Configuration Fuses:
Word 1: E800 INTRC_IO NOPLLEN PRIMARY FCMEN IESO
Word 2: 3F1E PUT BROWNOUT BORV20 WDT WDT32768
Word 3: BF00 CCP2C1 PBADEN CCP3B5 HFOFST TIMER3C0 CCP2B5 MCLR
Word 4: 0081 STVREN NOLVP NOXINST NODEBUG
Word 5: C00F NOPROTECT NOCPB NOCPD
Word 6: E00F NOWRT NOWRTC NOWRTB NOWRTD
Word 7: 400F NOEBTR NOEBTRB
collink



Joined: 08 Jan 2010
Posts: 137
Location: Michigan

View user's profile Send private message Visit poster's website

PostPosted: Thu Apr 14, 2011 12:46 pm     Reply with quote

Hmmm... I just noticed that I didn't update to 4.120 on this machine (it's got 4.119 installed). I wonder if that makes a difference. I'll try it out later on my laptop and see if it works on 4.120 but not on 4.119

Well, thank you for testing on your end. Now it's likely something I did wrong one way or the other; either I forgot to update the compiler on this machine or I did something screwy to the program...
collink



Joined: 08 Jan 2010
Posts: 137
Location: Michigan

View user's profile Send private message Visit poster's website

NOT a compiler bug
PostPosted: Thu Apr 14, 2011 1:08 pm     Reply with quote

Turns out it was a brain bug not a compiler bug. Look back a few posts where I posted my whole fuses list. See the NOWDT buried in there on the middle fuses line? ARghhh....
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