GP0 and GP1 on a PIC12F675

Strange things are happening, and I thought I'd do a sanity check here...

I'm working on a project using the 12f675, and it's been going pretty well. But we thought we'd toggle an unused output for debug purposes, so we hooked up an LED through a resistor to GP0 so we could see it.

The light never came on. GP0 is supposed to be able to drive 25 mA, and we should be drawing only 5, so that shouldn't be the problem. But we never see the output go high.

GP1/AN1 is used as a battery monitor (100k/37k5 divider), so we thought we see if we could drive that. It works fine as an analog input, but when configured for output, it pulls to ground, regardless of the state of the output port bit.

We started with clean code that simply configures the I/O, sets the output pins, then drops into a loop that strokes the WDT. Same results. However, GP2, GP4, and GP5 all work exactly as expected.

Anyone else experience anything like this? Any ideas?

Thanks in advance,

-=Dave

--
Change is inevitable, progress is not.
Reply to
Dave Hansen
Loading thread data ...

What did you initialize CMCON and ANSEL to? You probably wish to set CMCON to 0x07 to turn off the comparators in order to make the pins digital instead of analog. ANSEL powers on with the pins selected as analog, you will need to clear the 2 LSB's of ANSEL to make GP0 and GP1 digital. Of course TRISIO needs to be set to indicate the direction of the pins (input or output).

michael brown

Reply to
Anthony Fremont

Have you set ANS0 bit in ANSEL to 0?

You have noted that teh maximum recommended impedance for analog sources is 10kohms, haven't you?

Have you also cleared the ANS1 bit in that version?

HTH Wolf

Reply to
Wolfgang Mahringer

[...GP0 and GP1 behaving badly...]

Thanks to you and Wolf for the responses. And to anyone else whose response I haven't seen yet.

CMCON was the problem. I had it set to "reset" (0) rather than "off" (7). I had tried this earlier, but ISP problems hid the solution. When it apparently didn't fix the problem, I reverted to the original value (0).

Which brings me to my next question: Anybody got a better ISP solution? We're currently using the JDM (built in-house) programmer with ICPROG. One of our problems is that it doesn't work on most systems (I suspect insufficient drive from various COM ports). Worse problem is that on at least one system, the serial port is *almost* good enough, such that it fails to program the part correctly, yet verifies as if it had.

Thanks again,

-=Dave

--
Change is inevitable, progress is not.
Reply to
Dave Hansen

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.