Author Topic: Help please: PIC12F675 Beginner  (Read 11130 times)

0 Members and 1 Guest are viewing this topic.

Offline igendelTopic starter

  • Frequent Contributor
  • **
  • Posts: 371
  • Country: il
    • It's Every Bit For Itself (Programming & MCU blog)
Re: Help please: PIC12F675 Beginner
« Reply #25 on: May 03, 2014, 12:33:17 am »
Putting the ADCON=0, disables the ADC inputs. The default, from reset, is to have the ADC inputs enabled. When the inputs are enabled as ADC inputs they read, digitally, as zero.

Obviously, because setting ANSEL to 0 doesn't hint at all that I'm not going to use the ADC... [clarification edit: on any IO pin]  |O
I guess all MCUs are funny like that, each in its own way. Just need to get used to it.

Thanks Andy and everyone!
« Last Edit: May 03, 2014, 12:43:56 am by igendel »
Maker projects, tutorials etc. on my Youtube channel: https://www.youtube.com/user/idogendel/
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4382
  • Country: us
Re: Help please: PIC12F675 Beginner
« Reply #26 on: May 07, 2014, 08:39:21 am »
Quote
CMCON = 7;
Disables the analog comparator, which is separate from the A-D (although both are analog functions.)  There's a note in the datasheet:
"The ANSEL (9Fh) and CMCON (19h) registers (9Fh) must be initialized to configure an analog channel as a digital input. Pins configured as analog inputs will read ‘0’. The ANSEL register is defined for the PIC12F675."
(drove me crazy till I figured it out.  I knew about ANSEL, but not CMCON...)
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf