Timing (by Tom J.)
I made a simple function generator from a PIC12F683.
My target frequency was 50hz, so I did a cyclic on/off at 20ms.
It reads 17hz on the bench, anyone know what I did wrong?
Cycle time 10
INTOSC 4MHZ.
The ladder has only 4 rungs
(no subject) (by MGP)
Much better than a page of text;)
You must ensure that the timing is a multiple of the Cycle Time.
With 10ms CT you don't get 33mS but 40mS TCY time.
I don't know if your OSCCON (0x8F) register is correct, I will check that again if I have more time, but you can start.
(no subject) (by Ziggy)
No... not if You want a full range of output frequencies.
The trick is to identify a lowest cycle time able to provide You with all the frequencies You need with an acceptable error.
Also optimise the ladder to only be able to produce the selected frequency when called for and any other rungs not necessary during critical timing are not in the evaluation path.