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

PIC12F683 pullup problem

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








PIC12F683 pullup problem
PostPosted: Fri Jul 18, 2008 9:42 am     Reply with quote

Problem with pullup on GP0,GP2,GP3. GP1 is the only pin pulled up.


Code:
#FUSES INTRC_IO

setup_oscillator(OSC_8MHZ|OSC_INTRC);
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_comparator(NC_NC_NC_NC);
port_a_pullups(TRUE);


Some help please...
Ttelmah
Guest







PostPosted: Fri Jul 18, 2008 10:07 am     Reply with quote

Look at the manual.
Note the first line in the section 'parameters'. 'TRUE', and 'FALSE', _only_applies to parts that have a 'global' pullup (just one instruction to turn them on for the whole port). For parts with the individual bits, you need to use the 'UPMASK' syntax. So:

port_a_pullups(0b00001111);

To turn on the low four pullups.

Best Wishes
Guest








PostPosted: Fri Jul 18, 2008 2:41 pm     Reply with quote

Thanks for reply.

hmmm. On another chip 18F2455 I use the command
Code:
port_b_pullups(TRUE);
and this command work on all pin on port B.

I understand you as this command doesn't work on the 12F683, is this right?
Guest








PostPosted: Fri Jul 18, 2008 2:47 pm     Reply with quote

On page 34(REGISTER 4-4: WPU: WEAK PULL-UP REGISTER) in the data sheet there are a description of the pin, is that the same as using port_a_pullups(TRUE); or port_a_pullups(0b00110111)?
Ttelmah
Guest







PostPosted: Fri Jul 18, 2008 3:00 pm     Reply with quote

The 18F2455, only has a _single_ 'pullup enable' bit, that turns on all the pullups. This is the point. 95% of PIC's have the pullups like this. A few have individual pullups, and on these the 'upmask' syntax has to be used. This is what the manual says, if you read the command syntax.
The key is the data sheet. Section 10.2, for the 2455, third paragraph: "A single control bit can turn on all the pullups". On the 12F683 chip, there is instead a bit for each input bit. You turn on just the ones you want. 0b00001111, is to potentially turn on pullups, on GP0, GP1, GP2, and GP3, which is what you asked for, but GP3, does not have a pullup, so the top bit will be ignored. 0b00110111, turns them on for GP0, GP1, GP2, GP4, and GP5.

Best Wishes
Guest








PostPosted: Fri Jul 18, 2008 3:07 pm     Reply with quote

Hi

Thanks for support, your 100% right it work now:-)

Thanks.
sambyte



Joined: 29 Dec 2008
Posts: 12

View user's profile Send private message

PostPosted: Mon Jan 05, 2009 10:39 pm     Reply with quote

The code generator, 'PIC Wizard' should have the option to select which bit is to enable/disable rather than just doing the global pullup bit.!!
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Tue Jan 06, 2009 2:52 pm     Reply with quote

I think your suggestion is a welcome extension to the CCS compiler, but... this forum is a User's Forum only. The CCS employees are rarely seen here. Check the message at the top right of this page, bugs (and feature requests) should be emailed to the mentioned address.
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