RA.4 Open collector,...


Closed Thread
Results 1 to 15 of 15

Hybrid View

  1. #1

    Default RA.4 Open collector,...

    First thing, yes I did search the forum on this question although I was certain I already was correct in my thoughts about ra.4 on my 16F628A. Melanie makes it quite clear especially with this post:
    http://www.picbasic.co.uk/forum/showthread.php?t=1642

    BUT!!!, Using and led with a resistor on my anode going to 3.3V and my cathode to ra.4, does not work, change processors and programmed with my replacement of the pickit3, my new favorite, the pickit2. I think I even made it as simple as possible with this code:

    DEFINE OSC 4
    CMCON = %00100101
    VRCON = %11101100
    PAUSEus 10
    TRISA = %00000110
    TRISB = %11110001
    PORTA = %00000000
    PORTB = %00000000
    OPTION_REG.7 = 0
    OPTION_REG.6 = 0
    rf var porta.4


    main:
    low rf
    pause 500
    high rf
    pause 500
    goto main

    And it still doesn't work. But I did move the cathode to ground and yes the led lit, so the led does work.

    Anyhow, this may have sounded like a stupid question but If I don't ask, I'll never learn anything
    Thanks again especially for all the knowledge I have gained here on this forum.
    Last edited by tazntex; - 24th August 2010 at 20:16.

  2. #2


    Did you find this post helpful? Yes | No

    Default Update

    I have it working with this code:
    DEFINE OSC 4
    CMCON=%00000111
    VRCON = 0
    PAUSEus 10
    TRISA = %00000110
    TRISB = %11110001
    PORTA = %00000000
    PORTB = %00000000
    OPTION_REG.7 = 0
    OPTION_REG.6 = 0
    rf var porta.4

    main:
    low rf
    pause 500
    high rf
    pause 500
    goto main

    Does it have something to do with me using the comparator on ra.1,ra.2? I have been reading the datasheet and it mentions ra.3,ra.4 in section5.1 PORTA and TRISA Registers, I am already using ra.3 with no problems as an output.
    Last edited by tazntex; - 24th August 2010 at 20:21.

  3. #3
    Join Date
    Aug 2008
    Location
    Portugal
    Posts
    240


    Did you find this post helpful? Yes | No

    Default

    Hi;

    Try this;

    1 - Connect the RA4 Pin with the resistor to VCC;
    2 - Connect the anode of the led beetwen the resistor and the RA4 Pin;
    3 - Connect the Cathode of the led to GND

    And post the result
    Thanks and Regards;
    Gadelhas

  4. #4
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    699


    Did you find this post helpful? Yes | No

    Default

    The reason that you need a resistor between RA4 and Vcc, like Gadelhas mentioned above, is because RA4 in that chip is an Open Drain (OD) type.

    Name:  OpenDrain.GIF
Views: 931
Size:  31.7 KB

    Robert
    "No one is completely worthless. They can always serve as a bad example."

    Anonymous

  5. #5


    Did you find this post helpful? Yes | No

    Default

    Sorry about the delay getting back to ya'll. Ok, your instructions said:
    1 - Connect the RA4 Pin with the resistor to VCC;
    2 - Connect the anode of the led beetwen the resistor and the RA4 Pin;
    3 - Connect the Cathode of the led to GND

    with or without step 2 the led is illuminated.

    Thanks for the fast response.

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


    Did you find this post helpful? Yes | No

    Default

    RA4 is C2OUT with the 1st configuration you had so you couldn't use it for a digital output. With comparators disabled you can.

    This should work fine to drive your LED on RA4 ---|<|---/\/\/--VCC.
    Regards,

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

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