variable SPWM Voltage

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hi...
i use Look up table to generate sinusoidal output(actually SPWM output) by this formula(with 8bit T/C):
Value(n)=127*sin(n*360/255)+128
and it gives output 0-5v sinusoidal output...
now if i want to alter this output(for example SPWM for 0-2.5v ),what do i do?
only divide value(n) bye 2?or something else?

-------
Regard

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You might consider a simple resistor divider which would consist of two identical resistor values such as 5k each. That would give you the 2.5 volts and keep your resolution the same. Probably a good idea to buffer the output with a low impedance op Amp.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

thanks but i want to control the output voltage(by avr ...not with resistors)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

mahyarelc wrote:
thanks but i want to control the output voltage(by avr ...not with resistors)

Well then several other choices come to mind...

1. If you have a 16 bit timer available you could limit the range and still have resolution. Your would not exceed 50% duty cycle if you want to keep output to half of the 5 VDC VCC.

2. If your VCC= 5 vdc then you can not have 100% duty cycle and not get aprox 5 vdc out. You have to divide with resistors OR find a way to run your AVR on 2.5 VDC instead of 5 VDC OR use external logic such as analog switch which has 2.5 VDC on the top.