Nov 06, 2019
04:39 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Nov 06, 2019
04:39 AM
Hello everyone,
I am using tle987x evalboard with the example code that is names " BLDC_BC_BEMF_EXAMPLE_TLE987X". I want to run motor and after sometime i want to stop it later then i want to run it again
in a loop . My code is below. it runs the motor and afte some time it stops the motor. But the motor never runs again in the loop. What can be the problem?
static void Main_lStartMotor(void);
static void Main_lStopMotor(void);
uint32 Error;
/*******************************************************************************
** Globale Variable Definitions **
*******************************************************************************/
/*******************************************************************************
** Private Variable Definitions **
*******************************************************************************/
static uint8 bMotorRun;
static uint32 count;
uint32 Error;
/*******************************************************************************
** Private Constant Definitions **
*******************************************************************************/
/*******************************************************************************
** Global Function Definitions **
*******************************************************************************/
/** \brief Executes main test code.
*
* \param None
* \return None
*
*/
bool b;
int i=0;
int main(void)
{
/*****************************************************************************
** initialization of the hardware modules based on the configuration done **
** by using the IFXConfigWizard **
*****************************************************************************/
TLE_Init();
Emo_Init();
b=true;
count=0;
Emo_setspeedreferenz(2000);
for(;;){
/* Service watch-dog */
(void)WDT1_Service();
/* Start motor to run up to the desired speed */
count++;
if(b)
{
Error = Emo_StartMotor();
PORT_ChangePin(LED1, PORT_ACTION_SET);
}
if(count>345000 )
{
Error = Emo_StopMotor();
b=false;
if(count>(2*345000))
{
count=0;
b=true;
}
}
}
}
/* End of main() */
void Main_HandleSysTick(void)
{
} /* End of Main_HandleSysTick */
/*******************************************************************************
** Private Function Definitions **
*******************************************************************************/
static void Main_lStartMotor(void)
{
Error = EMO_ERROR_NONE;
if (Error == EMO_ERROR_NONE)
{
}
if (Error == EMO_ERROR_NONE)
{
}
else /* Error */
{
}
} /* End of Main_lStartMotor */
static void Main_lStopMotor(void)
{
Error = Emo_StopMotor();
if (Error != EMO_ERROR_NONE)
{
}
} /* End of Main_lStopMotor */
Kind Regards
Murat.
I am using tle987x evalboard with the example code that is names " BLDC_BC_BEMF_EXAMPLE_TLE987X". I want to run motor and after sometime i want to stop it later then i want to run it again
in a loop . My code is below. it runs the motor and afte some time it stops the motor. But the motor never runs again in the loop. What can be the problem?
static void Main_lStartMotor(void);
static void Main_lStopMotor(void);
uint32 Error;
/*******************************************************************************
** Globale Variable Definitions **
*******************************************************************************/
/*******************************************************************************
** Private Variable Definitions **
*******************************************************************************/
static uint8 bMotorRun;
static uint32 count;
uint32 Error;
/*******************************************************************************
** Private Constant Definitions **
*******************************************************************************/
/*******************************************************************************
** Global Function Definitions **
*******************************************************************************/
/** \brief Executes main test code.
*
* \param None
* \return None
*
*/
bool b;
int i=0;
int main(void)
{
/*****************************************************************************
** initialization of the hardware modules based on the configuration done **
** by using the IFXConfigWizard **
*****************************************************************************/
TLE_Init();
Emo_Init();
b=true;
count=0;
Emo_setspeedreferenz(2000);
for(;;){
/* Service watch-dog */
(void)WDT1_Service();
/* Start motor to run up to the desired speed */
count++;
if(b)
{
Error = Emo_StartMotor();
PORT_ChangePin(LED1, PORT_ACTION_SET);
}
if(count>345000 )
{
Error = Emo_StopMotor();
b=false;
if(count>(2*345000))
{
count=0;
b=true;
}
}
}
}
/* End of main() */
void Main_HandleSysTick(void)
{
} /* End of Main_HandleSysTick */
/*******************************************************************************
** Private Function Definitions **
*******************************************************************************/
static void Main_lStartMotor(void)
{
Error = EMO_ERROR_NONE;
if (Error == EMO_ERROR_NONE)
{
}
if (Error == EMO_ERROR_NONE)
{
}
else /* Error */
{
}
} /* End of Main_lStartMotor */
static void Main_lStopMotor(void)
{
Error = Emo_StopMotor();
if (Error != EMO_ERROR_NONE)
{
}
} /* End of Main_lStopMotor */
Kind Regards
Murat.
Labels
- Tags:
- IFX
2 Replies
Nov 07, 2019
12:40 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Nov 07, 2019
12:40 AM
Hi Murat,
we will try to take a deeper look into your software.
Best,
Fiz
we will try to take a deeper look into your software.
Best,
Fiz
Nov 26, 2019
11:29 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Nov 26, 2019
11:29 PM
Hi Murat,
i adapted your code so it is somewhat performing your desired task.
But to start and stop the motor i would use a build in timer. f.e. GPT12 timer5.
Best,
Fiz
/*******************************************************************************
** Private Function Declarations **
*******************************************************************************/
static void Main_lStartMotor(void);
static void Main_lStopMotor(void);
uint32 Error;
/************************************************** *****************************
** Globale Variable Definitions **
************************************************** *****************************/
/************************************************** *****************************
** Private Variable Definitions **
************************************************** *****************************/
static uint8 bMotorRun;
static uint32 count;
uint32 Error;
/************************************************** *****************************
** Private Constant Definitions **
************************************************** *****************************/
/************************************************** *****************************
** Global Function Definitions **
************************************************** *****************************/
/** \brief Executes main test code.
*
* \param None
* \return None
*
*/
bool b;
int i=0;
int main(void)
{
/************************************************** ***************************
** initialization of the hardware modules based on the configuration done **
** by using the IFXConfigWizard **
************************************************** ***************************/
TLE_Init();
Emo_Init();
b=true;
count=0;
Emo_setspeedreferenz(2000);
for(;;){
/* Service watch-dog */
(void)WDT1_Service();
/* Start motor to run up to the desired speed */
count++;
if(b)
{
Error = Emo_StartMotor();
PORT_ChangePin(1, PORT_ACTION_SET);
}
if((count>345000)&& (b==true))
{
Error = Emo_StopMotor();
b=false;
count = 0;
}
if((count>345000)&& (b==false))
{
Error = Emo_StartMotor();
count=0;
b=true;
}
}
}
/* End of main() */
void Main_HandleSysTick(void)
{
} /* End of Main_HandleSysTick */
/************************************************** *****************************
** Private Function Definitions **
************************************************** *****************************/
static void Main_lStartMotor(void)
{
Error = EMO_ERROR_NONE;
if (Error == EMO_ERROR_NONE)
{
}
if (Error == EMO_ERROR_NONE)
{
}
else /* Error */
{
}
} /* End of Main_lStartMotor */
static void Main_lStopMotor(void)
{
Error = Emo_StopMotor();
if (Error != EMO_ERROR_NONE)
{
}
} /* End of Main_lStopMotor */
i adapted your code so it is somewhat performing your desired task.
But to start and stop the motor i would use a build in timer. f.e. GPT12 timer5.
Best,
Fiz
/*******************************************************************************
** Private Function Declarations **
*******************************************************************************/
static void Main_lStartMotor(void);
static void Main_lStopMotor(void);
uint32 Error;
/************************************************** *****************************
** Globale Variable Definitions **
************************************************** *****************************/
/************************************************** *****************************
** Private Variable Definitions **
************************************************** *****************************/
static uint8 bMotorRun;
static uint32 count;
uint32 Error;
/************************************************** *****************************
** Private Constant Definitions **
************************************************** *****************************/
/************************************************** *****************************
** Global Function Definitions **
************************************************** *****************************/
/** \brief Executes main test code.
*
* \param None
* \return None
*
*/
bool b;
int i=0;
int main(void)
{
/************************************************** ***************************
** initialization of the hardware modules based on the configuration done **
** by using the IFXConfigWizard **
************************************************** ***************************/
TLE_Init();
Emo_Init();
b=true;
count=0;
Emo_setspeedreferenz(2000);
for(;;){
/* Service watch-dog */
(void)WDT1_Service();
/* Start motor to run up to the desired speed */
count++;
if(b)
{
Error = Emo_StartMotor();
PORT_ChangePin(1, PORT_ACTION_SET);
}
if((count>345000)&& (b==true))
{
Error = Emo_StopMotor();
b=false;
count = 0;
}
if((count>345000)&& (b==false))
{
Error = Emo_StartMotor();
count=0;
b=true;
}
}
}
/* End of main() */
void Main_HandleSysTick(void)
{
} /* End of Main_HandleSysTick */
/************************************************** *****************************
** Private Function Definitions **
************************************************** *****************************/
static void Main_lStartMotor(void)
{
Error = EMO_ERROR_NONE;
if (Error == EMO_ERROR_NONE)
{
}
if (Error == EMO_ERROR_NONE)
{
}
else /* Error */
{
}
} /* End of Main_lStartMotor */
static void Main_lStopMotor(void)
{
Error = Emo_StopMotor();
if (Error != EMO_ERROR_NONE)
{
}
} /* End of Main_lStopMotor */