On Sat, 10 Jul 2004 01:04:22 +1200, you wrote: >> Would a PIC12F675 using internal osc with code to control the PWM and >AD's, with a linear or log pot as input, or with the PIC using it's A/D = pin >as input. The PIC code would be minimal, and certainly offset if the = volume >produced is high. >Would that work? >> > >No hardware PWM I think. And cost is rather high compared with = alternatives. >Using Digikey as a guide (there MAY be cheaper but DK is easy to get >comparison prices from). 12F675 is about $US1.35/1000s > >The tiny11 (also no hardware PWM) is $0.25 or less in that quantity! The >question as to suitability of low frequency PWM is the only issue. > >_____________________________ > >> ATTiny13 would seem a good fit - internal RC osc, on-chip ADC, = internal >RC at up to 9.6MHZ >you could get about 0.1uS PWM resolution in software, so about 0.2% >resolution at 20KHz >> > >A nice processor, but again, price is too high. About $US0.75/1000s >And still no hardware PWM AFAIK. >My PWM spec of at least 6 bits of resolution at 20 Khz means a PWM bit >changes at 1/(20,000 x 2^16) =3D 0.78 uS >At 20 Mhz you probably get about 15 MIPS (even though Atmel say 20 MIPS = at >20 Mhz. If this sat in a tight loop doing nothing but PWm you would = probably >make it. 15MIPs * .78uS =3D ~ 12 instructions per PWM bit! Not really = enough >to run interupts. Reading an A2D in there would get tough. I've little = doubt >that Scott D could coax out the magic needed, but it still costs more = than >the analogue solution and does the PWM and nothing else You can get one-cycle software PWM resolution on a PIC or AVR, using = either a short jump table to trim the PWM period, or timer interrupts.=20 e.g.=20 addwf pc nop nop nop will give you a 2 to 5 cycle trim for W values of 3 to 0 Timer int would normally be the best way as you'd have plenty of = foreground time to play with. Any trickiness dealing with the whole 0..100% range can be overcome, if = necessary with more than one piece of code.=20 -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu