Hi,
I have been writing a stepper motor type program for which the timing is a bit persnickety. For the Arduino's there is an issue whereas there the thing flips over at 14 bits, so special care is required if you want to delay to 16383 microseconds.
Does the Teensy 4.1 suffer from the same code?
What is the rollover limit?
(Thank you)
ref: https://www.arduino.cc/reference/en/language/functions/time/delaymicroseconds/
I use something like this, but I don't know if it's even necessary.
I have been writing a stepper motor type program for which the timing is a bit persnickety. For the Arduino's there is an issue whereas there the thing flips over at 14 bits, so special care is required if you want to delay to 16383 microseconds.
Does the Teensy 4.1 suffer from the same code?
What is the rollover limit?
(Thank you)
ref: https://www.arduino.cc/reference/en/language/functions/time/delaymicroseconds/
I use something like this, but I don't know if it's even necessary.
Code:
void delayMS( unsigned long len )
// Patched Microseconds Delay to Include Longer than 16383. Apparently DelayMicroseconds is only 14-Bit, as in WTF?!
// Ref: https://www.arduino.cc/reference/en/language/functions/time/delaymicroseconds/
{
volatile unsigned long millisecs;
volatile unsigned long microsecs;
// Delay Longer and Adjust
if ( len > 8192 )
{
// Calculate Miliseconds Delay
millisecs = len / 1000;
// Delay
delay ( millisecs );
// Calculate Remainder
microsecs = len % 1000;
// Delay Remainder
delayMicroseconds ( microsecs ) ;
}
else
{
delayMicroseconds ( len );
}
}