OK, I'm pretty up to speed on the smaller 'axes but I'm clearly missing something here...I'm trying to generate a 5KHz 50% DC on C.1 of a 40x2 4MHz resonator, my initial try was:
pwmout C.1 , 199, 400
Scoped the pin, excellent, I seem to have a 50% DC output. On closer inspection though I'm at 10KHz and fairly regularly I get a blip of ~100% extended "off" time.
I have literally nothing else going on on the chip at the time, so it's not "busy" for any reason I can see, and it's always extended off times, not on. I figured I'd mis-calculated so I used the wizard and got the same command, so I checked the resonator and its definitely 4MHz.
What's going on?!
I have a feeling it is something to do with the fact that I'm using an external 4MHz res (as I would have with the non-X 40 part) and the X2 is defaulting to using its internal resonator at 8MHz? I've only just noticed this addition now I'm scurrying through the commands datasheet, both of these points would be better placed on the basic parts datasheets IMO.
Edit again:
On closer inspection, the 10kHz was due to running at 8MHz, however the extended low time still remains a problem.
pwmout C.1 , 199, 400
Scoped the pin, excellent, I seem to have a 50% DC output. On closer inspection though I'm at 10KHz and fairly regularly I get a blip of ~100% extended "off" time.
I have literally nothing else going on on the chip at the time, so it's not "busy" for any reason I can see, and it's always extended off times, not on. I figured I'd mis-calculated so I used the wizard and got the same command, so I checked the resonator and its definitely 4MHz.
What's going on?!
I have a feeling it is something to do with the fact that I'm using an external 4MHz res (as I would have with the non-X 40 part) and the X2 is defaulting to using its internal resonator at 8MHz? I've only just noticed this addition now I'm scurrying through the commands datasheet, both of these points would be better placed on the basic parts datasheets IMO.
Edit again:
On closer inspection, the 10kHz was due to running at 8MHz, however the extended low time still remains a problem.
Last edited: