Odd timing question (micros() and fractions)

I think I've registered to the wrong forum;

please delete (not just ban) my account (as per european laws); I do NOT want to be part of this forum

Thank you!

'sid

I don't understand what you are trying to achieve. Please describe the project and the role played by your function.

The proper way to use micros() and millis() is with subtraction as that avoids errors when the value rolls over back to 0. Like this

if (micros() - startTime >=  interval) {

What is the purpose of the calculation 1000000/perCycle. It is obviously converting units, but from what to what?

...R

since the forum moderator appears to be an [censorworthy], I'll leave this here!

itsid: Hmmmm closest thing: think of it as intake air pressure values over the course of all four engine strokes and perCycle as the rpm the engine is running at..

I'm immediately suspicious when someone won't describe the actual thing.

Either it's illegal or anti-social or it's a commercial project for which the developer hopes to increase his profit by getting some patsy to give free advice.

...R

I know, no rule broken per se.. but frankly getting called out as trying something illegal or anti-social because I don't want to spend a few hours explaining 4000 more lines of code that are not relevant to the question at all is an insult..

I'll leave you the commercial suspicion.. I doubt it'd ever do what I want it to (or as good as I want it to be), but if it does...who knows shrugs I'm more inclined to a BOM and code on github tbh but it's not on my to do list sooo that's indeed not pulled from thin air. (chance of going commercial less than 0.005% I'd say but not zero)

I think there are only two options really: either you have no idea to go about solving the microscopic timing and want to wiggle out (fair enough), or you are indeed an censored myself you come along nicely with the rest of forum as it seems, so this mismatch is likely on my behalf; I'd gently ask you to leave me alone, since certainly I will not converse with you, other than calling you names which I really would like to avoid.

The rest of the code is not relevant to the question; neither is if I'm attaching the MPX5050dp (air pressure sensors that are indeed at the far end atm) or some SS495A (Hall sensors I've left from another 'noneofyourfbusiness' I was tinkering with) Since frankly I recycle and reuse code whenever I can.. so chances are the next project holds a similar loop trying to generate a similar graph (maybe at a different time frame in a different scale) and I again use those very lines with minor adjustments.

And what, should I ask for your consent then?

'sid

I know, no rule broken per se.. but frankly getting called out as trying something illegal or anti-social because I don't want to spend a few hours explaining 4000 more lines of code that are not relevant to the question at all is an insult..

I'll leave you the commercial suspicion, I highly doubt that thing will do what I want it to (or as good as I want it to) but if it does and someone has a use for it.. who knows, personally I'm more inclined to a BOM and code on github myself (but how would you know, right?) I'd say chances are less than 0.005% for it to go commercial, but in fact not zero ;)

That leaves me with two options really; A) you have no idea to go about solving this tiny timing inaccuracy (fair enough) B) You are an [censored myself] Since you seem to get along with the rest of the forum quite nicely, I think that mismatch is on my behalf. So I'd gently ask you to leave me alone, since I won't converse with you other than calling you names; which I would really like to avoid :D

Sidenote: the current use is none of your business, since it doesn't say anything about it's future use; right now there are indeed four MPX5050dp (air pressure sensors) on the far end, but next time I might need a similar graph for some SS495A (hall effect sensors) in maybe a different time scale and then I'd reuse/recycle those very lines... And surely I won't ask for your consent of course

'sid

So you get 99,960 instead of 100,000. Is that four hundredths of a percent really that critical?!? Forty microseconds?!? It sounds like you are seeking perfection where it is not needed.

itsid is on a 24 hour timeout.

Bob.

As per request, account deleted (but the posts remain)