Hi, What about using a signal instead of a variable for the counter? Then, you make it loop to 99 inclusive and back to 0 in a synchronous process and let the derivation of the 10k clock derive from that in a separate unclocked process that turns it on when it is (99 - duty cycle) and off when it is 99.. Regards, Peter -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist