PDA

View Full Version : 10 bit pwm as dac



yasser hassani
- 29th June 2004, 15:56
Hi anyone

I am working on a project.
In this project I must use a DAC. I am going to use hardware PWM as DAC.
I know that PIC16F877 has 10 bit PWM module.
My compiler is PBP.
My program reads an analog signal and converts it to digital.
Then does some calculations.
I want to convert the above result to analog with pwm.
Please help me for implementing it.
Can I use HPWM command in pbp?
I think that this command isn’t useful for me because it needs the frequency.
I am waiting for your helpful guidance.
Thank you very much.

Melanie
- 30th June 2004, 08:20
I have some questions here too... making you work for the answers will help you better to understand and resolve the problem...

>Can I use HPWM command in pbp?

Can you tell me if HPWM is a PBP command? Your answer to that will answer your own question. Clue: Look in the PBP Manual.

>I think that this command isn’t useful for me because it needs the frequency.

So how do you think PWM works without a frequency?

Dwayne
- 30th June 2004, 15:12
Hello, Yasser

Yasser >>In this project I must use a DAC. I am going to use hardware PWM as DAC. I know that PIC16F877 has 10 bit PWM module. My compiler is PBP.<<

Ok, that could work.

Yasser >>My program reads an analog signal and converts it to digital. Then does some calculations.
I want to convert the above result to analog with pwm.<<

A AD would work on this. Thus choose a chip with a A/D and PWM.

Yasser >>I am waiting for your helpful guidance.<<

Ok. Why don't you send us some Psuedo code of what you want implemented. and we can go from there...

Something like

ADnumber var byte
ADin porta, ADnumber

calculations...

CCPIN1=New value between 0 and 256.


etc.

Dwayne