Hi,
I want to generate 4-20ma signal from the microcontroller port pin using avr microcontroller. I know that by connecting a dac (serial) and converting that voltage to current is possible but i want to know any other method available.
Although it uses PICAXE as "the brain", the principle of the operation remains the same for all other microcontrollers, including AVR:
PWM generated at one output pin and analog input as feedback ..
Hi!
If you donot want to use the DAC then you can use the PWM of the PIC to generate differnet voltages across an RC (Resistor+capacitor)network. Simply vary the duty cycle of the PWM signal to generate different voltages and thus different currents.
Actually i am using the atmel avr microcontroller.It has 4 channels of pwm is it possible to use that one to generate voltages . But i want that votage has to be there untill or unless i changed the value loaded to the dac register is it possible to that job using pwm.Is itpossible to send u that circuit of generating voltage from pwm pin.
Thank U
Hi,
Yes, so long as you keep the duty cycle value in the PWM register the same., it will continue to output. For 4 to 20 ma, you vary the PWM duty cycle value from 20% to 100%. Take the average of the output waveform and convert it proprtionately to current.
Regards, Laktronics
Hi!
Yes you can do that as alreday suggested by laktronics. I used the PWM of the AVR to generate DTMF signals which is very difficult as compared to generating 4-20mA so you can use the PWM for your generating 4 -20mA.
Regards.
Thank u for ur valuable replay .I have one more doubt regarding the PWM of avr microcontroller .Whether pwm uses the available timers(3) to generate the voltages or it will work independently from the timers? In atmega 8535 it is shown that it has 4 channel of pwm but the timers available in that controller is only 3 how is possible to program the four channels of pwm? I am asking this question because i want to use 3 dacs for my application but i am already using 3 timers for the other applications.
Hi!
Well that question is a bit tricky but so far what i have understood is that you can use the timer interrupt as a normal timer interrupt while still using the timer for generating PWM but only in the phase correct PWM mode. Since in this mode the timer is never reset but continously counts from 0----255-----0 i.e first it upcounts to 255 and then down counts to 0 and timer interrupt is generated when it reaches 0. This has been explained in detail on page 78 of the mega8535 datasheet.