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

Strange Phantom Register / ICD40 / Debug Problem

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



Joined: 02 Dec 2003
Posts: 262

View user's profile Send private message

Strange Phantom Register / ICD40 / Debug Problem
PostPosted: Tue Aug 08, 2006 8:16 pm     Reply with quote

Hi all,

I have a problem with one a new board that uses the comparator setup in mode 110. Its a pic18f4680, D1 is tied to my input, D3, D1 are ground and D2 I use as an output when the compator is off (its tied to a pull up but floating when comparator is on. The comparator is used for waking only. So its not working now and I'm not sure if its a hardware or software problem. It almost seems like its using VREF- and VREF+ as the comparator + b/c if I leave it floating and touch those two it triggers the comparator. Very confusing.

Anyway, here is my code:

Code:

#byte CVRCON = 0xFB5


 setup_vref(VREF_HIGH | 11 | VREF_COMP); //2.96875V
 setup_comparator(0x0AFF06); //C1OUT == 1 below 3V

 printf("cV : %2X", CVRCON);

 sleep();


While debugging the RAM and Misc MPU Registers window both show cVRCON to be 01 or 05 depending on where I stop the code.

The output window shows cV : 9B

Compiler version is 3.242. I'll go get 3.249 when I get a change... Is this a bug ???? Cause its REALLY hard to figure out whats going on here.

Thanks
iso9001



Joined: 02 Dec 2003
Posts: 262

View user's profile Send private message

PostPosted: Wed Aug 09, 2006 1:35 am     Reply with quote

Wow. Makes me wonder if anyone at CCS or anyone using CCS has ever used the comparator / vref module ... ?

Since not only does the debug not show the data from 0xFB5 correctly, but the setup_vref() does not work correctly.

I was researching my problem and found this:
http://forum.microchip.com/tm.aspx?m=179537&mpage=1&#180403, its a guy who found an error on a datasheet about the 'use vdd-vss as ref' or 'use vref+ - vref- as ref' selector. It got me thinking to check my datasheet (which is correct) and I come to see that ccs's vref_setup() (= 0x9B) is setting the CVRSS (comp voltage reference source select) to a 1... according to my datasheet this should most certainly be a zero.

Either CCS got it right and my board is really screwed up AND the datasheet is wrong in 2 matching places.... or The datasheet is right, and I'm experiencing problems when my vref pins are floating b/c ccs's setup_vref is most very wrong.


I think there is a danger is making the pic too far removed from the user with all these setup_bla() functions even if it does help noobs get started.

Still this doesn't explain why debug window shows incorrect data in 3 different places.
iso9001



Joined: 02 Dec 2003
Posts: 262

View user's profile Send private message

PostPosted: Wed Aug 09, 2006 2:03 pm     Reply with quote

It would have been easier to figure out if the debug actually displayed the correct data or if the setup_vref() was not completely transparent to the user.

No one, not even CCS can tell me why the monitor/ram/Misc MPU pages all display the wrong data for CVRCON ?

I'm figuring that setup_vref() setting the CVRSS bit wrong is just a bug for the device I'm using...
iso9001



Joined: 02 Dec 2003
Posts: 262

View user's profile Send private message

PostPosted: Thu Aug 10, 2006 7:21 pm     Reply with quote

Yep...... Gets Even Better !!!!!

I spent the entire day trying to figure out why oh why does my EXT_INT not work...... Tried everything. Made a small program it works fine, larger program, nada.... Confusing...

Took my own advice and just assumed the compiler was wrong... it is.

The RB0 pin was configed to trigger on falling edge, but would NOT interupt... and do you know why ?? B/C the ADC was turned off right before I entered sleep...

Looking at the ASM I saw that FC1 (ADCON1) was getting C0 written to it. An invalid value for my pic. Should have been bit 0 in ADCON0.


Someone posted something not too long ago about having enough work fixing thier own code and not needing to debug CCS's compiler as well. I may be ranting but I'm 3 days behind on a time sensitive project b/c the compiler was NOT tested for this pic that it 'supports'...

If your not going to test it.... AT LEAST TELL US!
Guest








PostPosted: Mon Aug 14, 2006 5:07 pm     Reply with quote

Iso,

Sheesh! I always love to read about the guy who's "time-sensitive" project is delayed by a bug in the $125.00 compiler. Did you ever think that there was a reason it was so inexpensive? Ummm, how much testing do you think they're gonna be able to afford to do at that price? I think it's a great product, but in the end, we're all beta testers of a sort!

Want some cheese with your whine Laughing ?

The Phantom
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