Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Thread Tools Display Modes
Old 17th June 2008, 04:32 PM   (permalink)
Question Pic16f628a - Ra4 Open Drain Output

Hi all,

I'm looking to use the RA4 pin of a 16F628A as an output, unlike most of the other outputs which can source an LED current, this has an open drain requirement. I was planning on tying this output to VDD (+5v) via an 820R LED limiting resistor, and inverting the logic for the drive of the pin.
I can't see any problem with this but thouht I'd like confirmation that this would be acceptable before I get the soldering iron out.
Thanks,
Roy

Last edited by fenderman; 17th June 2008 at 04:33 PM.
fenderman is offline   Reply With Quote
Old 17th June 2008, 07:02 PM   (permalink)
Default

The pullup will work just fine. What are you driving?
__________________
Bill
Smart Kits build Smart People

http://www.blueroomelectronics.com
blueroomelectronics is offline   Reply With Quote
Old 18th June 2008, 10:46 AM   (permalink)
Thumbs up

Hi Bill,
Thanks for your reply.
I'm just driving a standard LED (around 6mA), but as the other outputs are all sourcing the LEDS via 'on board (PCB)' 820R resistors wired directly from the PCB to the LEDs, with all the cathodes tied to 0v, I did'nt want to have an odd one where the LED would have been sourced from the VDD and an external resistor and 'sank' via the Open Drain as this would have caused problems in the LED panels, so hence the thought that I'd effectively drive the LED via an 820R resistor to the LED and to 0v, with the open drain pin connected to the junction of the LED Anode and the Resistor.
Hence when the Output is 'ON' the LED would be 'shorted' and be 'OFF'.
Fortunatly (more by luck than planning), the PCB I designed does have the facility already to accomodate this 'mod' without any additional tracks/or link wires.
Thanks for your confirmation, it is appreciated .... I have done it now, and it works fine.
Roy
fenderman is offline   Reply With Quote
Old 18th June 2008, 11:53 AM   (permalink)
Default

Oops,

Forgot to mention, the output RA4 Open Drain pin on a PIC16F628A already is implemented to do the 'invert' of the logic, so operates in TRUE logic.

The only thing to be aware of here, is that when the PIC first fire's up, (and especially if you are using the Start Up Delay), the output is ON until the first initialisation / drive to PORTA, hence you do get a 'blip' on the output from a HIGH to a LOW.
Not a problem on LEDS etc, but may be a problem if driving into other logic.
fenderman is offline   Reply With Quote
Old 18th June 2008, 12:14 PM   (permalink)
Default

It's much easier to sink the LED on RA4, just connect the cathode to RA4 and a output low will turn it on.
__________________
Bill
Smart Kits build Smart People

http://www.blueroomelectronics.com
blueroomelectronics is offline   Reply With Quote
Old 18th June 2008, 02:40 PM   (permalink)
Default

Quote:
Originally Posted by fenderman View Post
Oops,

Forgot to mention, the output RA4 Open Drain pin on a PIC16F628A already is implemented to do the 'invert' of the logic, so operates in TRUE logic.

The only thing to be aware of here, is that when the PIC first fire's up, (and especially if you are using the Start Up Delay), the output is ON until the first initialisation / drive to PORTA, hence you do get a 'blip' on the output from a HIGH to a LOW.
Not a problem on LEDS etc, but may be a problem if driving into other logic.
If you write 0x10 to PORTA (all LEDs off I assume) before you change the TRIS register then the problem should disappear.

Mike.
Pommie is online now   Reply With Quote
Old 18th June 2008, 04:42 PM   (permalink)
Default

Cheers Bill,
I was going to do this, but as I indicated in a previous post, I wanted to retain identical LED external circuitry, where all the other LEDS are being sourced from the outputs (via the on board resistors), and all the cathodes are taken to 0v. This was the reason for 'shorting' the LED with the output as this maintains identical LED wiring externally.

Thanks for the suggestion Pommie,
I've not tried it yet, but I'll stick a storage scope on it tomorrow and see what happens ... I'll report back the findings accordingly.

Roy
fenderman is offline   Reply With Quote
Old 18th June 2008, 04:52 PM   (permalink)
Default

Then turn all your LEDs around.
__________________
Bill
Smart Kits build Smart People

http://www.blueroomelectronics.com
blueroomelectronics is offline   Reply With Quote
Old 19th June 2008, 01:35 AM   (permalink)
Default

I hadn't realised you were shorting the LED with the output, I assumed the output grounded the LED. My suggestion wont work with your current configuration.

Thinking about it, your method is quite ingenious and makes the logic simpler. A high output always turning the LED on even though RA4 is OC. Clever.

Mike.
Pommie is online now   Reply With Quote
Old 19th June 2008, 05:17 AM   (permalink)
Default

What I would do...But I guess there is a reason why you don't want to change the circuitry?

EDIT: AHHH thanks Pommie, now I see why he wants it that way. Good Idea, think I will turn some of my LEDs around then..lol

-BaC
Quote:
Originally Posted by blueroomelectronics View Post
Then turn all your LEDs around.
__________________
Error: {Panic!} when trying to load: [reality shell]. kernel: "universe has been halted"...
Information Underground

Last edited by BaCaRdi; 19th June 2008 at 05:22 AM.
BaCaRdi is offline   Reply With Quote
Old 19th June 2008, 08:02 AM   (permalink)
Default

Quote:
Originally Posted by Pommie View Post
Thinking about it, your method is quite ingenious and makes the logic simpler. A high output always turning the LED on even though RA4 is OC. Clever.
It's a standard technique, and has been used for many decades, long before micro-controllers or LED's
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is online now   Reply With Quote
Old 19th June 2008, 08:34 AM   (permalink)
Default

Quote:
Originally Posted by Nigel Goodwin View Post
It's a standard technique, and has been used for many decades, long before micro-controllers or LED's
Are you saying that people shorted out incandescent bulbs to turn them off?

Mike.
Pommie is online now   Reply With Quote
Old 19th June 2008, 08:45 AM   (permalink)
Default

Quote:
Originally Posted by Pommie View Post
Are you saying that people shorted out incandescent bulbs to turn them off?
No

But shorted out all sorts of things in electronics, an obvious example being shorting the input to a transistor out to turn it off - but there have been many such uses over many years.

For a pretty identical example check the bottom of my page at
Cybot Motor Driver Board
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is online now   Reply With Quote
Old 19th June 2008, 09:01 AM   (permalink)
Default

Damned that learning curve!

Cheers Nigel m8,
-BaC

Quote:
Originally Posted by Nigel Goodwin View Post
It's a standard technique, and has been used for many decades, long before micro-controllers or LED's
Quote:
Originally Posted by Nigel Goodwin
No

But shorted out all sorts of things in electronics, an obvious example being shorting the input to a transistor out to turn it off - but there have been many such uses over many years.

For a pretty identical example check the bottom of my page at
Cybot Motor Driver Board
__________________
Error: {Panic!} when trying to load: [reality shell]. kernel: "universe has been halted"...
Information Underground
BaCaRdi is offline   Reply With Quote
Old 19th June 2008, 10:20 AM   (permalink)
Default

Cheers All,
The primary reason for sourcing the LED's and 'shorting' the one on the RA4 is that all the LEDS (over 200 of them) are already installed and wired, as these units are replacing the existing driver circuits which was pure TTL logic which were very old and there were no replacement parts available.
My 'Brief' was to come up with something to replace the driver circuits, and have ample replacement spare part capability, hence I chose the PIC16F628A as this was my first venture into PICS, but have broken the cardinal rule of design, and did'nt read the data sheet properly ...
However, the PCB I designed has multiple functions and can be configured for either 12 inputs / 12 outputs or 6 of each, hence a 12 channel combo board, with 'on board' pull up resistor SIL networks and driver resistor positions, reset circuits and Tx/Rx comms, which fortunately allowed the function of the RA4 circuit to be implemented 'as though it was designed that way' ... so there are no links, mods to the board etc.


Pommie,
I did try your suggestion, but did'nt expect it to work, which it did'nt.
I think the reason is that when the system is first powered, the RA4 output is high impedence, and hence the LED (and its resistor/anode junction) are 'HIGH' so the LED is ON, there is an inherent delay in the PIC starting up (even without the programmed 72ms start up delay).
Hence you do get thes short 'ON' time until the PIC initialises.

As Nigel indicated, I have been doing this for years with Micros especialy using transistors/switches to discharge capacitors on Micro Reset circuits before we had WDT chips available.

Thanks for all your posts ....

Roy
fenderman is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Latest
RF remote control power drain johnsmith123 General Electronics Chat 9 27th December 2007 03:35 AM
open collector jcaluma General Electronics Chat 1 6th May 2004 10:16 PM
The difference in open-drain and push-pull elarson General Electronics Chat 4 3rd January 2004 09:38 AM
open collector blibala General Electronics Chat 9 4th December 2003 10:23 PM
Measuring Drain of a FET... Promocom General Electronics Chat 6 10th October 2003 03:37 PM



All times are GMT. The time now is 02:46 PM.


Electronic Circuits  |  Electronics Wiki
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.