jonnyGURU Forums
Home Site Search Reviews Articles Contest Links PSU FAQs  


Go Back   jonnyGURU Forums > General Electronics > Electronic Component Discussion

Electronic Component Discussion Discussion of anything pertaining to electronics and the components that make them work

Reply
 
Thread Tools Display Modes
  #1  
Old 01-11-2017
YANGKI YANGKI is offline
micro ATX User
 
Join Date: Jan 2017
Location: LA
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default PIC18F various output voltage level

Hello
How can I control voltage level on a specific pin in PIC18F? Let's say then I want to send about 0.6V to transistor base. But I cannot use a voltage divider. I need to control output voltage by my PIC18F (PIC18F2525)
Is it a programming issue?
Reply With Quote
  #2  
Old 01-11-2017
mariush mariush is offline
1kW User
 
Join Date: Nov 2010
Posts: 322
Thanks: 0
Thanked 45 Times in 36 Posts
Default

Transistors work with current, not with voltage.

There is a threshold voltage, anything above will get the transistor working, so a transistor won't care if it's 5v or 0.6v, as long as there's current going into the base of the transistor.
You control the amount of current using a resistor. The amount of current controls how much the transistor opens (if it's in the linear region where it restricts the amount of current going through it, or if it's fully open, acting like a switch allowing a lot of current to go through it)

See here a tutorial about how to use transistors : https://www.youtube.com/watch?v=8DMZSxS-xVc

If you actually want to output 0.6v on a pin..

By default, pins are digital out, they output 0 or 1, or 0v and 5v (or whatever voltage you power the microcontroller with).
Some microcontrollers have DAC modules, which convert a value (for example a 10bit number, a value between 0 and 1023) into a voltage (usually between 0 and an upper voltage, which is usually the configured value of a voltage reference, like [1/2/4] x 1.024v or 1.25v or 2.5v, it varies with microcontroller series). So using a DAC you could output a voltage as close as possible to 0.6v as the dac permits.

If there's no DAC or you don't want to use that functionality, another possibility is to use PWM and a low pass filter (RC on the output pin) to filter the output.. here's an example : http://www.instructables.com/id/Anal...WM-to-Voltage/
and here's a more advanced example (4th order low pass filter with 12bit pwm for a MSP430 microcontroller) :
Reply With Quote
The Following User Says Thank You to mariush For This Useful Post:
YANGKI (01-11-2017)
  #3  
Old 01-11-2017
YANGKI YANGKI is offline
micro ATX User
 
Join Date: Jan 2017
Location: LA
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Thanks for your suggestion.
I know that I can use PWM in some way. And I'll try a DAC as you said.
Reply With Quote
Reply

Tags
output voltage, pic18f

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:01 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright © JonnyGURU.com 2000 -