Hi,
if my codes run inside runMotor1Control routine, it's perfectly work e.g. set obj->flagEnableRunAndIdentify = false ...
void runMotor1Control(MOTOR_Handle handle)
{
MOTOR_Vars_t *obj = (MOTOR_Vars_t *)handle;
MOTOR_SetVars_t *objSets = (MOTOR_SetVars_t *)(obj->motorSetsHandle);
USER_Params *objUser = (USER_Params *)(obj->userParamsHandle);
.
.
.
if (objSets->command_MotorIdentify)
{
obj->flagEnableRunAndIdentify = false;
obj->flagRunIdentAndOnLine = false;
obj->speedRef_Hz = 0;
obj->flagEnableMotorIdentify = true;
objUser->motor_Rs_Ohm = 0.001f;
}
return;
}
but when I create subroutine to handle it, it's jump to Interrupt_illegalOperationHandler
void doCommandMotorIdentify(MOTOR_Handle handle)
{
MOTOR_Vars_t *obj = (MOTOR_Vars_t *)handle;
MOTOR_SetVars_t *objSets = (MOTOR_SetVars_t *)(obj->motorSetsHandle);
USER_Params *objUser = (USER_Params *)(obj->userParamsHandle);
doCommandMotorIdentify(handle);
return;
}
void doCommandMotorIdentify(MOTOR_Handle handle)
{
MOTOR_Vars_t *obj = (MOTOR_Vars_t *)handle;
MOTOR_SetVars_t *objSets = (MOTOR_SetVars_t *)(obj->motorSetsHandle);
USER_Params *objUser = (USER_Params *)(obj->userParamsHandle);
if (objSets->command_MotorIdentify)
{
obj->flagEnableRunAndIdentify = false;
obj->flagRunIdentAndOnLine = false;
obj->speedRef_Hz = 0;
obj->flagEnableMotorIdentify = true;
objUser->motor_Rs_Ohm = 0.001f;
}
return;
}
inside the doCommandMotorIdentify() routine, the statement
objUser->motor_Rs_Ohm = 0.001f was definitely caused fault :(
also this statement
if (objSets->command_MotorIdentify == true) will cause fault
but this statement worked
if (objSets->command_MotorIdentify)
can anyone help to explain what's caused this ?
Danny





