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

Anyone compiled OK for Pic10F206 ? - setup_comparator

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



Joined: 21 Sep 2003
Posts: 5

View user's profile Send private message

Anyone compiled OK for Pic10F206 ? - setup_comparator
PostPosted: Fri Nov 26, 2004 2:08 pm     Reply with quote

Hi

I?ve just received my first Pic10F206's and tried to compile the code below (just to get going - created by the project wizard) and it fails with error 12, highlighting the ?setup_comparator? statement.


Code:
#include "C:\Program Files\PICC\pic10f206\test.h"
void main()
{
   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
   setup_comparator(NC_NC_NC_NC);
}

I'm using Compiler / IDE version 3.212
Test.h contains:-
Code:
#include <10F206.h>
#use delay(clock=4000000)
#fuses NOWDT

I cannot figure out what's wrong. It seems like the compiler thinks that this device doesn't have a comparator.

Can you please let me know what I'm doing wrong please?

Thanks

Les Otter
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Nov 26, 2004 2:47 pm     Reply with quote

When CCS adds support for a new chip, they very frequently make
mistakes with the A/D and the comparator modules. Based on
your post, it appears that they have done this with the comparator
in the 10F206.

You should email them about this, but in the meantime, you can
setup the comparator yourself by defining the register address of
the CMCON0 register, and then writing a byte directly to that register.
Refer to the 10F206 data sheet for the correct settings for CMCON0.

Example:

Code:
#include <10F206.H>
(Put your #use delay and #fuses statements here)

#byte CMCON0 = 0x07   // Define the address of CMCON0

void main()
{
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
CMCON0 = 0xFF;    // Setup the Comparator

// Put other code here.

while(1);   // Prevent PIC from going to Sleep
}
lesotter



Joined: 21 Sep 2003
Posts: 5

View user's profile Send private message

PostPosted: Sat Nov 27, 2004 12:17 am     Reply with quote

Thanks very much - tried as you said and it now compiles - inching forward now looking for the next "new device" issue
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