If I understand the OP correctly, a more accurate description of what he wants is: 4 PWM channels, each with a PWM frequency of 50Hkz, and 8 bit resolution for the duty cycle. This is _not_ something to be done in software since, 50Khz * 256 = 12,800,000 samples per second. Also, be aware that the 18F448 actually has only 2 independent PWMs (see the data sheet). My recommendation might be to find a small PIC with 2 PWMs and use two of them. Bob Ammerman RAm Systems ----- Original Message ----- From: "D Yates" To: Sent: Friday, December 05, 2003 2:08 AM Subject: Re: [PIC] : Choice of PIC > ----- Original Message ----- > From: "harshit suri" > > > I need a chip that gives me 4 channels of PWM . I want > > 4 simultaneously > > operating PWM channels. > > I think Einstein wrestled with this problem once... something about standing > on a hill when two lightning bolts flash with a mirror to figure out if they > were really simultaneous? > > >Preferable frequency of > > generation should be greater > > than 50 Khz. > > Ooooh! so not really simultaneous after all! > > > I wish to have at least 8 bits of resolution PER > > channel. meaning 256 levels > > of speed control (The application is DC motor speed > > control) > > I wasn't being able to find a cheap solution. so i > > thought id buy a cheap > > PIC. Program it so that my main microcontroller can > > send commands to the PIC > > to adjust the speed levels. > > Sounds good, but remember that most pics can only source or sink about 20mA, > so it would require an external amplifier for driving most motors. > > > I was looking at the microship site and prefered the > > flash devices as they > > are reprogrammable. > > Programmable microships? Sign me up! > > > I found the PIC18F448 Family : it had 5 PWMs > > advertised. But it seemed an > > overkill as it was a 40 pin device.(I prefer DIPs). > > PWM doesn't have to be done in hardware. It's not too hard to bit bang, and > if you have a dedicated pic for it anyway... how else are you going to use > all those processing cycles? The hardest part will be to communicate the > speed for four different channels to the pic - how are you planning on doing > that? You need to specify what sort of signals you'll be expecting for > input (analog? serial? parallel?) before you can select a suitable chip. > > > I have never worked with PICs before. But do know they > > are cheap and simple > > devices to work with > > 1)Pls suggest a chip : any chip which can do the > > above. and has minimal I/o > > and is cheap :-) > > Sounds like any chip with more than 8 I/O pins could do it in some form or > fashion. 200khz of bandwidth (4x50khz) takes up only 4% of the available > instruction cycles on a pic running at 20mhz, leaving quite a few cycles to > sample your input, do some math, then generate PWM on the output. > Transferring 32 bits of resolution into the chip through a serial interface > would probably be one of the biggest time consumers, but it won't break the > project by any means. > > Pick a chip with a USART that can oscillate at 20 mhz and has at least 4 > pins left over for outputs, and that should get you started. The 16F62x is > a good candidate. > > > 2)Can anyone give code for the same. > > Maybe we could program the chip and mail it to you as well? ;) > > > Thanks > > -- > http://www.piclist.com hint: The PICList is archived three different > ways. See http://www.piclist.com/#archives for details. > -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.