Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

RA4 not working in PIC16F628A

Status
Not open for further replies.

venkates2218

Full Member level 6
Full Member level 6
Joined
Sep 30, 2016
Messages
354
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,298
Activity points
4,306
In PIC16F628A I tried to use RA4 as output port but I can't use that port as O/P port.Later I checked inPIC16F628A's datasheet,in that they mentioned "PORT RA4 is multiplexed with T0CKI clock input ".
This is my config :
TRISA = 0X00;
PORTA = 0X00;
CMCON = 0X07;

TRISB = 0b10001100;
PORTB = 0b10001100;

This is my control part:
if(RB2==1){
RA4=~RA4;
}


My problem is when I pressed the switch means I can't get any O/P in RA4 pin.
How to solve this issue...?
 

Have no idea how do you reading datasheets. PA4 have only low side switch and can be used only as push-down pin if used as output.
 

RA4 is a open collector pin.
 

On devices that do not have the LAT registers, toggling a PORT bit is always a bad approach.
You really should create a new variable, toggle that, and then write that to the PORT.
Also, your comment about multiplexing with the T0CKI, have a look at the Figure 5-4 in the data sheet and you will see that the circuitry for the timer is only to read (and not drive) the pin. Therefore this cannot interfere with the operation of the PORT as an output.
Susan
 

RA4 is a open collector pin, to use it as a general purpose output pin use a pull up resistor of appropriate value within the current capability of the PIC chip.
 

Current capability of the PIC output pins are usually 25 mA. Take it as 20 mA. Assuming your PIC supply voltage (VDD) is 5V.

5V/20mA = 250 Ohms.

Use a 270 Ohm resistor as the pull up.
 

expanding on post #6....

you do need a pull-up resistor because RA4 can only be 'open circuit' or 'driven to 0V' by the PIC, it can't produce a high voltage on the pin from inside. However, the value of 270 Ohms is the minimum you should use. In most cases a much higher value is suitable but it depends on what the pin is connected to and how much current is drawn by its load.

Brian.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top