
while(1)
{
  SWT=1;            // init input pin
  while(SWT);       // wait till it high
  sendATCommand();  // process
  while (!SWT);     // wait till switch has been deactivated
}