Other Parts Discussed in Thread: C2000WARE
Tool/software: Code Composer Studio
I am using eQEP Speed and Position measurement example imported from C2000 Ware. I have configured ePWM to produce 13kHZ signal and index of 25HZ so that motor of 1500rpm can be controlled (virtually). It is written in the description of example that it measures low speed with capture unit and high speed by counting QEP input pulses.
The variable 'SPEEDRPM_FR' stores high speed measurement but it is showing 1430 and then next instant it shows 23.
I want this variable to represent constant speed so thst I can use it in close loop speed control.
How I can do that? Please suggest.
void POSSPEED_Init(void) { #if (CPU_FRQ_150MHZ) EQep1Regs.QUPRD=1500000; // Unit Timer for 100Hz at 150 MHz SYSCLKOUT #endif #if (CPU_FRQ_100MHZ) EQep1Regs.QUPRD=1000000; // Unit Timer for 100Hz at 100 MHz SYSCLKOUT #endif EQep1Regs.QDECCTL.bit.QSRC=00; // QEP quadrature count mode EQep1Regs.QEPCTL.bit.FREE_SOFT=2; //UNIT TIMER STOPS IMMEDIATELY AS EMULATION SUSPENDED // // EQep1Regs.QEPCTL.bit.PCRM=00;// PCRM=00 mode - QPOSCNT reset on index event EQep1Regs.QEPCTL.bit.UTE=1; // Unit Timeout Enable EQep1Regs.QEPCTL.bit.QCLM=1; // Latch on unit time out EQep1Regs.QPOSMAX=0x800; EQep1Regs.QEPCTL.bit.QPEN=1; // QEP enable EQep1Regs.QCAPCTL.bit.UPPS=6; // 1/64 for unit position EQep1Regs.QCAPCTL.bit.CCPS=7; // 1/128 for CAP clock EQep1Regs.QCAPCTL.bit.CEN=1; // QEP Capture Enable }