|
|
View previous topic :: View next topic |
Author |
Message |
Guest
|
PIC12F683 pullup problem |
Posted: Fri Jul 18, 2008 9:42 am |
|
|
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
|
|
Posted: Fri Jul 18, 2008 10:07 am |
|
|
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
|
|
Posted: Fri Jul 18, 2008 2:41 pm |
|
|
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
|
|
Posted: Fri Jul 18, 2008 2:47 pm |
|
|
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
|
|
Posted: Fri Jul 18, 2008 3:00 pm |
|
|
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
|
|
Posted: Fri Jul 18, 2008 3:07 pm |
|
|
Hi
Thanks for support, your 100% right it work now:-)
Thanks. |
|
|
sambyte
Joined: 29 Dec 2008 Posts: 12
|
|
Posted: Mon Jan 05, 2009 10:39 pm |
|
|
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
|
|
Posted: Tue Jan 06, 2009 2:52 pm |
|
|
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. |
|
|
|
|
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
|