Commit bf5ee947 authored by hu's avatar hu

替换电机库

parent 51532c14
...@@ -1248,20 +1248,6 @@ ...@@ -1248,20 +1248,6 @@
<FILEKIND>Text</FILEKIND> <FILEKIND>Text</FILEKIND>
<FILEFLAGS></FILEFLAGS> <FILEFLAGS></FILEFLAGS>
</FILE> </FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>bsp_Motor.h</PATH>
<PATHFORMAT>Windows</PATHFORMAT>
<FILEKIND>Text</FILEKIND>
<FILEFLAGS></FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>bsp_Motor.c</PATH>
<PATHFORMAT>Windows</PATHFORMAT>
<FILEKIND>Text</FILEKIND>
<FILEFLAGS>Debug</FILEFLAGS>
</FILE>
<FILE> <FILE>
<PATHTYPE>Name</PATHTYPE> <PATHTYPE>Name</PATHTYPE>
<PATH>api_Motor.c</PATH> <PATH>api_Motor.c</PATH>
...@@ -1871,6 +1857,55 @@ ...@@ -1871,6 +1857,55 @@
<FILEKIND>Text</FILEKIND> <FILEKIND>Text</FILEKIND>
<FILEFLAGS></FILEFLAGS> <FILEFLAGS></FILEFLAGS>
</FILE> </FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>Motor.h</PATH>
<PATHFORMAT>Windows</PATHFORMAT>
<FILEKIND>Text</FILEKIND>
<FILEFLAGS></FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>Motor_includes.h</PATH>
<PATHFORMAT>Windows</PATHFORMAT>
<FILEKIND>Text</FILEKIND>
<FILEFLAGS></FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>Motor_interface.c</PATH>
<PATHFORMAT>Windows</PATHFORMAT>
<FILEKIND>Text</FILEKIND>
<FILEFLAGS>Debug</FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>Motor_interface.h</PATH>
<PATHFORMAT>Windows</PATHFORMAT>
<FILEKIND>Text</FILEKIND>
<FILEFLAGS></FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>XHY_TY_Motor_2021_04_07_V1.11_Release.lib</PATH>
<PATHFORMAT>Windows</PATHFORMAT>
<FILEKIND>Unknown</FILEKIND>
<FILEFLAGS>Debug</FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>bsp_Motor.h</PATH>
<PATHFORMAT>Windows</PATHFORMAT>
<FILEKIND>Text</FILEKIND>
<FILEFLAGS></FILEFLAGS>
</FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
<PATH>bsp_Motor.c</PATH>
<PATHFORMAT>Windows</PATHFORMAT>
<FILEKIND>Text</FILEKIND>
<FILEFLAGS>Debug</FILEFLAGS>
</FILE>
</FILELIST> </FILELIST>
<LINKORDER> <LINKORDER>
<FILEREF> <FILEREF>
...@@ -2063,16 +2098,6 @@ ...@@ -2063,16 +2098,6 @@
<PATH>gui_Txt.h</PATH> <PATH>gui_Txt.h</PATH>
<PATHFORMAT>Windows</PATHFORMAT> <PATHFORMAT>Windows</PATHFORMAT>
</FILEREF> </FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>bsp_Motor.h</PATH>
<PATHFORMAT>Windows</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>bsp_Motor.c</PATH>
<PATHFORMAT>Windows</PATHFORMAT>
</FILEREF>
<FILEREF> <FILEREF>
<PATHTYPE>Name</PATHTYPE> <PATHTYPE>Name</PATHTYPE>
<PATH>api_Motor.c</PATH> <PATH>api_Motor.c</PATH>
...@@ -2508,6 +2533,41 @@ ...@@ -2508,6 +2533,41 @@
<PATH>CYJ_MV18.map</PATH> <PATH>CYJ_MV18.map</PATH>
<PATHFORMAT>Windows</PATHFORMAT> <PATHFORMAT>Windows</PATHFORMAT>
</FILEREF> </FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>Motor.h</PATH>
<PATHFORMAT>Windows</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>Motor_includes.h</PATH>
<PATHFORMAT>Windows</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>Motor_interface.c</PATH>
<PATHFORMAT>Windows</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>Motor_interface.h</PATH>
<PATHFORMAT>Windows</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>XHY_TY_Motor_2021_04_07_V1.11_Release.lib</PATH>
<PATHFORMAT>Windows</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>bsp_Motor.h</PATH>
<PATHFORMAT>Windows</PATHFORMAT>
</FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
<PATH>bsp_Motor.c</PATH>
<PATHFORMAT>Windows</PATHFORMAT>
</FILEREF>
</LINKORDER> </LINKORDER>
</TARGET> </TARGET>
</TARGETLIST> </TARGETLIST>
...@@ -2518,6 +2578,50 @@ ...@@ -2518,6 +2578,50 @@
<GROUPLIST> <GROUPLIST>
<GROUP><NAME>Includes</NAME> <GROUP><NAME>Includes</NAME>
<GROUP><NAME>motor</NAME>
<FILEREF>
<TARGETNAME>Standard</TARGETNAME>
<PATHTYPE>Name</PATHTYPE>
<PATH>bsp_Motor.c</PATH>
<PATHFORMAT>Windows</PATHFORMAT>
</FILEREF>
<FILEREF>
<TARGETNAME>Standard</TARGETNAME>
<PATHTYPE>Name</PATHTYPE>
<PATH>bsp_Motor.h</PATH>
<PATHFORMAT>Windows</PATHFORMAT>
</FILEREF>
<FILEREF>
<TARGETNAME>Standard</TARGETNAME>
<PATHTYPE>Name</PATHTYPE>
<PATH>Motor.h</PATH>
<PATHFORMAT>Windows</PATHFORMAT>
</FILEREF>
<FILEREF>
<TARGETNAME>Standard</TARGETNAME>
<PATHTYPE>Name</PATHTYPE>
<PATH>Motor_includes.h</PATH>
<PATHFORMAT>Windows</PATHFORMAT>
</FILEREF>
<FILEREF>
<TARGETNAME>Standard</TARGETNAME>
<PATHTYPE>Name</PATHTYPE>
<PATH>Motor_interface.c</PATH>
<PATHFORMAT>Windows</PATHFORMAT>
</FILEREF>
<FILEREF>
<TARGETNAME>Standard</TARGETNAME>
<PATHTYPE>Name</PATHTYPE>
<PATH>Motor_interface.h</PATH>
<PATHFORMAT>Windows</PATHFORMAT>
</FILEREF>
<FILEREF>
<TARGETNAME>Standard</TARGETNAME>
<PATHTYPE>Name</PATHTYPE>
<PATH>XHY_TY_Motor_2021_04_07_V1.11_Release.lib</PATH>
<PATHFORMAT>Windows</PATHFORMAT>
</FILEREF>
</GROUP>
<GROUP><NAME>bsp_Headers</NAME> <GROUP><NAME>bsp_Headers</NAME>
<FILEREF> <FILEREF>
<TARGETNAME>Standard</TARGETNAME> <TARGETNAME>Standard</TARGETNAME>
...@@ -2549,12 +2653,6 @@ ...@@ -2549,12 +2653,6 @@
<PATH>bsp_IIC.h</PATH> <PATH>bsp_IIC.h</PATH>
<PATHFORMAT>Windows</PATHFORMAT> <PATHFORMAT>Windows</PATHFORMAT>
</FILEREF> </FILEREF>
<FILEREF>
<TARGETNAME>Standard</TARGETNAME>
<PATHTYPE>Name</PATHTYPE>
<PATH>bsp_Motor.h</PATH>
<PATHFORMAT>Windows</PATHFORMAT>
</FILEREF>
<FILEREF> <FILEREF>
<TARGETNAME>Standard</TARGETNAME> <TARGETNAME>Standard</TARGETNAME>
<PATHTYPE>Name</PATHTYPE> <PATHTYPE>Name</PATHTYPE>
...@@ -2599,12 +2697,6 @@ ...@@ -2599,12 +2697,6 @@
<PATH>bsp_ADC.c</PATH> <PATH>bsp_ADC.c</PATH>
<PATHFORMAT>Windows</PATHFORMAT> <PATHFORMAT>Windows</PATHFORMAT>
</FILEREF> </FILEREF>
<FILEREF>
<TARGETNAME>Standard</TARGETNAME>
<PATHTYPE>Name</PATHTYPE>
<PATH>bsp_Motor.c</PATH>
<PATHFORMAT>Windows</PATHFORMAT>
</FILEREF>
<FILEREF> <FILEREF>
<TARGETNAME>Standard</TARGETNAME> <TARGETNAME>Standard</TARGETNAME>
<PATHTYPE>Name</PATHTYPE> <PATHTYPE>Name</PATHTYPE>
......
OPEN source 0 0 60 100 OPEN source 0 0 60 100
Source < attributes TOOLTIP on,TOOLTIP_FORMAT signed,TOOLTIP_MODE details,FREEZE off,MARKS off Source < attributes TOOLTIP on,TOOLTIP_FORMAT signed,TOOLTIP_MODE details,FREEZE off,MARKS off
OPEN assembly 60 0 40 31 OPEN assembly 60 0 40 31
Assembly < attributes ADR on,CODE off,ABSADR on,SYMB off,FORMAT Auto,FREEZE off,TOPPC 0xF48000 Assembly < attributes ADR on,CODE off,ABSADR on,SYMB off,FORMAT Auto,FREEZE off,TOPPC 0xF2ADC0
OPEN procedure 0 39 60 17 OPEN procedure 0 39 60 17
Procedure < attributes VALUES on,TYPES off Procedure < attributes VALUES on,TYPES off
OPEN register 60 31 40 25 OPEN register 60 31 40 25
......
/*
* MOTOR.h
*
* Created on: Apr 21, 2019
* Author: qitiancun
*/
#ifndef _MOTOR_H_
#define _MOTOR_H_
typedef unsigned char uint8_t;
typedef unsigned int uint16_t;
typedef unsigned long uint32_t;
typedef struct
{
uint16_t curPosition;
uint16_t destPosition;
}MeterPostion_t;
typedef enum
{
direction_1 = 0,
direction_2,
}MoveDirection_t;
typedef enum
{
Motor_1 = 0,
Motor_2,
Motor_3,
Motor_4,
}MotorIndex_t;
typedef enum
{
Normal = 0,
SelfCheck,
MinReset,
MaxReset,
MaxPostion,
MaxPostionKeep,
MinPostion
}workMode_t;
typedef enum
{
UnConfig = 0,
IO_PA,
IO_PB,
IO_AD0,
IO_AD1,
IO_H,
IO_M,
IO_S,
IO_T,
IO_P,
IO_R,
IO_V,
IO_U
}IO_Name_t;
extern volatile MeterPostion_t MeterPostion[4];
extern uint8_t* bsp_MotorGetVersion(void); /* 获取版本号 */
extern void bsp_MotorMove_50us_main(void); /* 必须在 VectorNumber_Vmctimovf 中断中调用,初始化电机默认使能中断 */
extern uint8_t bsp_set_meterCfg(uint8_t motorIndex,MoveDirection_t motorDir,uint16_t MaxAngle,uint16_t One_Step_Damp);
/*
One_Step_Damp 逼近速度 数越大越慢
*/
extern void bsp_SetMotorMode(uint8_t index,workMode_t Mode); /* 设置电机工作模式 */
extern workMode_t bsp_GetMotorState(uint8_t index); /* 获取电机工作模式 */
extern void bsp_SetOneStepDamp(MotorIndex_t motorIndex,uint32_t One_Step_Damp); /* 设置每一步阻尼时间 */
extern void MotorDriveOff(void);
extern void Gpio_Loading(void);
extern uint8_t SetDetectZeroPoint_IO(IO_Name_t name,MotorIndex_t Index,uint8_t port_offset);
extern void bsp_SetMaxSpeed(MotorIndex_t Index,uint32_t speed);/*最快速度 数值越大越慢 */
#endif /* _MOTOR_H_ */
#include "Motor.h"
#include "Motor_interface.h"
\ No newline at end of file
/*
*********************************************************************
* Includes
*********************************************************************
*/
#include "Motor.h"
/*
*********************************************************************
* defines
*********************************************************************
*/
/*
*********************************************************************
* variable
*********************************************************************
*/
/*
*********************************************************************
* function
*********************************************************************
*/
/*-------------------------------------------------------------------------
* Function Name : bsp_MeterConfig
* Description : ñͷ
* Input : None
* Output : None
* Return : None
* onther :
--------------------------------------------------------------------------*/
void bsp_MeterConfig(void)
{
Gpio_Loading();
bsp_set_meterCfg(Motor_1, direction_2,2880,200); //ת
bsp_set_meterCfg(Motor_2, direction_2,2880,200); //
//bsp_set_meterCfg(Motor_3,direction_1,90*12,200);
//bsp_set_meterCfg(Motor_4,direction_1,240*12,200);
SetDetectZeroPoint_IO(IO_AD0, Motor_1, 3);
SetDetectZeroPoint_IO(IO_V, Motor_2, 0);
//SetDetectZeroPoint_IO(IO_R,Motor_3,4);
//SetDetectZeroPoint_IO(IO_T,Motor_4,3);
}
/*
* MOTOR.h
*
* Created on: Apr 21, 2019
* Author: qitiancun
*/
#include "Motor.h"
#ifndef MOTOR_INTERFACE_H_
#define MOTOR_INTERFACE_H_
extern void bsp_MeterConfig(void);
extern void bsp_motorTestMode(void);
#endif /* MOTOR_INTERFACE_H_ */
\ No newline at end of file
...@@ -9,66 +9,7 @@ ...@@ -9,66 +9,7 @@
#include "defines.h" #include "defines.h"
#include "g_includes.h" #include "g_includes.h"
/*-------------------------------------------------------------------------
* Function Name : bsp_Motor_init
* Description :
* Input : None
* Output : None
* Return : None
* onther :
--------------------------------------------------------------------------*/
void bsp_Motor_init(void)
{
INT16U *w1;
INT8U Nub;
MCCTL0_MCPRE = 0; //时钟为总线的8分频
MCCTL0_MCSWAI = Enable; //停止模式停止工作
MCCTL0_FAST = Disable; //11bit分辨率
MCCTL0_DITH = Disable; //PER-> P10-P0 0:包含P0
MCCTL0_MCTOIF = ClearFlag; //清零中断标志
MCCTL1_RECIRC = 1; //低续流
MCPER = 1454; //PWM周期
//
MCCC0_MCOM = 2; //双全H桥模式
MCCC0_MCAM = Enable; //左对齐
MCCC0_CD = Disable; //禁止延时
MCCC1_MCOM = 2; //全H桥模式
MCCC1_MCAM = Enable; //左对齐
MCCC1_CD = Disable; //禁止延时
//
MCCC2_MCOM = 2; //双全H桥模式
MCCC2_MCAM = Enable; //左对齐
MCCC2_CD = Disable; //禁止延时
MCCC3_MCOM = 2; //全H桥模式
MCCC3_MCAM = Enable; //左对齐
MCCC3_CD = Disable; //禁止延时
/*
MCCC4_MCOM = Disable;
MCCC4_MCAM = Disable;
MCCC4_CD = Disable;
MCCC5_MCOM = Disable;
MCCC5_MCAM = Disable;
MCCC5_CD = Disable;
MCCC6_MCOM = Disable;
MCCC6_MCAM = Disable;
MCCC6_CD = Disable;
MCCC7_MCOM = Disable;
MCCC7_MCAM = Disable;
MCCC7_CD = Disable;
*/
MCCTL1_MCTOIE = Enable; //使能中断
w1 = &MCDC0; //初始化MCOC 0-7
for(Nub = 0; Nub < 8 ; Nub++)
{
*(w1 + Nub) = 0;
}
}
#pragma CODE_SEG NON_BANKED #pragma CODE_SEG NON_BANKED
#pragma TRAP_PROC #pragma TRAP_PROC
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
...@@ -81,6 +22,9 @@ void bsp_Motor_init(void) ...@@ -81,6 +22,9 @@ void bsp_Motor_init(void)
--------------------------------------------------------------------------*/ --------------------------------------------------------------------------*/
interrupt void Api_Motor_isr(void) interrupt void Api_Motor_isr(void)
{ {
bsp_MotorMove_50us_main();
/*
switch(m_motor_sel) switch(m_motor_sel)
{ {
case 0: case 0:
...@@ -110,6 +54,7 @@ interrupt void Api_Motor_isr(void) ...@@ -110,6 +54,7 @@ interrupt void Api_Motor_isr(void)
default: default:
; ;
} }
*/
if(g_curkeyinput == KeyON) if(g_curkeyinput == KeyON)
{ {
EcuTime ++; EcuTime ++;
......
...@@ -23,8 +23,6 @@ ...@@ -23,8 +23,6 @@
EXTERN_BSP_MOTOR volatile INT8U m_motor_sel; EXTERN_BSP_MOTOR volatile INT8U m_motor_sel;
EXTERN_BSP_MOTOR volatile INT8U m_lcdUpTime; EXTERN_BSP_MOTOR volatile INT8U m_lcdUpTime;
EXTERN_BSP_MOTOR void bsp_Motor_init(void);
......
...@@ -896,23 +896,40 @@ void App_CalFre(_FreType *Veh) ...@@ -896,23 +896,40 @@ void App_CalFre(_FreType *Veh)
--------------------------------------------------------------------------*/ --------------------------------------------------------------------------*/
void App_CalBorad(void) void App_CalBorad(void)
{ {
workMode_t MotorState[4] = {0,0,0,0};
//-- 自检 --// //-- 自检 --//
if (CheckStep == 0) if (CheckStep == 0)
{ {
/*
g_sysFlag.Bits.TempMeterInit = Disable; g_sysFlag.Bits.TempMeterInit = Disable;
g_vehMeter.DestPosition = 2400; g_vehMeter.DestPosition = 2400;
g_revMeter.DestPosition = 2445; g_revMeter.DestPosition = 2445;
g_tempMeter.DestPosition = 200; g_tempMeter.DestPosition = 200;
if ((g_vehMeter.CurPosition >= 2400) && if ((g_vehMeter.CurPosition >= 2400) && (g_revMeter.CurPosition >= 2445))
(g_revMeter.CurPosition >= 2445) && (g_tempMeter.CurPosition > 195))
CheckStep = 1; CheckStep = 1;
*/
bsp_SetMotorMode(Motor_1,SelfCheck);
bsp_SetMotorMode(Motor_2,SelfCheck);
CheckStep = 1;
} }
else if (CheckStep == 1) else if (CheckStep == 1)
{ {
/*
g_vehMeter.DestPosition = 0; g_vehMeter.DestPosition = 0;
g_revMeter.DestPosition = 0; g_revMeter.DestPosition = 0;
g_tempMeter.DestPosition = 0; g_tempMeter.DestPosition = 0;
if ((g_vehMeter.CurPosition == 0) && (g_revMeter.CurPosition == 0) && (g_tempMeter.DestPosition == 0)) if ((g_vehMeter.CurPosition == 0) && (g_revMeter.CurPosition == 0))
{
CheckStep = 2;
g_sysFlag.Bits.TempMeterInit = Enable;
g_Init.InitTempTime = 0;
}
*/
MotorState[0] = bsp_GetMotorState(Motor_1);
MotorState[1] = bsp_GetMotorState(Motor_2);
if ((MotorState[0] == Normal) && (MotorState[1] == Normal))
{ {
CheckStep = 2; CheckStep = 2;
g_sysFlag.Bits.TempMeterInit = Enable; g_sysFlag.Bits.TempMeterInit = Enable;
...@@ -990,7 +1007,7 @@ void App_CalVehBoard(void) ...@@ -990,7 +1007,7 @@ void App_CalVehBoard(void)
{ {
g_vehMeter.BoardVal = g_vehMeter.CurBoardVal; g_vehMeter.BoardVal = g_vehMeter.CurBoardVal;
} }
g_vehMeter.DestPosition = App_CalMicroStep((INT32U)g_vehMeter.BoardVal, (_EE_MeterInfo *)&g_vehMeterInfo); MeterPostion[Motor_2].destPosition = App_CalMicroStep((INT32U)g_vehMeter.BoardVal, (_EE_MeterInfo *)&g_vehMeterInfo);
} }
//-- Ecu-out --// //-- Ecu-out --//
...@@ -1120,7 +1137,7 @@ void App_CalRevBoard(void) ...@@ -1120,7 +1137,7 @@ void App_CalRevBoard(void)
} }
else else
{ {
g_revMeter.DestPosition = App_CalMicroStep((INT32U)g_revMeter.CurBoardVal, (_EE_MeterInfo *)&g_revMeterInfo); MeterPostion[Motor_1].destPosition = App_CalMicroStep((INT32U)g_revMeter.CurBoardVal, (_EE_MeterInfo *)&g_revMeterInfo);
} }
} }
/*-------------------------------------------------------------------------- /*--------------------------------------------------------------------------
......
...@@ -55,8 +55,10 @@ ...@@ -55,8 +55,10 @@
//--Bsp--// //--Bsp--//
#include "../Bzzer/gui_Bzzer.h" #include "../Bzzer/gui_Bzzer.h"
#include "../MOTOR/Motor_includes.h"
#include "../MOTOR/api_Motor.h" #include "../MOTOR/api_Motor.h"
#include "../MOTOR/bsp_Motor.h" #include "../MOTOR/bsp_Motor.h"
#include "../USER/preprocess.h" #include "../USER/preprocess.h"
#include "../TFT/app_DataProcess.h" #include "../TFT/app_DataProcess.h"
#include "../EEPROM/api_EEPROM.h" #include "../EEPROM/api_EEPROM.h"
......
...@@ -20,6 +20,32 @@ ...@@ -20,6 +20,32 @@
--------------------------------------------------------------------------*/ --------------------------------------------------------------------------*/
void Gui_MotorFirstReset(void) void Gui_MotorFirstReset(void)
{ {
workMode_t MotorState[4] = {0,0,0,0};
bsp_SetMotorMode(Motor_1,MaxReset);
bsp_SetMotorMode(Motor_2,MaxReset);
MotorState[0] = bsp_GetMotorState(Motor_1);
MotorState[1] = bsp_GetMotorState(Motor_2);
while ((MotorState[0] != Normal) || (MotorState[1] != Normal))
{
bsp_WDOG_Feed();
Api_GetAdcResult();
g_curLightFlag=1;
Gui_KL30LedDisplay();
if((g_adcResult.AdcValue > V_16v)&&(g_30LOGOFlag==0))
{
g_30LOGOFlag=1;
Gui_Logo_Disp();
}
Gui_LightProc();
MotorState[0] = bsp_GetMotorState(Motor_1);
MotorState[1] = bsp_GetMotorState(Motor_2);
}
/*
Enable_signal(g_vehMeter.MotorFirstReset); Enable_signal(g_vehMeter.MotorFirstReset);
Enable_signal(g_revMeter.MotorFirstReset); Enable_signal(g_revMeter.MotorFirstReset);
...@@ -82,7 +108,7 @@ void Gui_MotorFirstReset(void) ...@@ -82,7 +108,7 @@ void Gui_MotorFirstReset(void)
Disable_signal(g_revMeter.DestPosition); Disable_signal(g_revMeter.DestPosition);
Disable_signal(g_vehMeter.CurPosition); Disable_signal(g_vehMeter.CurPosition);
Disable_signal(g_revMeter.CurPosition); Disable_signal(g_revMeter.CurPosition);
*/
} }
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* Function Name : Gui_MotorStarReset * Function Name : Gui_MotorStarReset
...@@ -94,6 +120,28 @@ void Gui_MotorFirstReset(void) ...@@ -94,6 +120,28 @@ void Gui_MotorFirstReset(void)
--------------------------------------------------------------------------*/ --------------------------------------------------------------------------*/
void Gui_MotorStarReset(void) void Gui_MotorStarReset(void)
{ {
workMode_t MotorState[4] ={0,0,0,0};
bsp_SetMotorMode(Motor_1,MinReset);
bsp_SetMotorMode(Motor_2,MinReset);
MotorState[0] = bsp_GetMotorState(Motor_1);
MotorState[1] = bsp_GetMotorState(Motor_2);
while ((MotorState[0] != Normal) || (MotorState[1] != Normal))
{
bsp_WDOG_Feed();
g_LED.CheckLightsTime = 0;
g_curLightFlag=1;
Gui_Logo_Disp();
Gui_LightProc();
Api_GetAdcResult();
Gui_KL30LedDisplay();
MotorState[0] = bsp_GetMotorState(Motor_1);
MotorState[1] = bsp_GetMotorState(Motor_2);
}
/*
g_vehMeter.MotorReset = Enable; g_vehMeter.MotorReset = Enable;
g_revMeter.MotorReset = Enable; g_revMeter.MotorReset = Enable;
...@@ -135,6 +183,7 @@ void Gui_MotorStarReset(void) ...@@ -135,6 +183,7 @@ void Gui_MotorStarReset(void)
Disable_signal(g_revMeter.DestPosition); Disable_signal(g_revMeter.DestPosition);
Disable_signal(g_vehMeter.CurPosition); Disable_signal(g_vehMeter.CurPosition);
Disable_signal(g_revMeter.CurPosition); Disable_signal(g_revMeter.CurPosition);
*/
} }
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* Function Name : GUI_MotorOffReset * Function Name : GUI_MotorOffReset
...@@ -146,6 +195,14 @@ void Gui_MotorStarReset(void) ...@@ -146,6 +195,14 @@ void Gui_MotorStarReset(void)
--------------------------------------------------------------------------*/ --------------------------------------------------------------------------*/
void Gui_MotorOffReset(void) void Gui_MotorOffReset(void)
{ {
while ((MeterPostion[Motor_1].curPosition != 0) || (MeterPostion[Motor_2].curPosition != 0))
{
bsp_WDOG_Feed();
MeterPostion[Motor_1].destPosition = 0;
MeterPostion[Motor_2].destPosition = 0;
}
/*
Api_SetMotorTimer(T_4s, (_Clock *)&g_Clock); Api_SetMotorTimer(T_4s, (_Clock *)&g_Clock);
g_vehMeter.DestPosition = null; g_vehMeter.DestPosition = null;
...@@ -186,6 +243,7 @@ void Gui_MotorOffReset(void) ...@@ -186,6 +243,7 @@ void Gui_MotorOffReset(void)
Disable_signal(g_vehMeter.CurPosition); Disable_signal(g_vehMeter.CurPosition);
Disable_signal(g_revMeter.CurPosition); Disable_signal(g_revMeter.CurPosition);
*/
} }
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* Function Name : Gui_Logo_Disp * Function Name : Gui_Logo_Disp
......
...@@ -21,11 +21,11 @@ ...@@ -21,11 +21,11 @@
void Api_PWM_Init(void) void Api_PWM_Init(void)
{ {
PWME = 0; PWME = 0;
PWMCLK = (Channel_0|Channel_4); //通道 1 2 时钟选择 PWMCLK = (Channel_0|Channel_1); //通道 1 2 时钟选择
PWMPOL = (Channel_0|Channel_4); PWMPOL = (Channel_0|Channel_1);
// 32M // 32M
PWMPRCLK = 0x66; //时钟 = busclk / 8 = CLODK A/B PWMPRCLK = 0x66; //时钟 = busclk / 8 = CLODK A/B
PWMCAE = ~(Channel_0|Channel_4); //通道 左对称 PWMCAE = ~(Channel_0|Channel_1); //通道 左对称
PWMCTL = 4; PWMCTL = 4;
PWMDTY0 = null; PWMDTY0 = null;
......
...@@ -72,7 +72,7 @@ void bsp_Sys_Init(void) ...@@ -72,7 +72,7 @@ void bsp_Sys_Init(void)
bsp_Clk_Init(); bsp_Clk_Init();
EnableInterrupts; EnableInterrupts;
bsp_GPIO_Init(); bsp_GPIO_Init();
bsp_Motor_init(); bsp_MeterConfig();
bsp_ADC_Init(); bsp_ADC_Init();
Api_PWM_Init(); Api_PWM_Init();
bsp_CAN_Init(); bsp_CAN_Init();
...@@ -91,7 +91,7 @@ void bsp_Sys_ON(void) ...@@ -91,7 +91,7 @@ void bsp_Sys_ON(void)
{ {
bsp_Clk_Init(); bsp_Clk_Init();
bsp_GPIO_Init(); bsp_GPIO_Init();
bsp_Motor_init(); bsp_MeterConfig();
bsp_TIMER0_Init(TPM_DIV1); bsp_TIMER0_Init(TPM_DIV1);
bsp_TIMER1_Init(TPM_DIV1); bsp_TIMER1_Init(TPM_DIV1);
} }
...@@ -106,7 +106,7 @@ void bsp_Sys_ON(void) ...@@ -106,7 +106,7 @@ void bsp_Sys_ON(void)
void bsp_Sys_OFF(void) void bsp_Sys_OFF(void)
{ {
MCCTL1_MCTOIE = Disable; MCCTL1_MCTOIE = Disable;
/*
MCCC0_MCOM = 0; MCCC0_MCOM = 0;
MCCC0_MCAM = 0; MCCC0_MCAM = 0;
MCCC0_CD = 0; MCCC0_CD = 0;
...@@ -146,7 +146,8 @@ void bsp_Sys_OFF(void) ...@@ -146,7 +146,8 @@ void bsp_Sys_OFF(void)
PTU_PTU5 = LOW; PTU_PTU5 = LOW;
PTU_PTU6 = LOW; PTU_PTU6 = LOW;
PTU_PTU7 = LOW; PTU_PTU7 = LOW;
*/
MotorDriveOff();
PER1AD = 0x00; PER1AD = 0x00;
......
...@@ -69,7 +69,7 @@ ISRDISABLEDSTEP=1 ...@@ -69,7 +69,7 @@ ISRDISABLEDSTEP=1
[TBDML] [TBDML]
COMSETTINGS=SETCOMM DRIVER NOPROTOCOL NOPERIODICAL COMSETTINGS=SETCOMM DRIVER NOPROTOCOL NOPERIODICAL
NV_PARAMETER_FILE=C:\Program Files (x86)\Freescale\CWS12v5.1\prog\FPP\mcu01C9.fpp NV_PARAMETER_FILE=
NV_SAVE_WSP=0 NV_SAVE_WSP=0
NV_AUTO_ID=1 NV_AUTO_ID=1
...@@ -176,19 +176,19 @@ SHOWDIALOG=0 ...@@ -176,19 +176,19 @@ SHOWDIALOG=0
IP= IP=
[Recent HI-WAVE FindProcedure Search] [Recent HI-WAVE FindProcedure Search]
Search0=Api_VehCap_isr Search0=Gui_MotorFirstReset
Search1=0xFFFF Search1=Gui_MotorStarReset
Search2=T20MS_Task Search2=Gui_LightProc
Search3=DB8379_Init Search3=App_CalBorad
Search4=main Search4=main
Search5=Gui_KL15LedDisplay Search5=Api_VehCap_isr
Search6=DB8379_WriteData Search6=0xFFFF
Search7=Gui_KL30LedDisplay Search7=T20MS_Task
Search8=bsp_CAN1_Rev_isr Search8=DB8379_Init
Search9=App_SendCanMsg Search9=Gui_KL15LedDisplay
Search10=bsp_CANSendFrame Search10=DB8379_WriteData
Search11=bsp_CAN0_Rev_isr Search11=Gui_KL30LedDisplay
Search12=Api_GetAdcResult Search12=bsp_CAN1_Rev_isr
Search13=App_CalAccKm Search13=App_SendCanMsg
Search14=Gui_LCD_Display Search14=bsp_CANSendFrame
Search15=Init2EData Search15=bsp_CAN0_Rev_isr
...@@ -547,10 +547,14 @@ void Gui_KL30LedDisplay(void) ...@@ -547,10 +547,14 @@ void Gui_KL30LedDisplay(void)
{ {
if ((g_CanSwith.PosLamp == 1u) || ((LINE_IN_POSITION == HIGH) && (g_LED.pPosLampTime >= T_0_1s))) if ((g_CanSwith.PosLamp == 1u) || ((LINE_IN_POSITION == HIGH) && (g_LED.pPosLampTime >= T_0_1s)))
{ {
g_CanSwith.LittleLamp = 1;
g_CanSwith.LittleLampNonAdj = 1;
LED_POSLAMP_G = LEDON; //on LED_POSLAMP_G = LEDON; //on
} }
else else
{ {
g_CanSwith.LittleLamp = 0;
g_CanSwith.LittleLampAdj = 1;
LED_POSLAMP_G = LEDOFF; //off LED_POSLAMP_G = LEDOFF; //off
} }
} }
......
...@@ -33,8 +33,8 @@ void Gui_LightProc(void) ...@@ -33,8 +33,8 @@ void Gui_LightProc(void)
} }
else else
{ {
Api_MeterLightCtl(0, 100);//Low-100% Api_MeterLightCtl(100, 100);//Low-100%
Api_LcdLightCtl(0, 100); //Low-100% Api_LcdLightCtl(100, 100); //Low-100%
} }
} }
else else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment