Pages: [1]   Go Down
Author Topic: Arduino always doing things on the background?  (Read 606 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I am new to Arduino (I have been using Bascom for a time). I understand that Arduino is always updating the clock used by millis() and may be doing a few other other thing on the background that dont seem to be very clearly documented. Is it so? If yes, is there an easy way to disable all that?
I do need to have a precise timing(without any jitter) when executing my code. Is it possible?


Thanks a lot for your help,

Manuel

Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 308
Posts: 26474
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I understand that Arduino is always updating the clock used by millis() and may be doing a few other other thing on the background that dont seem to be very clearly documented. Is it so?
No, I don't think it is so.
I'd say it is very clearly documented - in fact, you've got the source, so you can find out for yourself.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

New Jersey
Offline Offline
Faraday Member
**
Karma: 70
Posts: 3726
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What are you doing that you feel would be impacted by this?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


 what do I do to disable all the background tasks like updating millis() ?


Thanks,
Manuel
Logged

Portugal
Offline Offline
God Member
*****
Karma: 6
Posts: 962
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Disable interrupts, thats whats going up. Milis is updated by a timer overflow, either stop the timer or disable interrupts.
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 631
Posts: 50115
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

There are some activities that are performed in response to interrupts, like updating timers, including the one used by millis(). You could take careful aim at your foot, and disable interrupts.

I don't think that this is going to be a solution to your unstated problem, though. So much stuff that the Arduino does, like PWM, Servo control, receiving serial data, updating timers, etc. requires interrupts.

Quote
I do need to have a precise timing(without any jitter)
Well, now, that is going to be difficult if you've disabled the timers.
Logged

Portugal
Offline Offline
God Member
*****
Karma: 6
Posts: 962
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Maybe he is using cycle counted assembly.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am trying to send a given number of pulses to a 17/128th microstep controller and also send trigger pulses to a video camera each 1280 microsteps. The timing needs to be as precise(no jitter) as possible

Manuel
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sorry, I wanted to say 1/120th micro step controller.
If I disable interrupts, I cannot use delayMicroseconds(), can I ?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


 Senso,

 disabling / enabling interrupts with cli()  and  sei()   seem to solve the problem and I can stil use delayMicroseconds() as I wanted.

 Thanks so much!

 Manuel
Logged

Pages: [1]   Go Up
Jump to: