Jan-Erik Soderholm wrote : > Now, just made a few additinal test... > If I added a (dummy) assignment to T2CON *before* the > call to PWM_Init, the source built OK !! > > OK, fine. Now on to test this on real hardware... :-) Back from the tests... After a few minor changes to the PWM example code in the 16F877a directory, I now have a LED fading up and down nicely connected to a 12F683 using the hardware CCP/PWM module and the PWM library in mikroPascal. Hep !! The code looks like this : program lhsim_01; var j : byte; var i : byte; begin j := 1; // initial value for j i := 1; // initial value for i TRISIO := 0; // designate gpio pins as output PWM_Init(5000); // initialize PWM module (5 KHz) PWM_start; // start PWM while true do // endless loop begin delay_ms(1); // wait 1 ms j := j+i; // increment j PWM_change_duty(j); // set new duty ratio (0=0%, 255=100%) if j = 200 then i := -1; // switch to fading down if j = 1 then i := 1; // switch to fading up end; end. Regards, Jan-Erik. -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist