View previous topic :: View next topic |
Author |
Message |
EricKoh1985
Joined: 03 Mar 2008 Posts: 8
|
RA4 can't turn ON/High for PIC16F628A |
Posted: Thu May 01, 2008 7:03 am |
|
|
i have a problem of turing ON/High RA4 for PIC16F628A. RA4 pin is always at Low or 0V.
As i know, this pin (RB4) also can function as T0CKI and CMP2.
i think the problem might be due to by default this pin(RA4) is set to other function but not as I/O pin.
So is anyone can help me to change this pin (RA4) to I/O pin, so that i am able to set this pin to turn High or Low.Tx.
Below is my source code and circuit's picture, please kindly refer it. Tx.
Code: |
#include <16F628A.h>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP,INTRC_IO
#use delay(clock=4000000)
void main()
{
set_tris_a(0b00000000);
output_a(0b00000000);
while (true)
{
output_a(0b11111111);
}
}
|
Circuit picture link:http://www.imagehosting.com/show.php/1726932_pic16f628a.JPG.html |
|
|
mskala
Joined: 06 Mar 2007 Posts: 100 Location: Massachusetts, USA
|
|
Posted: Thu May 01, 2008 7:15 am |
|
|
RA4 is open drain, you will need to pull it up. |
|
|
Douglas Kennedy
Joined: 07 Sep 2003 Posts: 755 Location: Florida
|
|
Posted: Thu May 01, 2008 7:19 am |
|
|
Look at the data sheet for this PIC RA4 is open drain. If you are not aware of this then that will probably be your issue. This board has numerous postings about open drain pins. |
|
|
Gerhard
Joined: 30 Aug 2007 Posts: 144 Location: South Africa
|
|
Posted: Thu May 01, 2008 7:20 am |
|
|
Is the other pins on port working correctly or are you having problems with the whole port? |
|
|
EricKoh1985
Joined: 03 Mar 2008 Posts: 8
|
|
Posted: Thu May 01, 2008 11:15 am |
|
|
Quote: |
RA4 is open drain, you will need to pull it up.
|
i connect 5V supply to a 1k resistor then series connection to LED. Another end of LED is connect to RA4.
Thanks for your advice. My problem solved.
Quote: |
Is the other pins on port working correctly or are you having problems with the whole port?
|
So far I only try with port A, and only RA4 has a problem of turning it High. So, it should be the "open drain output" problem (as other people mention).
Thanks. |
|
|
|