>-----Original Message----- >From: piclist-bounces@mit.edu [mailto:piclist-bounces@mit.edu] >Sent: 05 January 2006 03:56 >To: Microcontroller discussion list - Public. >Subject: Re: [PIC] CCP Compare Mode Question > > > >>> So, I can tell the CCP to set or clear a pin on a match. >Let's say I >>> tell it to set the pin on the match. How do I clear the pin? >> >> bcf LATx,CCP_Pin_No >> >> I take it you're wondering about creating a pulse of a precisely >> planned length without fiddle-farting around with a busy loop? Start >> Timer1, setup the CCP module to go high on match, put the >appropriate >> value for the pulse length of interest into CCPRx, clear >TMR1L, clear >> TMR1H, clear the CCPx LAT bit. Once Timer1 is running and the CCP >> module is set to go high on match, all you need to do is clear the >> TMR1 registers and the appropriate LAT bit. >> > >Thanks for the response! I'm just thinking ahead on a new >design. The datasheet seems to imply that the compare flip >flop is not the same as the output latch, which is why I did >not think a bcf of the latch bit would work. They could, of >course, reset both flip flops with the bcf. The datasheet and >ap notes just don't make that clear. Thanks for the ideas, >though! I'll give it a try in the next couple weeks when I >have the hardware ready to go. > >Harold The last time I tried this on a 16F part, you could not set/reset the CCP pin until you had disabled the CCP module itself. Of course, the 16F does not have a LATx register, so things may be different on the 18F. 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