Thanks a lot Henrik.
It works now
To get a nice "visual" (= visible on scope) close to 50% duty-cycle, I set PDC0L to 100.
I now have to start to "play" with the formula(s) and registers to change values - I might come back for more questions
Sorry to ask maybe a stupid question but what is the interrest of a PWM "resolution" parameter? I can understand resolution for an incoming analog signal, but PWM is only output as far as I know...Code:' Set up PWM1 (PORTB.1) T0CON = %00000000 T1CON = %01001010 PTCON0 = %00000000 'Postscale 1:1, Fosc/4 Prescale 1:1, Free Running Mode PTCON1 = %10000000 'Time base in ON, Time base counts up PWMCON0 = %00010000 'PWM1 enabled PDC0L = 100 'Duty Cycle control for PWM0/1 PTMRL = %00000000 PTMRH = %00000000 PTPERL = %00110011 ' = 51 PTPERH = %00000000
Another thing; look at the pulsed signal, especially at the high state where the signal is kind of rippled. What's wrong here?
![]()






Bookmarks