Logo Search packages:      
Sourcecode: ktechlab version File versions  Download package

void ADC::initPins (  )  [protected, virtual]

Add / remove pins according to the number of outputs the user has requested

Implements ADDAC.

Definition at line 133 of file addac.cpp.

References Component::initDIP(), Component::initDIPSymbol(), CNItem::removeDisplayText(), Component::removeElement(), and CNItem::removeNode().

{
      int numBits = dataInt("numBits");
      
      if ( numBits < 2 )
            numBits = 2;
      else if ( numBits > max_ADDAC_bits )
            numBits = max_ADDAC_bits;
      
      if ( numBits == m_numBits )
            return;
      
      QStringList pins;
      
      int inPos = (numBits-1+(numBits%2))/2;
      for ( int i=0; i<inPos; ++i )
            pins += "";
      
      pins += "In";
      
      for ( int i=inPos+1; i<numBits; ++i )
            pins += "";
      
      for ( int i=numBits-1; i>=0; --i )
            pins += QString::number(i);
      
      initDIPSymbol( pins, 64 );
      initDIP(pins);
      
      if (!m_realNode)
            m_realNode =  ecNodeWithID("In");
      
      
      if ( numBits > m_numBits )
      {
            for ( int i=m_numBits; i<numBits; ++i )
            {
                  ECNode *node = ecNodeWithID( QString::number(i) );
                  m_logic[i] = createLogicOut( node, false );
            }
      }
      else
      {
            for ( int i=numBits; i<m_numBits; ++i )
            {
                  QString id = QString::number(i);
                  removeDisplayText(id);
                  removeElement( m_logic[i], false );
                  removeNode(id);
                  m_logic[i] = 0l;
            }
      }
      
      m_numBits = numBits;
}


Generated by  Doxygen 1.6.0   Back to index