Pages: [1]   Go Down
Author Topic: Global Interrupt Enable and disable sei() and cli() - Due equivalents?  (Read 1265 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi
Noob here....
Does anyone know if there are equivalents for this on the Due?  I assume these commands are for the Uno processor and the the Due.
Any help would be greatly appreciated.

TIA
Rick
Aurora, IL.

Logged

Offline Offline
God Member
*****
Karma: 32
Posts: 507
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

interrupts() and noInterrupts()
Logged


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

I've been trying those....but they just don't seem to behave the same as the sei and cli commands....

thanks.

anyone else?
Logged

Offline Offline
Sr. Member
****
Karma: 0
Posts: 353
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Been looking for the same myself, and i guess that due to the complexity of the difference in timers, and which you use, you might have to call specific stop interrupts and/or peripherals interrupts specific stop/start call commands..
Logged

10 LET Loop=Infinite
20 GO TO 10

Offline Offline
God Member
*****
Karma: 32
Posts: 507
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Could you post your code, and say what you expect it to do and what it actually does? All I can say is that interrupts and noInterrupts work as expected for me.
Logged


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

all i'm really trying to do is recreate the fan rpm app with multiple fans and lcd's.  I'm sure you've seen the original code a million times...it works fine on an uno ... but gives erroneous results (I believe) on the due.  You, apparently, need to suspend the interrupts in order to make the calculation for rpm and write to the lcds.  And, I believe, the interrupts need to be suspended in turn for each fan you are reading.  I know, from asking Noctua, that each fan pulses twice per revolution, however when I use the interrupts(), noInterrupts() commands I get results that are different than what was experienced on the uno.  The only reason I switched to the Due was in order to declare additional interrupts and thus add more fans...pumps...whatever.  The code...mine?  Nah, right now it's a hodgepodge of different things I am trying out.  I just thought if there was an equivalent to the global commands, then it might work out much in the same way between the two boards.
Logged

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

I believe I'm getting better results along these lines:
 
FanSpeed2 = 0;
    interrupts();
    // sei(); //Enables interrupts
    delay (1000); //Wait 1 second
 
    Calc2 = ((FanSpeed2 * 60)/2);
    noInterrupts();
   //cli(); //Disable interrupts

the resultant rpm seems more realistic...and two fans are much more similar in output.

thanks
   
Logged

Pages: [1]   Go Up
Jump to: