PDA

View Full Version : Melanie where are you?



Russ Kincaid
- 9th May 2007, 22:30
I am beating my head against a wall trying to figure out why this program makes GPIO.0 output high for 4ms and low for 12ms. Also, GPIO.1 output is high for 8ms and low for 8ms. I would expect GPIO.1 to be low for 4ms and high for 12ms. GPIO.0 should be high all the time.

REM DEVICE = 12F675 '12F629 CAN ALSO BE USED
REM USE INTERNAL OSCILLATOR, OUTPUT IS ON GP4 (PIN 3)
REM CONFIGURATION: INTOSC CLOCKOUT, WDT DISABLED, PWR UP ENABLED,
'MCLR = OUTPUT PIN, BROWN OUT DISABLED, NO PROTECTION
REM 60 HZ OUTPUT IS ON PINS 7 AND 6
REM OSCILLATOR CHOICE: USE 101, INTOSC, CLKOUT
OPTION_REG.5 = 0 'OTHERWISE GPIO.2 IS AN INPUT
TRISIO = 0 'SETS ALL PORTS TO OUTPUT
ANSEL = 0 'SETS ALL DIGITAL MODE
DEFINE OSCCAL_1K 1 'FOR OSCILLATOR CALIBRATION, DON'T KNOW HOW IT WORKS

high GPIO.0 'INITIAL CONDITIONS
high GPIO.1

START:
low GPIO.1
PAUSEUS 4168 ' ON TIME
high GPIO.1
PAUSEUS 4167 'DEAD TIME, BOTH high
REM low GPIO.0 'SETS PIN 7 low
PAUSEus 4168 'FOR 4.168 MILLISECONDS
high GPIO.0
PAUSEUS 4167 'DEAD TIME

GOTO START '60 HZ FREQUENCY

END

mister_e
- 9th May 2007, 22:56
Where's the CMCON setting?

Darrel Taylor
- 10th May 2007, 06:35
Yeah, I would've asked for the pretty girl first too. :)

But I think mister_e nailed it. CMCON
<br>

Russ Kincaid
- 10th May 2007, 22:10
Hay, thanks for the replies. If ANSEL = 0, I don't see why CMCON setting would make any difference. I tried CMCON = 0, no difference. Is there some other setting that would make sense?

paul borgmeier
- 10th May 2007, 22:59
CMCON = 7
(7 = all digital, 0 = one of the analog modes)

JohnH
- 10th May 2007, 23:29
Try setting CMCON=7. Bits 0,1,2 high in CMCON=Comparator off. GP0 and GP1 pins are multiplexed to the comparator inputs. Something to try...

--John

JohnH
- 10th May 2007, 23:32
Paul beat me to it... hope it works.

Russ Kincaid
- 11th May 2007, 04:35
CIMCON = 7 works. Thank you. Thank you. Thank you.

Russ

Archangel
- 11th May 2007, 07:43
How come everyone's pencils get sharper when someone calls on Melanie? :)
Oh, and Congratulations Russ, to bad about TJ though, I will miss him.
JS