Timer is not accurate when the time set below 1ms
when time set below 1ms , time is not accurate
timer set actual ouput
1000ms 1080ms
0.9ms 1014ms
0.8ms 0.84ms
0.5ms 0.7ms
0.1ms 0.2ms
This My test script . It is a PWN Wave. #include <DueTimer.h> #include "variant.h" int Pump1=11; int Pump1_High_Time=100; int Pump1_Low_Time=100;
void ontime_pump_high(){
digitalWrite(Pump1, HIGH);
Timer4.stop();
Timer4.attachInterrupt(ontime_pump_low);
Timer4.start(Pump1_High_Time);
}
void ontime_pump_low(){ digitalWrite(Pump1, LOW); Timer4.stop(); Timer4.attachInterrupt(ontime_pump_high); Timer4.start(Pump1_Low_Time);
}
void setup() { // put your setup code here, to run once: pinMode(Pump1, OUTPUT); digitalWrite(Pump1, LOW); Timer4.attachInterrupt(ontime_pump_high); Timer4.start(10*1000) ; }
void loop() { // put your main code here, to run repeatedly:
}
#56 should have fixed it. Can you run the tests again to check?