RA4 pin in PIC16F872

Status
Not open for further replies.
leonel said:
HI.
I would like to know if i can put RA4 pin as output in PIC16F872 to turn on a relay?

Yes, but you need to be aware it's an open-collector output, so it can only SINK current and not SOURCE it.
 
So, what you're saying is that i have to do sometnhig like that (see image)
putting RA4=1 my relay will turn on
putting RA4=0 my relay will turn off
 

Attachments

  • ra4_pin.jpg
    66 KB · Views: 318
leonel said:
So, what you're saying is that i have to do sometnhig like that (see image)
putting RA4=1 my relay will turn on
putting RA4=0 my relay will turn off

Yes, except I don't like the LED where it is - it will restrict the base current available for the transistor slightly.

What current does your relay take?, as it's 24V the current is probably low? - if it's only 20mA or so, you may be able to connect it directly to RA4?, but check the datasheet, and make sure RA4 will take 24V, this is the advantage of an open-collector output (don't forget the diode across the relay though!).
 
Yes, my relay current it's+-20mA.
I think i cannot put 24V on RA4 pin, because in datasheet says
"Voltage on RA4 with respect to Vss 0 to +8.5V"
 
leonel said:
Yes, my relay current it's+-20mA.
I think i cannot put 24V on RA4 pin, because in datasheet says
"Voltage on RA4 with respect to Vss 0 to +8.5V"

Pity! :cry:
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…