>-----Original Message----- >From: piclist-bounces@mit.edu [mailto:piclist-bounces@mit.edu] >Sent: 05 January 2006 15:25 >To: Microcontroller discussion list - Public. >Subject: Re: [PIC] Am I crazy? PWM on a 12f629 > > >Thanks everyone. I find the pic very interesting, I'm starting >to like it. I think I did go off the deep end on the price of >the processor issue, I mean if I double the price I'm still at >less than $2, that's not a lot of programming time! This isn't >that cost sensitive of a project that a $5 processor would kill it. > >Time to look at the better and faster processors. I'm sure the >12F629 could be optimized to do it but it would be a real >squeeze. The 12F683, does look a lot better and I could run it >at 20 Mhz Hmmm, that would be a lot better to capture that 5k >input frequency... > > BTW, Microchip does not list PWM capabilities for the 12F683, >is the website wrong? I guess you didn't get the reply I sent to your first (untagged) post, so I'll re-post it. > Crazy or not? Not crazy at all, quite doable. The 16F629 has two counters, so you can set up the other one (timer1) in counter mode to make the incomming pulses increment the timer. If you check the number of pulses counted within a fixed period, then you have frequency. Your PWM timer is running at a fixed rate, so you can check the value in timer1 at a suitable multiple of this period, after which you would either clear the timer1 registers ready for the next measurement, or just store the current value to subtract from the next value. This means all output and input capture will be handled via interrupts. You main loop can then handle the button polling and slope adjustment etc. Regards Mike ======================================================================= This e-mail is intended for the person it is addressed to only. The information contained in it may be confidential and/or protected by law. If you are not the intended recipient of this message, you must not make any use of this information, or copy or show it to any person. Please contact us immediately to tell us that you have received this e-mail, and return the original to us. Any use, forwarding, printing or copying of this message is strictly prohibited. No part of this message can be considered a request for goods or services. ======================================================================= -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist