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.

How get o/p from ra4 pin (open drain o/p) in 16f628a

Status
Not open for further replies.

saramah

Member level 3
Joined
Apr 25, 2018
Messages
64
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Activity points
689
Hi All,
All other pins are working well as expected but RA4 PIN which is open drain type in pic 16f628a not working with the hardware arrangement like Vcc--R(470E)--LED--RA4. ckt is attached.
And the program is here for this operation.
Code:
#define RELAY3  PORTAbits.RA4    
#define TRIS_RELAY3 TRISAbits.TRISA4
   

void main() // ......
{
CMCON = 0x07;//comparator disable
TRIS_RELAY3    =0;                             //RA4 pin making it as o/p here 
RELAY3 =0;                                        //RA4 PIN>>Open drain


   while(1)               // wait forever for  the data received and ready AND BEING operate with below to approproate load. 
   {


      switch(command)   // swich on 
      {
      case 0x22: RELAY3 = !RELAY3;      //Toggle relay 3//   ITS OPEN DRAIN RA4 PIN/
               break;

//others switch command 

}
}
}

code for this particular pin is shown above.
what am i missing in the code/ hardware for this particular pin for which this ra4 pin not operating while the others pin working correctly with their respective port settings.

thx for your reply in advance. RA4 PIN.jpg
 

As a current sink it will still work as expected. I would guess you have the pin configured to use LVP mode which makes it an input to start the programming process. Check the CONFIG word to make sure the pin is configured for I/O operation.

Brian.
 

MY CONFIG IS THIS...
//__CONFIG(FOSC_HS & WDTE_OFF & PWRTE_OFF & MCLRE_OFF & BOREN_ON & LVP_OFF & CPD_ON & CP_ON);

Is not LVP related to RB4 pin and making this RB4 as digital i/o ?
when LVP=0, the RB4 becomes i/p pin.


Code:
data sheet says:
bit 7: LVP: Low-Voltage Programming Enable bit
1 = RB4/PGM pin has PGM function, low-voltage programming enabled
0 = RB4/PGM is digital I/O, HV on MCLR must be used for programming
my problems on RA4 PIN.
tnx
 

Oops! My mistake, sorry. I guess my memory of those devices is fading away! I confused RA4 with RB4.

Try writing a simple program that just drives the pin high or low to see if 'low' makes the LED turn on. Possibly it is working but something else in your software is turning the LED off immediately.

Brian.
 

tanks
its working...
b/c of resistance was very high r470 instead was to be reduced at r330.
thnx for your early responce..
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top