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

vcfg on 12f675

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







vcfg on 12f675
PostPosted: Tue Mar 18, 2003 2:30 pm     Reply with quote

The only way I can get the external ref voltage to work on the 12f675 is to set the VCFG bit. Should the setup_adc or setup_adc_ports set this bit for me?

eg . setup_adc_ports(VREF||AN2_analog)

Thanks

Andrew
___________________________
This message was ported from CCS's old forum
Original Post ID: 12805
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

Re: vcfg on 12f675
PostPosted: Tue Mar 18, 2003 3:36 pm     Reply with quote

:=The only way I can get the external ref voltage to work on the 12f675 is to set the VCFG bit. Should the setup_adc or setup_adc_ports set this bit for me?
:=
:=eg . setup_adc_ports(VREF||AN2_analog)
------------------------------------------------------------

I don't think that works. The compiler doesn't appear to be
able to support the VCFG bit with the built-in ADC functions.
I tested it with PCM vs. 3.148. I think you have to do this:


#bit VCFG_BIT = 0x1F.6 // Define address of VCFG bit

void main()
{

// Put ADC setup functions here.

// The following line must go after the setup_adc() function.
VCFG_BIT = 1; // Enable the Vref pin

while(1);
}

-------------------------------------------------
Also, when you combine parameters like this, you must use the
Bitwise OR operator. You're using the Logical OR operator, and
that won't work.

setup_adc_ports(VREF ||AN2_analog)

(You still have to use the code I posted above. I'm just
mentioning this for future reference).
___________________________
This message was ported from CCS's old forum
Original Post ID: 12809
Andrew Sheppard
Guest







Re: vcfg on 12f675
PostPosted: Wed Mar 19, 2003 7:54 am     Reply with quote

Thanks, that is what I found as well but wanted some confirmation that I was not using the functions correctly. As for the or, a typo in my message.

Thanks again.

PS. also having trouble with gp3. all my other ports work as expected. However I can not get gp3 to work. I have indicated NOMCLR in my fuses line. I have tested it on two devices with the same results.

Any hints on this one.

Andrew


:=:=The only way I can get the external ref voltage to work on the 12f675 is to set the VCFG bit. Should the setup_adc or setup_adc_ports set this bit for me?
:=:=
:=:=eg . setup_adc_ports(VREF||AN2_analog)
:=------------------------------------------------------------
:=
:=I don't think that works. The compiler doesn't appear to be
:=able to support the VCFG bit with the built-in ADC functions.
:=I tested it with PCM vs. 3.148. I think you have to do this:
:=
:=
:=#bit VCFG_BIT = 0x1F.6 // Define address of VCFG bit
:=
:=void main()
:={
:=
:=// Put ADC setup functions here.
:=
:=// The following line must go after the setup_adc() function.
:=VCFG_BIT = 1; // Enable the Vref pin
:=
:=while(1);
:=}
:=
:=-------------------------------------------------
:=Also, when you combine parameters like this, you must use the
:=Bitwise OR operator. You're using the Logical OR operator, and
:=that won't work.
:=
:=setup_adc_ports(VREF ||AN2_analog)
:=
:=(You still have to use the code I posted above. I'm just
:=mentioning this for future reference).
___________________________
This message was ported from CCS's old forum
Original Post ID: 12832
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

Re: vcfg on 12f675
PostPosted: Wed Mar 19, 2003 2:52 pm     Reply with quote

:=
:= also having trouble with gp3. all my other ports work as expected. However I can not get gp3 to work. I have indicated NOMCLR in my fuses line. I have tested it on two devices with the same results.
--------------------------------------------------------------

GP3 can only be an input. It doesn't have an output driver.
Section 3.3.4 of the 12F675 data sheet says it can only be
configured as a MCLR input or a general purpose input.
___________________________
This message was ported from CCS's old forum
Original Post ID: 12851
Andrew Sheppard
Guest







Re: vcfg on 12f675
PostPosted: Wed Mar 19, 2003 3:49 pm     Reply with quote

Thanks for the response.

I should have been more clear. I wanted it to be an analog input. After rechecking the pinout found that the analog port I need to use is on pin 3. Thabks

And by the way, How do you guys know all these specs of the various devices like it is on the back of your hand?

Andrew


:=:=
:=:= also having trouble with gp3. all my other ports work as expected. However I can not get gp3 to work. I have indicated NOMCLR in my fuses line. I have tested it on two devices with the same results.
:=--------------------------------------------------------------
:=
:=GP3 can only be an input. It doesn't have an output driver.
:=Section 3.3.4 of the 12F675 data sheet says it can only be
:=configured as a MCLR input or a general purpose input.
___________________________
This message was ported from CCS's old forum
Original Post ID: 12852
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

Re: vcfg on 12f675
PostPosted: Wed Mar 19, 2003 4:08 pm     Reply with quote

:=Thanks for the response.
:=
:=I should have been more clear. I wanted it to be an analog input. After rechecking the pinout found that the analog port I need to use is on pin 3. Thabks
:=
:=And by the way, How do you guys know all these specs of the various devices like it is on the back of your hand?
:=
:=Andrew
:=
:=
------------------------------------------------------

Actually, I don't know them all. :)

I go here, and type in, for the group: comp.arch.embedded.*
<a href="http://groups.google.com/advanced_group_search" TARGET="_blank">http://groups.google.com/advanced_group_search</a>
That gets some of the piclist archives, which is where I
think the answer will be. I search for: 12F675 GP3

Then I read the posts and find one that complains that GP3
doesn't work. One person says that GP3 is input only.
I take a quick look at the 12F675 data sheet and confirm this.
Then I post the answer here.

Now, I do know (or remember) a lot of the facts. But I also
use the internet as a brain amplifier.
___________________________
This message was ported from CCS's old forum
Original Post ID: 12853
R.J.Hamlett
Guest







Re: vcfg on 12f675
PostPosted: Thu Mar 20, 2003 4:32 am     Reply with quote

:=:=Thanks for the response.
:=:=
:=:=I should have been more clear. I wanted it to be an analog input. After rechecking the pinout found that the analog port I need to use is on pin 3. Thabks
:=:=
:=:=And by the way, How do you guys know all these specs of the various devices like it is on the back of your hand?
:=:=
:=:=Andrew
:=:=
:=:=
:=------------------------------------------------------
:=
:=Actually, I don't know them all. <img src="http://www.ccsinfo.com/pix/forum/smile.gif" border="0">
:=
:=I go here, and type in, for the group: comp.arch.embedded.*
:= <a href="http://groups.google.com/advanced_group_search" TARGET="_blank"> <a href="http://groups.google.com/advanced_group_search" TARGET="_blank">http://groups.google.com/advanced_group_search</a></a>
:=That gets some of the piclist archives, which is where I
:=think the answer will be. I search for: 12F675 GP3
:=
:=Then I read the posts and find one that complains that GP3
:=doesn't work. One person says that GP3 is input only.
:=I take a quick look at the 12F675 data sheet and confirm this.
:=Then I post the answer here.
:=
:=Now, I do know (or remember) a lot of the facts. But I also
:=use the internet as a brain amplifier.
Also, I suspect you would have 'expected' this, since the pin behaves the same on the 12C508, 12C67x etc.
There is a lot of 'commonality' in PIC I/O, allowing a significant reduction in the amount of data needing to be held. Hence if somebody talks about a problem with (say) Port A4, there is an allmost instinctive thought of 'open collector drive only', while a reference to GP3, links to 'input only', and one to RB6/RB7, ties to 'ICD'.
Obviously the 'brain amplifier' then allows this to be checked. :-)

Best Wishes
___________________________
This message was ported from CCS's old forum
Original Post ID: 12864
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