Hi Renton,
下面是我的代码,你帮我看看。
void LLD_HETInit(void)
[
hetREG->DIR = 0x0000AACAU;
hetREG->DOUT = 0x00000000U;
hetREG->PDR = 0x00000000U;
hetREG->PULDIS = 0xFFFFFFFFU;
hetREG->PSL = 0x00000000U;
hetREG->HRSH = 0x00000000U;
memcpy((void *)hetRAM, (const void *)HETRAM_U32_Const, sizeof(HETRAM_U32_Const));
hetREG->PFR = 0x00000503U;
hetREG->PRY = 0x00000000U;
hetREG->GCR = 0x00010003U;
]
const hetINSTRUCTION_t HETRAM_U32_Const[] =
[
/*捕获的部分,无异议*/
[0x00001640U,0x000FFFFFU,0x00000000U],
[0x00002A20U,0x00002437U,0x00000000U],
[0x00003A20U,0x00003537U,0x00000000U],
[0x00004A20U,0x00004637U,0x00000000U],
[0x00005A20U,0x00005737U,0x00000000U],
/*这个不是用来控制电机的请忽略*/
[0x00006AE0U,0x0000649EU,0x00000000U],
[0x00007A40U,0x0000A006U,0x00000000U],
/*我所询问的就是这个PWCNT*/
[0x00008AE0U,0x0000859EU,0x00000000U],
/*这个是要在PWM低电平的1/2处做AD采样用的*/
[0x00009A40U,0x00009006U,0x00000000U],
/*设定周期的DJZ*/
[0x00000A40U,0x0000C006U,0x00000000U],
[0x0000B105U,0x0010649EU,16000],
[0x00007106U,0x0000A006U,64000],
[0x0000D107U,0x0010859EU,0x00000000U],
[0x0000E108U,0x00009006U,0x00000000U],
[0x00000109U,0x0000C006U,0x00000000U],//0x90AD0
];
程序开始时我会hetRAM->Instruction[14].Data = 0x90AD0;将设定周期的DJZ的data值更改
程序运行时我会 hetRAM->Instruction[12].Data = (U32)(0x90AD0 * LLD_MotorDutyCycle);
hetRAM->Instruction[13].Data = (U32)((hetRAM->Instruction[12].Data >> 1) + 0x48568);
更改占空度及相对应的PWM低电平1/2处
Hi Renton,
下面是我的代码,你帮我看看。
void LLD_HETInit(void)
[
hetREG->DIR = 0x0000AACAU;
hetREG->DOUT = 0x00000000U;
hetREG->PDR = 0x00000000U;
hetREG->PULDIS = 0xFFFFFFFFU;
hetREG->PSL = 0x00000000U;
hetREG->HRSH = 0x00000000U;
memcpy((void *)hetRAM, (const void *)HETRAM_U32_Const, sizeof(HETRAM_U32_Const));
hetREG->PFR = 0x00000503U;
hetREG->PRY = 0x00000000U;
hetREG->GCR = 0x00010003U;
]
const hetINSTRUCTION_t HETRAM_U32_Const[] =
[
/*捕获的部分,无异议*/
[0x00001640U,0x000FFFFFU,0x00000000U],
[0x00002A20U,0x00002437U,0x00000000U],
[0x00003A20U,0x00003537U,0x00000000U],
[0x00004A20U,0x00004637U,0x00000000U],
[0x00005A20U,0x00005737U,0x00000000U],
/*这个不是用来控制电机的请忽略*/
[0x00006AE0U,0x0000649EU,0x00000000U],
[0x00007A40U,0x0000A006U,0x00000000U],
/*我所询问的就是这个PWCNT*/
[0x00008AE0U,0x0000859EU,0x00000000U],
/*这个是要在PWM低电平的1/2处做AD采样用的*/
[0x00009A40U,0x00009006U,0x00000000U],
/*设定周期的DJZ*/
[0x00000A40U,0x0000C006U,0x00000000U],
[0x0000B105U,0x0010649EU,16000],
[0x00007106U,0x0000A006U,64000],
[0x0000D107U,0x0010859EU,0x00000000U],
[0x0000E108U,0x00009006U,0x00000000U],
[0x00000109U,0x0000C006U,0x00000000U],//0x90AD0
];
程序开始时我会hetRAM->Instruction[14].Data = 0x90AD0;将设定周期的DJZ的data值更改
程序运行时我会 hetRAM->Instruction[12].Data = (U32)(0x90AD0 * LLD_MotorDutyCycle);
hetRAM->Instruction[13].Data = (U32)((hetRAM->Instruction[12].Data >> 1) + 0x48568);
更改占空度及相对应的PWM低电平1/2处
举报