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

pic12f683 weak pullups

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



Joined: 17 Oct 2005
Posts: 26

View user's profile Send private message

pic12f683 weak pullups
PostPosted: Tue Sep 15, 2009 9:00 am     Reply with quote

Hi, I am trying to enable the internal weak pullups on a pic 12f683 but am not having any luck. I have tried the following code but it does not seem to work. Can anyone tell me how to do this? Many thanks. andrew
Code:

setup_counters(RTCC_INTERNAL,RTTC_DIV_1);
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Sep 15, 2009 12:27 pm     Reply with quote

Use the port_a_pullups() function for this. Note that the parameter is
a bit mask. A '1' bit means that the pullup for the specified pin is
enabled and '0' means it's disabled. You can only enable pullups for
pins GP0, 1, 2, 4, and 5 (not GP3). Example:
Code:

#include <12F683.h>
#fuses INTRC_IO, NOWDT, MCLR, PUT, BROWNOUT
#use delay(clock=8000000)

//=============================
void main()
{

port_a_pullups(0b00000101);  // Enable pullups on GP0 and GP2
   
while(1);
}
 
Guest








PostPosted: Thu Sep 17, 2009 2:51 am     Reply with quote

hi have tried this and it does not seem to work either i am using compiler version 4.014 is this command compatible with this version.I am simulating the hardware in proteus ver7.2 many thanks for the help

Andrew
dbotkin



Joined: 08 Sep 2003
Posts: 197
Location: Omaha NE USA

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Thu Sep 17, 2009 8:10 am     Reply with quote

What's not working, exactly? Compiler error message, or WPUs not appearing to work? I have been using weak pull-ups on 12F683s for quite a while, every compiler version I've used has done it properly. Can you post your code?
Ttelmah
Guest







PostPosted: Thu Sep 17, 2009 8:50 am     Reply with quote

Yes.
Obvious comments are:

Won't work on pin A3.
They are _weak_ can be as low as 50uA.
Remember pins have to be programmed as inputs (default), before they work. This includes turning off the ADC, and the comparator on the pins.

Best Wishes
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Thu Sep 17, 2009 9:22 am     Reply with quote

when in doubt - my favorite 100ua pullup ( or down) technique is a 47K resistor from the pin to Vdd ( or Vss)

then ANY pin can have a pullup(down) from the instant of power on

- just don't do that to a programming mode pin Confused

sorry i couldn't "resist" commenting
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Sep 17, 2009 11:51 am     Reply with quote

Quote:
I am using compiler version 4.014 is this command compatible with this version

The .LST file code is basically the same as 4.099. It should be working.


Quote:
I am simulating the hardware in proteus ver7.2

It's either Proteus or your design that's causing the problem.
Or, something in your larger program (that you're not showing us)
including possible compiler bugs (vs. 4.014) for that code.
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