Thanks for reposting Mike, that is a brilliant idea! The frequency measurement overhead should be almost zero. And input frequency well above 5 khz :-D I'm liking the 629 again ----- Original Message ----- From: "Michael Rigby-Jones" To: "Microcontroller discussion list - Public." Sent: Friday, January 06, 2006 4:49 AM Subject: RE: [PIC] Am I crazy? PWM on a 12f629 > > > 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 > -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist