Hello!
I'm looking to create a clock to drive a MAX7401 filter (datasheet: http://datasheets.maximintegrated.com/en/ds/MAX7401-MAX7405.pdf) using an 08M2. The datasheet states that a clock with a 40-60% duty cycle powered from 0 to VDD (5v for the 7401) should be used. The equation to determine the corner frequency, which can range from 1Hz to 5kHz, is corner frequency = clock frequency/100. To get the full range of filter, the PWM would need to from 100Hz to 500kHz. While getting the whole sweep would be great, it is probably not all that useable to me. Perhaps something in the line of clock frequency 10kHz to 200kHz (or 100Hz to 2kHz corner frequency) would be good to play around with, unless it's just as easy to get the 1Hz to 5kHz range.
I used the pwmout wizard in the programming editor to figure out what the code would be for each extreme and it puts out:
pwmout pin, period, duty cycles
pwmout 2,99,200 for 10kHz @50% duty cycle
pwmout 2,4,10 for 200kHz @50% duty cycle
So it seems that period and duty cycle are related, somehow. Doing a little math, it looks like they are related linearly, with duty cycle = (2*period)+2.
So I guess my question is, am I on the right track to get this accomplished, or is there an easier way? I figure I can have the chip read a variable voltage with readadc10, scale that into the period range of 4 to 99, then use the (2*period)+2 for the duty cycle? Will the pwmout accept values with decimal points that the scaling of the readadc to period is sure to put out?
Thank you for your guidance!
I'm looking to create a clock to drive a MAX7401 filter (datasheet: http://datasheets.maximintegrated.com/en/ds/MAX7401-MAX7405.pdf) using an 08M2. The datasheet states that a clock with a 40-60% duty cycle powered from 0 to VDD (5v for the 7401) should be used. The equation to determine the corner frequency, which can range from 1Hz to 5kHz, is corner frequency = clock frequency/100. To get the full range of filter, the PWM would need to from 100Hz to 500kHz. While getting the whole sweep would be great, it is probably not all that useable to me. Perhaps something in the line of clock frequency 10kHz to 200kHz (or 100Hz to 2kHz corner frequency) would be good to play around with, unless it's just as easy to get the 1Hz to 5kHz range.
I used the pwmout wizard in the programming editor to figure out what the code would be for each extreme and it puts out:
pwmout pin, period, duty cycles
pwmout 2,99,200 for 10kHz @50% duty cycle
pwmout 2,4,10 for 200kHz @50% duty cycle
So it seems that period and duty cycle are related, somehow. Doing a little math, it looks like they are related linearly, with duty cycle = (2*period)+2.
So I guess my question is, am I on the right track to get this accomplished, or is there an easier way? I figure I can have the chip read a variable voltage with readadc10, scale that into the period range of 4 to 99, then use the (2*period)+2 for the duty cycle? Will the pwmout accept values with decimal points that the scaling of the readadc to period is sure to put out?
Thank you for your guidance!