PDA

View Full Version : Setting PortB.7 as output on 16F627/8/48



tekart
- 28th January 2010, 19:36
I'm having trouble getting PortB.1 to work as a digital output on a PIC16F648.
I have pored over the documentation and tried all the registers - see below.
What am I missing? I just need to blink an LED with this output and I'm committed to a PCB that locks me into this pin.

TRISB = %00000000 ' set all as outputs
CCP1CON = 0 ' turn off capture/compare mode (set all digital I/O)
CMCON = 7 ' disable comparators
OPTION_REG = %10000000 ' bit 7 = 1 disables weak pull-ups on portB
INTCON = 0 ' disable interrupts

What did I miss?

Acetronics2
- 28th January 2010, 19:40
I do hope your program has some more lines ...

Would you dare post them all ???

Alain

Bruce
- 28th January 2010, 20:08
I'm committed to a PCB that locks me into this pin
RB7 = PGD. Does your board have a PIC programmer connected, built-in, etc..?

tekart
- 28th January 2010, 20:13
Forgive my dyslexic brain - my issue is with PORTB.0

Well, all I need to test the output on PortB.7 is:

LED var PortA.0
Test:
HIGH LED
pause 500
low LED
pause 500
goto test

... and it ain't blinken.

tekart
- 28th January 2010, 20:19
Geez,
Forgive my confused last post. I was swapping things again. It's tough looking at the world through an upside down brain.

SO I got in there with my test probes and I had also mis-read my PCB traces. It's actually PortB.1. Really! I checked 3 times this time.

So is there some kind of register thing that I need to configure that as an output? It is the RX pin for hardware serial... is that a clue?

Sorry for the confusion.

Archangel
- 28th January 2010, 20:22
I do hope your program has some more lines ...

Would you dare post them all ???

Alain
No, because then YOU TOO would then know the secret of Matter / AntiMatter conversion, Time travel and Matter Teleportation . . . :D :D ;D . . . I will say sometimes HIGH / LOW does not work , and I do not know why. ALSO set your ports before your tris

Archangel
- 28th January 2010, 20:29
Geez,
Forgive my confused last post. I was swapping things again. It's tough looking at the world through an upside down brain.

SO I got in there with my test probes and I had also mis-read my PCB traces. It's actually PortB.1. Really! I checked 3 times this time.

So is there some kind of register thing that I need to configure that as an output? It is the RX pin for hardware serial... is that a clue?

Sorry for the confusion.

Cold up there in MAINE, Brrrrrrrrrrrrr
Upside down brain . . . Here in KaliForeignYa people have added dimensions to that, cause 80% of the folks here (at least those who drive) are looking out of their . . . Backsides. You're doing alright ! Use the portB.1 = 1, or PortB.1 = 0 and I am pretty sure it will work.

Bruce
- 28th January 2010, 20:37
Assuming RB1 really, really, really, swear to "insert whomever you worship here" IS
the pin in question, then it can't ever be used for driving your LED if you have the hardware
USART enabled....:)

tekart
- 28th January 2010, 20:38
Thanks for the ideas, I swapped out the chip and it works, musta blown the output drivers when poking around with test probes. My blinky is working, I'm a happy camper! :)

Yeah, I'm a California ex pat. Today it's 32F and snowing, headed for 0F tonight. Mainah's have an expression: "If you don't like the weathah, wait 20 minutes".



Guy