PDA

View Full Version : HELP !!! How change the voltage of a pin ????



stormdacta
- 21st August 2007, 01:21
Hi all . . .

I know where the COMMAND HIGH change the especific pin a 5.0 v . . ok thats fine

But i need change this voltage . . . 0 to 5.0 v

How i make this ? How i change the voltage of especific pin ?

Example :

var_voltage = 3.5

SET PORTA.0 = 3.5

i dont know the code for this.

Can you help me ?

Thanks.

Darrel Taylor
- 21st August 2007, 01:43
Sorry, but you can't do that.

Although PORTA.0 is an analog pin, the analog functions are input only.

You can use PWM or HPWM to generate a voltage with an external cap and resistor.

You could use several pins with an R2R resistor network.

Or you can interface to an external D/A (Digital to Analog) convertor.

hth,

GrandPa
- 21st August 2007, 02:00
Hi Stormdacta,


I suggest that you have a look at MAX518 or MAX521 from Maxim (www.maxim-ic.com).
This is a 2 wire dual DAC, octal for MAX521, that works very well with PBP I2C commands.

TIPS: They do samples too!

J-P

sayzer
- 21st August 2007, 08:22
Allow me to recommend MCP4921 DAC for easier and less complex control.




======================

paul borgmeier
- 21st August 2007, 13:00
Many PICs have onboard Voltage Reference Modules (See the 16F628A for example). With this PIC for example, you can output the reference voltage on RA2 (and use an external buffer if and as necessary). You can get between 4.5 and 5 Bit resolution depending on the segment selected. See the Voltage Reference Module section of your PIC's datasheet.

For the 16F628A, you can output (assuming VDD = 5.00V)
0-3.125V by 0.15625V intervals
0-3.594V by 0.20833 intervals

a.majid
- 21st August 2007, 16:06
Hi,
One of PBP build in maths functions is sine.
This mean PIC pin can generate time dependent voltage.
So by means of software pwm(***pbp build in function) technique you can get any analog volt between 0 volt and 5 volt.
To get smooth voltage you should use passive low pass filter.(R & C series )

GrandPa
- 21st August 2007, 20:55
Allow me to recommend MCP4921 DAC for easier and less complex control.




======================

Hi Sayzer,

MCP4921 is using SPI instead of I2C. I tought I2C, which I'm currently using, was easier than SPI because PBP has I2CREAD and I2CWRITE commands. I saw example of SPI slave & master on melabs website, but I can't see why you said MCP4921 was easier. Can you elaborate?

J-P