Re: PIC as PLC modem - how to output two programmable frequences from PIC?
Wojciech Zabolotny email (remove spam text)
On Sun, Mar 02, 2003 at 01:25:43PM +0100, Wojciech Zabolotny wrote:
> However the main problem is how to generate the square waves with the
> programmable frequency... Can it be done with the CCP module? (I need only
> one edge to be jitter free - all external circuits can be "raising slope
> triggered", so the jitter of the failing edge does not matter at all).
> Could it be done as follows?
> Both CCP work in "compare, set output on match" mode (0x1000).
> After each CCPxIF interrupt, the pin CCPx is reset by software, and the new
> CCPRx value is calculated as follows: (PULSE_LENx - the period of the
> square wave)
> CCPRx = (CCPRx + PULSE_LEN) modulo 0x10000
Probably this method should even be used to generate a symmetric waveform, if
it is possible to change the mode "on the fly".
Just after each interrupt the mode should be chnged from 0x1000 to 0x1001,
and after the next interrupt from 0x1001 to 0x1000.
So single TIMER1 + 2 CCPs should be able to generate two symmetric
waveforms with different frequencies and jitter-free slopes.
(however the interrupt rate will be high).
Is it correct?
Wojciech M. Zabolotny
http://www.ise.pw.edu.pl/~wzab <--> ise.pw.edu.plwzab
http://www.freedos.org Free DOS for free people!
http://www.piclist.com hint: To leave the PICList
In reply to: <20030302122542.GA1598@wzab.one.pl>
See also: www.piclist.com/techref/microchip/ios.htm?key=output
You must be a member of the
piclist mailing list
(not only a www.piclist.com member) to post to the