![]() | ![]() | ![]() |
| |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
![]() |
| | Tools |
| | #1 |
|
I want to see if I'm on the right track with this. I need a varied voltage leaving the PIC dependant on which way the SPDT switch is set. And, what if I have a 3 way switch, can I just add another OUTPUT PORT >> RESISTOR >> DIODE? Do I even need the DIODEs? Thanks! | |
| |
| | #2 |
|
You could use the built in DAC and an OpAMP. It's a very course 16 level DAC though. Notes: Use PORTB and the internal pullups for the switch You don't need to pullup unused I/O pins, just make them outputs in the code. You will need decoupling caps. | |
| |
| | #3 |
|
You could go away, using a PWM signal duly filtered (two simple RC cells) to get almost any DC output you want. That would be the way I would go anyway.
__________________ Agustín Tomás In theory, there is no difference between theory and practice. In practice, however, there is. | |
| |
| | #4 | |
| Quote:
I was told, or maybe it was a recommendation, to use every pin in order to prevent possible issues with the PIC - interference maybe? It's 100% fine to set unused PORTs to output ant not expect any ill effects? What size caps and how many? I use a 1 uf 25v cap close to the 5v supply and ground on every PIC. The incoming power gets a 100uf before it hits the regulator. I should have put it in this schematic - is that sufficient? Thanks! | ||
| |
| | #5 | |
| Quote:
The myth about unconnected inputs comes from the days of CMOS logic gates, where leaving inputs floating caused problems, it doesn't happen with PIC's. | ||
| |
| | #6 |
|
Thanks guys! You are extremely quick with the helpful replies.
| |
| |
| | #7 | |
| Quote:
| ||
| |
| | #8 | |
| Quote:
Depending on the switch position, either PORTB 6 or 7 will be turned on via software, suppling 5 volts, to the selected port, dropped down slightly by the resistor/diode combo into the transistor. I am all ears and willing to learn. Thanks! | ||
| |
| | #9 | |
| Quote:
The emitter is grounded to 0V,it will always be 0V.
__________________ Eric " Good enough is Perfect " I will NOT answer PM's requesting technical help, please use the Forum PIC tutorials: Nigel's www.winpicprog.co.uk/ Bill's: www.blueroomelectronics.com/ | ||
| |
| | #10 |
|
superflux, your output circuit is not good for many reasons. What voltages do you want? How much current? What are you driving? go to wikipedia.com and look up r2r ladder (resistor ladder). In their example they use 5 port pins and 10 resistors to get 32 different voltages. The r2r ladder can be made longer or shorter. | |
| |
| | #11 | |
| Quote:
I also have a similar situation for giving an LED dual brightness in a situation where PWM is not possible. Will both schematics, shown below, fly? The top one actually uses an LED which should complete the circuit. However; it seems that with the bottom schematic, using R2R, that anything is possible - I could use that for sending the low current voltages I need as well as controlling LED brightness. I sincerely appreciate the clarification and your time, guys! ![]() | ||
| |
| | #12 |
|
hi, The top circuit will not give the result you require. The bottom circuit is more inline with the requirement. ![]() EDIT: Google: dac ladder network This link will give you an idea. http://www.ecelab.com/circuit-dac-r2r.htm
__________________ Eric " Good enough is Perfect " I will NOT answer PM's requesting technical help, please use the Forum PIC tutorials: Nigel's www.winpicprog.co.uk/ Bill's: www.blueroomelectronics.com/ Last edited by ericgibbs; 10th October 2009 at 06:52 PM. | |
| |
| | #13 |
|
For the LED try this. Two resistors, one LED, two pins. Set both pins=0. Use the tri-state conrole to switch in the resistors. If both pins are 'input' then no light. If one pin is 'output' then R1 sets LED current. If the other pin is 'output' then R2 sets current. If both pins are 'output' then R1//R2 sets current. | |
| |
| | #14 |
| The reason I can't leave both set to OUTPUT and turn 1 on (1) and 1 off (0) would be that the one that is set to 'off' would simply GROUND the voltage coming from the one that was 'on' - correct?
| |
| |
| | #15 |
|
What voltages do you need and what sort of current?
| |
| |
|
| Tags |
| outputting, pic, variable, voltages |
| Thread Tools | |
| Display Modes | |
| |
Similar | ||||
| Title | Starter | Forum | Replies | Latest |
| Driving Higher Voltages from PIC 16F88 | Tom81 | Micro Controllers | 9 | 18th August 2009 05:49 AM |
| My OpAmp is only outputting 1.6V - what am I doing wrong? | PowerJunkie | Electronic Projects Design/Ideas/Reviews | 15 | 17th April 2009 04:43 PM |
| 16f877 pic pin voltages when data is writing | uditha33 | Micro Controllers | 2 | 6th June 2007 04:26 AM |
| outputting BCD values on a basic stamp | German1981 | Micro Controllers | 2 | 12th April 2004 03:58 PM |
| Reading/outputting voltage | magna | Micro Controllers | 10 | 4th March 2004 05:42 PM |