Questions tagged [timers]
Timers are the hardware in the processor used to count and time events. Use this tag for questions about the hardware timers.
451 questions
0
votes
0
answers
68
views
Gross timing error between crystals
Got two boards, getting a stable counter error ratio between the two of ~0.9895 (counted ticks divided by calculated ticks). Is this not a bit too low ? With +/- 50 ppm between the two crystals I was ...
1
vote
1
answer
36
views
How can I achieve <50 ppm timing with a Sparkfun Artemis ATP?
I want to sample an ADC at very regular intervals. Right now, using millis/micros (which are driven by the internal RC oscillator), I'm off by around 3000 ppm, and it drifts.
Here are some things that ...
1
vote
1
answer
81
views
Generate all frequencies between 5 and 8 kHz in steps of 1Hz
Is it possible generate all frequencies between 5000 and 8000Hz, 1Hz in between with an ATmega328?
When I create a c-program outside the Arduino IDE to calculate the frequencies with the formula ...
1
vote
2
answers
96
views
Unwanted toggle on OC1A
The code below for the ATmega328P (Arduino Pro Mini 5V @ 16 MHz) produces a periodic sequence on timer1 pins OC1A and OC1B:
#include "Arduino.h"
// For Arduino Pro Mini 5V @ 16 MHz
// ...
2
votes
2
answers
715
views
Arduino Uno Serial.write() how many bits are actually transmitted at once by UART and effect of baudrate on other interrupts
With Arduino Uno Rev3, I am trying to maintain a delicate timing while handling data transmission. I want to send 6 bytes at a time, which takes around ~44 us when I time Serial.write(). The time it ...
1
vote
1
answer
152
views
Does changing the prescale for Timer 0 or Timer 2 affect the micros() function?
I am using an ATTiny88 to drive a PWM device. First of all, digging through the literature, it's hard to tell what the differences between the ATTiny85 and ATTiny88 are, and the vast majority of ...
0
votes
2
answers
104
views
Timer setup interferes with LED blinking logic
This example is a simplified version of what I really need to do, but I think it demonstrates the problem (= my misunderstanding?). I need to use a timer to count microseconds; my code shows how I ...
0
votes
1
answer
90
views
Arduino Mega 2560 time delays counting between events on different pins
I am wondering how I can precisely count time delays between rise events happening on 4 different lines/pins using Input Capture of Arduino Mega 2560. How can I synchronize timer/counters? Appreciate ...
2
votes
1
answer
723
views
Emulating Arduino Uno with QEMU: interrupts do not work
So I wrote this code for Arduino Uno:
// file qemu.ino
void setup() {
Serial.begin(9600);
}
void loop() {
Serial.println(millis());
}
And then compiled and uploaded it to the real ...
-1
votes
2
answers
992
views
I need a 10KHZ PWM signal from pin 3 and 11 using timer 2
The op of pin 11 should be inverse of pin 3. I used digitalreadfast and digitalwritefast and used simple if else. But the delay is high as 10us. What should i do?
I found this code in forum but its ...
0
votes
1
answer
163
views
Unable to get keypad key in while loop [closed]
I'm a beginner into Arduino so I have a little problem where I'm trying to do a countdown on LCD using while loop but I'm also trying to get a key input inside that same while loop. Problem is that ...
0
votes
1
answer
103
views
Use TCC1 timer to generate PWM on personnal board built with SAMD21E18A
I'm trying to generate a PWM signal from TCC1. I have a personnal board built with SAMD21E18A. I want to use pin 27 PA30, in my variant.cpp I have this line:
{ PORTA, 30, PIO_PWM, PIN_ATTR_DIGITAL|...
1
vote
1
answer
362
views
Square wave generator generates a shorter pulse from time to time
I am using an arduino Micro to generate 8 square waves on 8 pins. The idea is as follows: on pin 13 is the main square wave. It represents a certain BPM (beats per minute). The other 7 pins should ...
0
votes
1
answer
200
views
Problem with Bing generated code for automated chicken coop door
Glenn from Sweden here. I was wondering if some kind soul could help me out here.
My partner bought a cheap chinese knock-off automatic chicken coop door that operates based on sunlight. Link to the ...
2
votes
2
answers
632
views
Using Internal Timer Interrupt to Read Analog Sensor
I'm having difficultly using an internal timer interrupt with my Arduino Nano to properly capture a specific value from a linear potentiometer and then instantly stopping the actuator.
I basically ...