Author Topic: Is PORTA.4 of PIC16F628A nonfunctional as a digital output pin?  (Read 785 times)

0 Members and 1 Guest are viewing this topic.

Offline asadulhuqTopic starter

  • Contributor
  • Posts: 36
  • Country: bd
Is PORTA.4 of PIC16F628A nonfunctional as a digital output pin?
« on: September 02, 2020, 07:24:42 pm »
Dear All,
I am trying to use the PORTA.4 of PIC16F628A as a digital output pin. Seems that the pin (A4) does not work as digital output. It is always 0 and inactive. However, POERTA3 works as digital output.
I have short of pins. So I need to configure PORTA4 into digital output.
Can one please shed light on this issue? Thanks. BTW, I connected a pull up resistor from 1k to 10k, but no luck yet.
You may please look at the Proteus design attached bellow.
 

Online hexreader

  • Frequent Contributor
  • **
  • Posts: 262
  • Country: england
Re: Is PORTA.4 of PIC16F628A nonfunctional as a digital output pin?
« Reply #1 on: September 02, 2020, 07:38:07 pm »
Disable comparators (CMCON = 7) to use RA4 for output

Connect the other side of LS1 to Vdd, not ground and keep RA4 normally high. RA4 is an open drain output.

Depending upon exactly what kind of device LS1 is, you might want to put a flyback diode across it.
« Last Edit: September 02, 2020, 07:45:43 pm by hexreader »
 

Offline asadulhuqTopic starter

  • Contributor
  • Posts: 36
  • Country: bd
Re: Is PORTA.4 of PIC16F628A nonfunctional as a digital output pin?
« Reply #2 on: September 03, 2020, 07:05:45 am »
hexreader<<

Thanks a lot. Your info is very correct! Now RA4_bit works perfectly. By the way, I have connected an LED indicator with the PORTA.4 instead of the speaker. The speaker has been moved to RA2. Thanks again. Now, I feel a question, what is the benefit of putting just a single pin as an open drain output! I have seen on net that this pin has made lot of confusion to so many people. However, my problem has been solved so I am happy!
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf