This is a PWM generator, where the duty cycle can be controlled with two pushbuttons. The pushbuttons are debounced by software and a repeat function is implemented, like used in remote controls: you can hold down the pushbutton some time and change the duty cycle continuously. A short push changes one step. I've tested it with a PIC16F628, but it can be compiled for the very cheap PIC12C508, too, which has an integrated oscillator.
The schematic includes a sample how to use the PWM signal: With a lowpass filter with R1 and C2 you can change the voltage at TP1 between 0V and 4.2V with the two pushbuttons S1 and S2. The source code has 32 different duty cycle steps, saved in a lookup table, with a resolution of 8 bit. You can recalculate the lookup table, e.g. for a logarithmic scale. The highest value for the duty cycle is not 0xff, but about 0xf0, because the implementation waits in the high phase, and then needs some time for checking the keyboard and updateing the variables in the low phase.
Sample output at RA0:
The source code
23 . März 2007, Frank Buß