Setting PortB.7 as output on 16F627/8/48


Closed Thread
Results 1 to 9 of 9

Hybrid View

  1. #1
    Join Date
    Sep 2008
    Location
    Maine, USA
    Posts
    81

    Default Setting PortB.7 as output on 16F627/8/48

    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?
    Last edited by tekart; - 28th January 2010 at 20:29.

  2. #2
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,648


    Did you find this post helpful? Yes | No

    Wink

    I do hope your program has some more lines ...

    Would you dare post them all ???

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  3. #3
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    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..?
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  4. #4
    Join Date
    Sep 2008
    Location
    Maine, USA
    Posts
    81


    Did you find this post helpful? Yes | No

    Default OOps I meat PortB.0

    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.

  5. #5
    Join Date
    Sep 2008
    Location
    Maine, USA
    Posts
    81


    Did you find this post helpful? Yes | No

    Default Dyslexics for Dog untie... ;)

    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.

  6. #6
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by tekart View Post
    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.
    Last edited by Archangel; - 28th January 2010 at 20:34.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  7. #7
    Join Date
    Sep 2008
    Location
    Maine, USA
    Posts
    81


    Did you find this post helpful? Yes | No

    Default Got it - was bad chip

    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

  8. #8
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Acetronics View Post
    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 . . . I will say sometimes HIGH / LOW does not work , and I do not know why. ALSO set your ports before your tris
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  9. #9
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    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....
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

Similar Threads

  1. PICKit2 - warning about configuration words
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 26
    Last Post: - 4th August 2009, 14:01
  2. Help changing CCP3 output pin
    By ChrisHelvey in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 15th July 2008, 02:30
  3. Bit Banging input to output on PIC16F876A
    By Bronurstomp in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 26th June 2008, 19:50
  4. Serious Serial Situation Setbacks...
    By Dansdog in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 7th February 2007, 03:46
  5. HSEROUT Newbie question/problem
    By Mark Scotford in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 11th July 2006, 14:44

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts