> From: Stuart Allman > > I am working on an amplifier design, and I was thinking about using a > class D,G,or H design. Could someone please give me a hint on how to > implement the pulse width modulation that is necessary for these > topologies? I was thinking that I could just use a sample and hold > device off the output and compare that value with the current input at set > intervals. Is this how PWM works, or is it more complicated? > > Just so I'm not chastised for asking this question...there is a PIC > involved. For the benefit of us all, perhaps you could give a brief exposition of what classes D, G and H are (my education stopped at A, B, C). Anyhow, PWM as applied to audio is a digital-to-analogue technique. If you have an output which can only take one of 2 values (say 0 and +5V) then you can create a low bandwidth DAC by switching between the 2 output values at a frequency much greater than the audio frequency of interest. The analogue output range is precisely 0-5V. To obtain a value of, say, 1V then the digital output should be low 4/5 of the time and high 1/5 of the time. The digital output should be switched at a rate of, say, 44KHz and fed into a 20KHz low pass filter (the brick-wall type used in CD players etc.) There's no need for a SH or comparator if you are talking about PWM pure and simple. However, since you want to convert an analogue input into a PWM output yes you do need a comparator and a sawtooth generator. The SH would be better replaced by an input bandwidth limiter. A PWM output is obtained from the comparator by feeding the sawtooth into the inverting input and the analogue signal into the other. As a matter of interest, the PIC16C73/4 contains a 10-bit resolution PWM output. Supposing you run it at top speed, 20MHz, then over 2**10 = 1024 clock cycles, you can adjust the output duty cycle over every fraction (0..1024)/1024. The output frequency will be 20MHz/1024 = 19.53125KHz. You can trade off output precision vs output frequency e.g. 8-bit precision at 78.125KHz. Not exactly CD quality, but not too bad for telecom applications. I have successfully made a PIC-powered tone generator by feeding the PIC PWM output directly into a 1K:8ohm transformer with the 8ohm side connected to a mini speaker. It's quite loud, and has the advantage of zero power usage when off, unlike most amps which have a substantial quiescent current. Regards, SJH Canberra, Australia