View previous topic :: View next topic |
Author |
Message |
qwwe
Joined: 17 Sep 2017 Posts: 59
|
Change the output voltage level of the microcontroller pic |
Posted: Fri Sep 22, 2017 12:22 am |
|
|
Hi, I wanted to know if the output level of the pic16f1829 microcontroller, which works with a 5V input voltage, can be changed from 5 to 3.
For example, in conjunction with uart, we set the micro-level output voltage level to the desired value when high, that is, when the output of the microcontroller is high, for example, the voltage of 3.3 or 2.8 or whatever we have set.
How to do this in ccs? |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19537
|
|
Posted: Fri Sep 22, 2017 12:46 am |
|
|
You can't.
This is down to hardware. A 'logic' output from a device outputs at the voltage the device generates.
Now that having been said, on some of the more sophisticated PIC's, some outputs do have programmable output levels, but only on very specific pins for specific busses. Also in some cases the input level is programmable (so for instance some if the I2C peripherals have programmable levels for I2C or SMBUS). However in each case this is a matter of looking at the data sheet for the specific PIC. The software can only change this if the hardware supports it.
In this case for the PIC output you will need to add an external voltage divider. Simply two resistors to divide down to the 3v. So perhaps 1K8R to the PIC pin, and then from the end of this 3K3R to Vss, and then connect the 3v device to the junction between these. Going the other way, a gate like a 74ACT125D, powered off 5v, will give a 5v logic output from a 3.3v logic input.
CCS can't do anything the hardware doesn't offer, and normal logic pins don't offer this (in circuit terms it is not something chip manufacturers would want to waste the components to offer....).
Consider instead whether you could operate the PIC off 3.3v instead?. The PIC you are using will happily run up to 32Mhz off a supply down to 2.5v. What circuitry do you have that 'needs' 5v?. Honestly likely to be cheaper and simpler to build everything to run off 3.3v. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9241 Location: Greensville,Ontario
|
|
Posted: Fri Sep 22, 2017 5:04 am |
|
|
That PIC does have a basic DAC, so 'technically' ONE pin could be set to say 3 volts with the PIC being powered from 5 volts.
If you need more than that one output pin additional hardware will be required.
You don't give a clear picture of the purpose (maybe it's an English translation, or it's still dark here and only one coffee...).
A better description of what you need to do would help me, but as Mr T says, these days most every peripheral runs on 3 volts.
Jay |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19537
|
|
Posted: Fri Sep 22, 2017 6:16 am |
|
|
He does say "uart", which is why I ignored the DAC. |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9241 Location: Greensville,Ontario
|
|
Posted: Fri Sep 22, 2017 7:20 am |
|
|
My impression was he would receive a 'command' from say a PC, via the PIC's UART to control an ouput pin to be a selected voltage, say 5 or 3 or 2.8.
If only one pin, the DAC would work.
Details are 'sketchy' though on what he actually wants or needs to accomplish.
Jay |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19537
|
|
Posted: Fri Sep 22, 2017 7:51 am |
|
|
Ah, If that is what is wanted, then 'yes'. However still has to remember this is a high impedance source (so buffer needed), and if he wants anything more complex in logic terms, then more hardware needed.... |
|
|
|