Go Down

Topic: Global Interrupt Enable and disable sei() and cli() - Due equivalents? (Read 1 time) previous topic - next topic

Rick5

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.



Rick5

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

thanks.

anyone else?

iyahdub

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..
10 LET Loop=Infinite
20 GO TO 10

stimmer

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.

Rick5

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.

Rick5

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
 

Go Up