Facing Issues with Gsm for using interrupts ( sei() & cei ()).

Hi all,
I am using Gsm to send data fetched from the Flow sensor.
But whenever I use the Sei() & cli() interrupts my modem does not sends messages.
Please help me.
I have to use the interrupt and want a delay of some 1-5 minutes or so.

But whenever I use the Sei() & cli() interrupts my modem does not sends messages.
Please help me.

"The sei() and cli() interrupts" is nonsense. Those functions enable or disable interrupts.

That using them causes the interrupt-driven software that is used to send messages means that you are using them incorrectly.

I have to use the interrupt and want a delay of some 1-5 minutes or so.

It is nearly certain that you do NOT need to enable and disable interrupts AT ALL.

Post your code.

Please find the code below:

#include <SoftwareSerial.h>
#include <String.h>
SoftwareSerial asj(7,8);
volatile unsigned long pulse;
const int sensor = 2;
unsigned long lastTime = 0;

void rpm(){
pulse++;
}
void setup()
{
pinMode(sensor,INPUT);
Serial.begin(19200);
attachInterrupt(0, rpm, RISING);
}
void loop()
{
pulse =0;
sei();
delay(1000);
cli();
if (millis()- lastTime >= 10000)
{
lastTime += 10000;
float calc = (pulse/7.5);
Serial.println("AT");
delay(1000);
Serial.println("AT+CMGF=1");
delay(1000);
Serial.println("AT+CMGS="+919465311530""); //CHANGE TO DESTINATION NUMBER (10 digit)
delay(1000);
Serial.print("Flow: ");
delay(1000);
Serial.print(calc,4);
delay(1000);
Serial.println(" ltrs/min");
delay(1000);
Serial.println("");
Serial.print((char)26);
Serial.println();
delay(500);
}
}

This is code I am supposed to run for sending an SMS....

If you cannot be bothered following forum etiquette and posting your code correctly then I cannot be bothered trying to figure out where the problem lies.

How to use this forum - please read. - Installation & Troubleshooting - Arduino Forum, section 7.

pulse =0;
 sei();
 delay(1000);
 cli();

That is, beyond a doubt, the stupidest possible way to count pulses.

You CLEARLY know how to use millis() and a variable to record when something was last done. Copy the pulse count, and reset it, periodically, using millis().

Delete all of that snippet.

Can you be more specific regarding what I need to delete in my code ?
Thanks. :confused:

Can you be more specific regarding what I need to delete in my code ?

More explicit than

Delete all of that snippet.

?

No, I can't.

Suppose you want to count cars passing by an intersection in some period of time. You can't just make them all stop until you are ready to count them. Instead, you start counting, while watching a clock. When a suitable time has passed, you scribble down a number and a time, and continue counting and watching the clock.

In the Arduino world, that means using millis() in place of the clock, and doing something like

if it is time:
   disable interrupts.
   copy count and time.
   reset count.
   enable interrupts.

The sei() and cli() functions are to enable and disable interrupts. Notice that in my scenario, interrupts are disable only for the duration of the copy of two values, while in your case, there may be a lot of code executed while interrupts are disabled. Specifically, you are trying to do Serial.print() and delay() with interrupts disabled. Both the function and the method need interrupts enabled for them to function properly (or at all).