Go Down

Topic: DUE PWM Frequency (Read 57627 times) previous topic - next topic

Crystal_Radio

Hi all,
I'm trying to low the pwm freqeuncy of an arduino due using timer registers. I used an instruction like this

TCCR0B = TCCR0B & 0b11111000 | 0x1024

I would low the frequency using a prescaler equal to 1024. Arduino IDE tells me that "TCCR0B was not declared". How can I solve this problem?
Please help me
Thank you all.

odayali1975

Dear antodom,

thanks for library, Unfortunately, I have the following error when I've tried to compile the PWM test on my Due

thanks in advance

error:Arduino: 1.8.1 (Windows 10), Board: "Arduino Due (Programming Port)"

C:\Users\odaya\Downloads\pwm_ard\pwm_lib-aeec48f08c719beb9fa890b7d126095c809b8051\examples\basic_test\basic_test.ino:35:21: fatal error: pwm_lib.h: No such file or directory

 #include "pwm_lib.h"

                     ^

compilation terminated.

exit status 1
Error compiling for board Arduino Due (Programming Port).



antodom

Hi there @odayali1975,

Have you installed the library in the right place? It should be in the subdirectory libraries in the directory where you have your projects. Just check the preferences you have in your Arduino IDE.

I hope it helps.
------------
antodom

tokapi

#78
Jan 17, 2017, 03:10 pm Last Edit: Jan 17, 2017, 04:50 pm by tokapi
Hello everyone,

I have read this entire thread since for a work project I (urgently) need to be able to port arduino Mega code to arduino Due.

The goal is to use analogWriteResolution(12) and analogWrite() to command the duty cycle of a 20kHz PWM with 12bits precision (instead of 8bits on Mega).

But I'm stuck on changing the PWM frequency... According to the first posts I should find the variant.h file in order to change it, but I cannot find it at all on my Windows Arduino 1.8.1 installation ?

Can somebody help me please ?

EDIT : ok, found it, it was in C:\Users\YourName.YourName-PC\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.11\variants\arduino_due_x

Go Up