ADC measurement is 8bit wide while your PWM has 10bit. Measure your potmeter with 10bit resolution and then pass the result to the PWM. Your solution is ok if resolution loss does not count.
On Thu, Jul 1, 2021 at 9:16 PM hans <[email protected]> wrote: > I have solved the problem by changing this part: > > var word measure -- ADC value / PWM duty > cycle > > -- ---- mainline ---- > forever loop > measure = adc_read_low_res(ADC_CHANNEL) > measure = measure *4 > -- get ADC result > pwm1_set_dutycycle_ratio(measure) > --pwm1_set_dutycycle_percent(100) > -- copy to PWM duty cycle > end loop > > Op donderdag 1 juli 2021 om 19:23:47 UTC+2 schreef hans: > >> I have now downloaded the adc.jal from the latest discussion ( june >> 2021), same result. >> >> Op donderdag 1 juli 2021 om 17:40:57 UTC+2 schreef hans: >> >>> Hello, it's me again >>> I have tested this sample. The PWM goes from zero to about 25% and >>> again.. manual set of the PWM gives the normal result, so i feel there is >>> something wrong with the ADC reading. >>> Hans >>> >> -- > You received this message because you are subscribed to the Google Groups > "jallib" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/jallib/8202716d-2ae4-4407-8f6e-4a1e0181c1d8n%40googlegroups.com > <https://groups.google.com/d/msgid/jallib/8202716d-2ae4-4407-8f6e-4a1e0181c1d8n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "jallib" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jallib/CAM%2Bj4qsbGAJ%2BrY5tVOG7XaOBkc0KJfDQSWC_Uk4wU2_UbMDktQ%40mail.gmail.com.
