help using RA4 of 16f628 as output

Status
Not open for further replies.

janosandi

Full Member level 4
Joined
Jan 23, 2010
Messages
210
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,298
Activity points
2,788
Hello guys
wanted to use pin RA4 of 16f628 as output
but i've noticed its a TOCKI pin but i couldnt disable it to be a normal output pin
& what that means Open (Drain Output) ? cant it drive a transistor ?
any information will be great
thx
 
Last edited:

The following recommendation is for the PIC16F628 and PIC16F628A.

wanted to use pin RA4 of 16f628 as output
but i've noticed its a TOCKI pin but i couldnt disable it to be a normal output pin

You need to disable any other peripherals with share that particular pin.

Reference: PIC16F62X Data Sheet, page 29, Section 5.0 I/O PORTS


You can disable the other peripherals by initializing PORTA with the following code:

Assembly:
Code:
CLRF PORTA         ;Initialize PORTA by
                         ;setting output data latches

BANKSEL CMCON
MOVLW 0x07       ;Turn comparators off and
MOVWF CMCON    ;enable pins for I/O
                         ;functions
BANKSEL TRISA
MOVLW 0x0F        ;Value used to initialize
                         ;data direction
MOVWF TRISA      ;Set RA<3:0> as inputs RA4 as output
                         ;TRISA<5> always
                         ;read as ‘1’.
                         ;TRISA<7:6>
                         ;depend on oscillator mode

C:
Code:
PORTA = 0x00;

CMCON = 0x07;

TRISA = 0x0F;

what that means Open (Drain Output) ? cant it drive a transistor ?

It is not recommended and will usually not produce the desired out come.
Open Drain Outputs typically do not source current and when set high will take on a high impedance state.

PIC Microcontroller Note

Hope the info helps in your endeavors,

BigDog
 
Reactions: FvM

    FvM

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…