2021-12-14 (Tu) EWC_Panel Incoming time pulses

I created the necessary variables to record the incoming clock pulses. The program recorded timestamps from each instance in an array and printed the pulse between each occurrence. I could see the gap as a small number, roughly 41 milliseconds, when my tempo was 60bpm. Some of the times were 82 milliseconds, indicating that my timer panel occasionally missed a pulse. I can make my drum machine and other devices ignore those hiccups, but I should also fix the timer panel code.

My first attempt at ignoring the missed pulses was to use the last-known good tempo as a stand-in, but this was a problem if I lowered the tempo too quickly. For example, if I sat at 200bpm and dropped to 100bpm, all my incoming periods were double the expected and immediately invalidated.

I switched techniques and recorded the time signatures of four subsequent clock commands, then compared their differences, and the reading is valid if they were all within a margin of error. Unfortunately, I couldn't get any consistent readings this way, and I don't understand why.

I scaled back my ambitions and focused on getting reliable readings. Instead of recording a bunch of timestamps and calculating their differences later, I compared the two most recent clock signals and stored their difference. Despite the simplicity of this method, I had trouble. I kept digging, and I think the problem was that I wasn't allocating enough room in my arrays, and they were overflowing and corrupting other variables.

Arduino has a serial plotter to visualize incoming data. I printed all the tempo values at 60bpm, and it usually wavered at 60bpm or 61bpm, but it often dipped to 30, which indicates the missing signals. I will have to solve that issue later. If slight fluctuations are a problem, I can also change the timer panel to increment 5bpm at a minimum, and all my devices can acknowledge that coarse granularity.
Unsteady time pulses

The rest of the posts for this project have been arranged by date.
First time here?

Completed projects from year 1
Completed projects from year 2
Completed projects from year 3
Completed projects from year 4
Completed projects from year 5
Completed projects from year 6
Completed projects from year 7
Completed projects from year 8

Disclaimer for http://24hourengineer.blogspot.com and 24HourEngineer.com

This disclaimer must be intact and whole. This disclaimer must be included if a project is distributed.

All information on this blog, or linked by this blog, is not to be taken as advice or solicitation. Anyone attempting to replicate, in whole or in part, is responsible for the outcome and procedure. Any loss of functionality, money, property, or similar, is the responsibility of those involved in the replication.

All digital communication regarding the email address 24hourengineer@gmail.com becomes the intellectual property of Brian McEvoy. Any information contained within these messages may be distributed or retained at the discretion of Brian McEvoy. Any email sent to this address, or any email account owned by  Brian McEvoy, cannot be used to claim property or assets.

Comments to the blog may be utilized or erased at the discretion of the owner. No one posting may claim property or assets based on their post.

This blog, including pictures and text, is copyright to Brian McEvoy.
2021-12-12

Comments