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

16f876a mclr sAN0

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



Joined: 03 Sep 2010
Posts: 8

View user's profile Send private message

16f876a mclr sAN0
PostPosted: Fri Sep 03, 2010 3:54 am     Reply with quote

Hi my mplab compiler on ccs language tools has shown error on the below statement

*** Error 111 "aCU_DET.c" Line 6(7,120): Unknown keyword in #FUSES "MCLR"
*** Error 12 "aCU_DET.c" Line 364(17,21): Undefined identifier MAIN sAN0
2 Errors, 0 Warnings.
Halting build on first failure

there are 2 statement on my code:

#fuses HS,NOWDT,PROTECT, BROWNOUT, PUT ,MCLR

setup_adc_ports(sAN0|sAN1|sAN2|sAN3) ;//SET 0-3 AS ANALOG

need some help. thanks
Ttelmah



Joined: 11 Mar 2010
Posts: 19538

View user's profile Send private message

PostPosted: Fri Sep 03, 2010 4:20 am     Reply with quote

1) You can only ever use fuses that a particular processor supports. These are listed at the top of the processor definition file.
2) The same applies to the options for things like setup_adc_ports. If definitions don't exist for particular things, it is (except in a few 'error' cases), because that particular processor doesn't support them.

Now, in your case, the 16F876A, does not support enabling/disabling the MCLR pin, so there is no MCLR or NOMCLR fuse option.
The 876A, also does not support the selection of individual ADC pins. There are only options to enable 'sets' of the pins, matching the options available in the data sheet. The combination you are trying to enable, is not one supported by the chip. Look at the data sheet, and the definitions in the include file.

Best Wishes
derricko



Joined: 03 Sep 2010
Posts: 8

View user's profile Send private message

PostPosted: Sat Sep 04, 2010 6:29 am     Reply with quote

hmmm.. I am a noob in this area. May I know how to program it? Embarassed
Ttelmah



Joined: 11 Mar 2010
Posts: 19538

View user's profile Send private message

PostPosted: Sat Sep 04, 2010 9:57 am     Reply with quote

Start with the data sheet.
Section 11-2.
This shows the possible options for the A/D converter, in the table for PCFG3:PCFG0

The option you are asking for _is not available_, so there is no possibility of 'programming it'. Nearest you can get, is the third line down in the table, with A0, to A4, all analog.
Then go into the header file for the processor. Look for the section on 'setup_adc_ports'. Find the line with the same pattern of analog pins.
Use this.

Just get rid of the MCLR fuse - the processor always has MCLR enabled, hence no fuse.

Try.
If you still fail, post a really simple program (maximum of about 15 lines - just the header, and basic code), and we will then see if we can help.

Best Wishes
derricko



Joined: 03 Sep 2010
Posts: 8

View user's profile Send private message

PostPosted: Sun Sep 05, 2010 4:50 am     Reply with quote

cool, i will give a try. thanks Very Happy
derricko



Joined: 03 Sep 2010
Posts: 8

View user's profile Send private message

PostPosted: Mon Sep 06, 2010 11:43 pm     Reply with quote

Thank you Ttelmah, I think 16f876a doesn't support well. I have got to switch to 16f886, it works.
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