Innovative Integration
 
Log inUsernamePassword
Log me on automatically each visit    
Register
Register
Log in to check your private messages
Log in to check your private messages
Input/Output delay with the Servo example

 
Post new topic   Reply to topic    II Support Forum Index -> Toro
View previous topic :: View next topic  
Author Message
damiencourousse



Joined: 23 Mar 2006
Posts: 13

PostPosted: Fri Jan 26, 2007 3:29 am    Post subject: Input/Output delay with the Servo example Reply with quote

Hello,

We experience a strange behavior of the Servo class, using an external clock for the synchronization of the D/A & A/D conversion triggering:

About 50% of the time, there is NO delay between Input and Output,
and 50% of the time, there is a delay of one CLK period between Input and Output (which should be the correct behavior).
This is illustrated in the file attached: Input triangular signal in black, output signal in red.

Each of these cases happen randomly as I launch the Servo application.

here is below the code of the main cpp file:

the interrupt handler:
Code:


/******************************************
          INT7 Handler
******************************************/

extern "C"
{
#pragma CODE_SECTION(".onchip");
  void interrupt II_EINT7_IntHandler()
  {   

    float float_buff[NUM_CHANNELS];   
    short short_buff[NUM_CHANNELS];
    volatile short * buff;
    volatile short * buff_ptr;


    register int i;
    register float i_temp; 
    static volatile float t=0;             
   
    myServoPtr->TransferIn_8pair(); /* adapter selon le nb de canaux engagés */

   
   myServoPtr->TransferOut_8pair(); /* adapter selon le nb de canaux engagés */
  }

}  // end extern "C"



and the main function:

Code:


                     
                       
/************************************************
            IImain()
*************************************************/                       
void IIMain()
{   

  HWI_disable();
   
  //  Create and configure timebase object
  BasicTmb Timebase;
  Timebase.Rate(SampleRate);
  //Timebase.ClockSource( csDds );
  Timebase.ClockSource( csExternal );
  Timebase.Stop();
  //
  //  Create Servo object
  TestServo  ServoIo(intEInt7);
  myServoPtr = &ServoIo;
  //
  //  Attach Timebase to servo
  ServoIo.AdcDev().Attach(Timebase);
   
  //
  //  Configure Servo
  //
  //  ...Enable all channels for input & output
  //int ServoChannels = HardwareInfo()->DacChannels();
  for (int ch=0; ch<NUM_CHANNELS; ch++)
    {
      ServoIo.ChannelEnabled(ch, true);
    }
  //
  //  ...Configure delay of DAC clock
  ServoIo.Delay(0);

  // Attente de la confirmation host pour lancer la boucle Servo
   
  ServoIo.Open();
  ServoIo.Start();     
  HWI_enable();
   
   
  // Attente du message d'arret de la part du host
  while ( !(*p_host_msg== TD_STOP))
    {
      *p_dsp_msg=DSP_WAIT_STOP;
//      MAJ_Params();
    }

  *p_host_msg = TD_NULL;
  *p_dsp_msg= DSP_ACK;

  // Arret de la boucle Bypass
  ServoIo.Close();      
   
}



[/code]
Back to top
View user's profile Send private message
jhenderson
Site Admin


Joined: 07 Mar 2006
Posts: 1177
Location: So. Cal. USA

PostPosted: Mon Jan 29, 2007 5:22 am    Post subject: Servo delay Reply with quote

It is theoretically impossible for the servo delay to be zero. So, I suspect that you are really seeing a 360 degree phase shift,

The most likely source of the problem lies in the triggering. The Matador cards can utilize an external clock, but should not commence data flow until the A/D and D/A are triggered. The EngineCtl class contains methods that you should be using to start the triggers for both the A/Ds and D/As simultaneously. If this is done properly, and the servo calculations can be performed in the allotted servo interval, you should eliminate the phase error.

_________________
Jim
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    II Support Forum Index -> Toro (GMT - 8 Hours)
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

© Copyright 2006-2008 Innovative Integration
Powered by phpBB © 2001, 2002 phpBB Group
Based on iCGstation v1.0 Template By Ray © 2003, 2004 iOptional