微波EDA网,见证研发工程师的成长!
首页 > 硬件设计 > 硬件工程师文库 > 使用ADSP-CM408F ADC控制器的电机控制反馈采样时序

使用ADSP-CM408F ADC控制器的电机控制反馈采样时序

时间:07-26 来源:未知 点击:

tupTRU(void){

  93. ADI_TRU_RESULT result;

  94. result = adi_tru_Open (TRU_DEV_NUM, &TruDevMemory[0], ADI_TRU_REQ_MEMORY, &hTru); /* Setup TRU for ADCC. Slave is ADCC0 trig 1 and master is PWM0 SYNC pulse*/

  95. result = adi_tru_TriggerRoute (hTru, TRGS_ADCC0_TRIG0, TRGM_PWM0_SYNC); /*TRU device, slave, master*/

  96. result = adi_tru_Enable (hTru, true); /*Enable TRU*/

  97. }

  /***********ADCC Timer Callbacks*****************/

  98. static void AdccTmr0Callback(void *pCBParam, uint32_t Event, void *pArg){

  99. switch(Event){

  100. case ADI_ADCC_EVENT_FRAME_PROCESSED:

  101. Es_adc= SampleBuffer0[ES_ADC];

  102. Ec_adc = SampleBuffer0[EC_ADC];

  103. Vdc_adc = SampleBuffer0[VDC_ADC];

  104. Ths_adc = SampleBuffer0[THS_ADC];

  /*Store all of the data sampled in appropriate global variables*/

  105. _adcc_SubmitBuffer(hADCCTimer0, SampleBuffer0, FRAME_INC0, FRAMES_IN_BUFFER); /*Return the buffer to the ADCC for use in the next events*/

  106. break;

  107. case ADI_ADCC_EVENT_BUFFER_PROCESSED:

  108. break;

  109. default:

  110. break;

  111. }

  112. static void AdccTmr1Callback(void *pCBParam, uint32_t Event, void *pArg){

  113. switch(Event){

  114. case ADI_ADCC_EVENT_FRAME_PROCESSED:

  115. Iv_adc = SampleBuffer1[IV_ADC];

  116. Iw_adc = SampleBuffer1[IW_ADC];

  117. MotorControl(); /*Run the current control algorithm*/

  118.

  119.

  120. break;

  121. case ADI_ADCC_EVENT_BUFFER_PROCESSED:

  122. adi_adcc_SubmitBuffer(hADCCTimer1, SampleBuffer1,

  FRAME_INC1, FRAMES_IN_BUFFER);

  123. break;

  124. default:

  125. break;

  126. }

  127. return;

  }

  P17

  /*************************************************

  Enhanced Precision Timing Code

  *************************************************/

  /*Setup TRU for ADCC enhanced timing precision. Slave is ADCC0 trig 1 and master is GP timer 7

  Added to SetpTRU() function in place of line 95 */

  128. result = adi_tru_TriggerRoute(hTru, TRGS_ADCC0_TRIG0, TRGM_TIMER0_TMR7); // TRU device, slave, master

  129. result = adi_tru_TriggerRoute(hTru, TRGS_TIMER0_TMR7, TRGM_PWM0_SYNC); // TRU device, slave, master

  /*Setup GP timer 7 timer used to advance frame by one CS. Add to SetupADC() function after line 91*/

  130. *pREG_TIMER0_STOP_CFG_SET = BITM_TIMER_STOP_CFG_TMR07;

  131. *pREG_TIMER0_RUN_CLR = BITM_TIMER_RUN_SET_TMR07; /*Disable Timer First*/

  132. *pREG_TIMER0_TMR7_CFG = ENUM_TIMER_TMR_CFG_PWMSING_MODE|ENUM_TIMER_TMR_CFG_IRQMODE1 |ENUM_TIMER_TMR_CFG_TRIGSTART | ENUM_TIMER_TMR_CFG_POS_EDGE|ENUM_TIMER_TMR_CFG_PADOUT_EN | ENUM_TIMER_TMR_CFG_EMU_CNT;

  133. *pREG_TIMER0_TMR7_DLY = (uint32_t)(fsysclk / F_SW - 0.00000045 * fsysclk); /* Delay must be Tsw minus one ADC chip-select. Chip select is 18 ACLKs*/

  134. *pREG_TIMER0_TMR7_WID = 16; /*Be careful here... DLY+WID must be smaller than one PWM period. In other words, WID must be smaller than one ADC chip select. If WID>CS, trigger pulse stretches into next PWM period. */

  135. *pREG_TIMER0_TRG_MSK &= ~(BITM_TIMER_TRG_MSK_TMR07);

  136. *pREG_TIMER0_TRG_IE |= BITM_TIMER_TRG_IE_TMR07; /*Enable TMR7*/

  示例实验结果

  "示例代码"部分提供的电流采样代码部分已在闭环永磁同步电机控制应用电路中进行了测试。应用电路采用通用交流线输入以及−6.8 A至+6.8 A的受控电机电流范围,并利用了电流传感器;该电流传感器参数图4中的电流调整数据。图20至图23还显示了应用电路的采样结果。

  图20显示了参考速度为1500 rpm且电机空载时测得的电机相位电流。电机电流水平极低,并且高度不连续。

图21显示采用正确同步采样方法的平均效应,由图中可见电机相位电流具有平滑的正弦平均波形,即便电流水平低于最大值的2%时亦是如此。图21和图22(即跟踪IQ参考

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top