title: Problems with rs 232 DB9 pin toggling code
body: <p>In the code below</p>
  
  <pre><code>int ctr,fd,j1;
  fd =open("/dev/ttyS0", O_RDWR | O_NOCTTY);
      j1=ioctl(fd, TIOCMGET, &amp;ctr);
  if(ctr &amp; TIOCM_DTR)
          {
              ctr&amp;=~TIOCM_DTR;            
              j2=ioctl(fd,TIOCMSET,&amp;ctr);
          }
  else
          {   
              ctr=ctr|TIOCM_DTR;          
              j4=ioctl(fd,TIOCMSET,&amp;ctr);
          }
  </code></pre>
  
  <p>1) Can someone explain what ctr= ctr | TIOCM_DTR do? Does it just change the state of DTR pin? because ctr is just an intiger whereas TIOCM_DTR is a bit, right?</p>
  
  <p>2) I have configured the DTR pin to toggle, but while testing even the RTS pin is also toggling.</p>
  
  <p>3) Now if I set a time period between toggling, the code works if the time period is between 1 ms to 50 ms, above 50 ms , the time period when viewed in a DSO is changing between 50 ms to 100 ms and some time even in micro second range.(This time period between toggling is generated through a different timer program, such that whenever the timer overflows, the toggling program is called)</p>