ШИМ Тормоза
This commit is contained in:
parent
1e0ea8d2cc
commit
78332f4873
@ -142,7 +142,7 @@ void InitEPwm3Gpio(void)
|
|||||||
// Comment out other unwanted lines.
|
// Comment out other unwanted lines.
|
||||||
//
|
//
|
||||||
GpioCtrlRegs.GPAPUD.bit.GPIO4 = 1; // Disable pull-up on GPIO4 (EPWM3A)
|
GpioCtrlRegs.GPAPUD.bit.GPIO4 = 1; // Disable pull-up on GPIO4 (EPWM3A)
|
||||||
GpioCtrlRegs.GPAPUD.bit.GPIO5 = 1; // Disable pull-up on GPIO5 (EPWM3B)
|
// GpioCtrlRegs.GPAPUD.bit.GPIO5 = 1; // Disable pull-up on GPIO5 (EPWM3B)
|
||||||
// GpioCtrlRegs.GPEPUD.bit.GPIO149 = 1; // Disable pull-up on GPIO149 (EPWM3A)
|
// GpioCtrlRegs.GPEPUD.bit.GPIO149 = 1; // Disable pull-up on GPIO149 (EPWM3A)
|
||||||
// GpioCtrlRegs.GPEPUD.bit.GPIO150 = 1; // Disable pull-up on GPIO150 (EPWM3B)
|
// GpioCtrlRegs.GPEPUD.bit.GPIO150 = 1; // Disable pull-up on GPIO150 (EPWM3B)
|
||||||
|
|
||||||
@ -152,7 +152,7 @@ void InitEPwm3Gpio(void)
|
|||||||
// Comment out other unwanted lines.
|
// Comment out other unwanted lines.
|
||||||
//
|
//
|
||||||
GpioCtrlRegs.GPAMUX1.bit.GPIO4 = 1; // Configure GPIO4 as EPWM3A
|
GpioCtrlRegs.GPAMUX1.bit.GPIO4 = 1; // Configure GPIO4 as EPWM3A
|
||||||
GpioCtrlRegs.GPAMUX1.bit.GPIO5 = 1; // Configure GPIO5 as EPWM3B
|
// GpioCtrlRegs.GPAMUX1.bit.GPIO5 = 1; // Configure GPIO5 as EPWM3B
|
||||||
// GpioCtrlRegs.GPEMUX2.bit.GPIO149 = 1; // Configure GPIO149 as EPWM3A
|
// GpioCtrlRegs.GPEMUX2.bit.GPIO149 = 1; // Configure GPIO149 as EPWM3A
|
||||||
// GpioCtrlRegs.GPEMUX2.bit.GPIO150 = 1; // Configure GPIO150 as EPWM3B
|
// GpioCtrlRegs.GPEMUX2.bit.GPIO150 = 1; // Configure GPIO150 as EPWM3B
|
||||||
|
|
||||||
|
|||||||
27
Projects/epwm_test/src/ExternalEEPROM/Arr.c
Normal file
27
Projects/epwm_test/src/ExternalEEPROM/Arr.c
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
* Arr.c
|
||||||
|
*
|
||||||
|
* Created on: 21 íîÿá. 2023 ã.
|
||||||
|
* Author: seklyuts
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "f28x_project.h"
|
||||||
|
|
||||||
|
uint16_t quant16bitWords(uint16_t bytes)
|
||||||
|
{
|
||||||
|
if((bytes) & 1) return (bytes + 1)/2; //åñëè îñòàëîñü íå÷¸òíîå ÷èñëî áàéò, òî ÷òîáû ðàññ÷èòàòü êîë-âî 16-áèòíûõ ñëîâ íàäî +1
|
||||||
|
else return (bytes)/2;
|
||||||
|
}
|
||||||
|
|
||||||
|
void copy16_to_8(uint16_t *Arr16, uint16_t *Arr8, uint16_t N)
|
||||||
|
{
|
||||||
|
uint16_t j=0;
|
||||||
|
for(j = 0; j < N; j+=1) {Arr8[2*j] = 0xFF & Arr16[j]; Arr8[2*j+1] = (Arr16[j]>>8);}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void copy8_to_16(uint16_t *Arr8, uint16_t *Arr16, uint16_t N)
|
||||||
|
{
|
||||||
|
uint16_t j=0;
|
||||||
|
for(j = 0; j < N; j+=1) Arr16[j] = (0xFF & Arr8[2*j]) + (Arr8[2*j+1]<<8);
|
||||||
|
}
|
||||||
16
Projects/epwm_test/src/ExternalEEPROM/Arr.h
Normal file
16
Projects/epwm_test/src/ExternalEEPROM/Arr.h
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
/*
|
||||||
|
* Arr.h
|
||||||
|
*
|
||||||
|
* Created on: 21 íîÿá. 2023 ã.
|
||||||
|
* Author: seklyuts
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SRC_EXTERNALEEPROM_ARR_H_
|
||||||
|
#define SRC_EXTERNALEEPROM_ARR_H_
|
||||||
|
|
||||||
|
void copy16_to_8(uint16_t *Arr16, uint16_t *Arr8, uint16_t N);
|
||||||
|
void copy8_to_16(uint16_t *Arr8, uint16_t *Arr16, uint16_t N);
|
||||||
|
uint16_t quant16bitWords(uint16_t bytes);
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* SRC_EXTERNALEEPROM_ARR_H_ */
|
||||||
@ -70,7 +70,7 @@ void PWMAllInit(void)
|
|||||||
PWMInit(PWM_B, PwmMotor100, COMPLIMENTARY);//ØÈÌ
|
PWMInit(PWM_B, PwmMotor100, COMPLIMENTARY);//ØÈÌ
|
||||||
PWMInit(PWM_C, PwmMotor100, COMPLIMENTARY);//ØÈÌ
|
PWMInit(PWM_C, PwmMotor100, COMPLIMENTARY);//ØÈÌ
|
||||||
PWMInit(PWM_BRAKE, PwmBrake100, INDEPENDED);//Òîðìîç
|
PWMInit(PWM_BRAKE, PwmBrake100, INDEPENDED);//Òîðìîç
|
||||||
// PWMInit(6, PwmMotor100, COMPLIMENTARY);
|
PWMInit(3, PwmMotor100, COMPLIMENTARY);//âåíòèëÿòîð
|
||||||
|
|
||||||
//11 è 12 äëÿ SDFM
|
//11 è 12 äëÿ SDFM
|
||||||
PWMInit(11, PwmMotor100, INDEPENDED);
|
PWMInit(11, PwmMotor100, INDEPENDED);
|
||||||
@ -106,6 +106,7 @@ void PWMGpioInit(void)//
|
|||||||
InitEPwm5Gpio();
|
InitEPwm5Gpio();
|
||||||
InitEPwm7Gpio();
|
InitEPwm7Gpio();
|
||||||
InitEPwm8Gpio();
|
InitEPwm8Gpio();
|
||||||
|
InitEPwm3Gpio();
|
||||||
|
|
||||||
// InitEPwm11Gpio();
|
// InitEPwm11Gpio();
|
||||||
}
|
}
|
||||||
@ -189,9 +190,9 @@ void PWMInit(uint16_t Num, uint16_t Period, uint16_t Independed)
|
|||||||
//
|
//
|
||||||
if( (Num < 11)||(Num > 12) )
|
if( (Num < 11)||(Num > 12) )
|
||||||
{
|
{
|
||||||
EPwmRegs[Num]->AQCTLA.bit.CAU = AQ_SET; // Set PWM1A on Zero
|
EPwmRegs[Num]->AQCTLA.bit.CAU = AQ_SET; // Set PWMxA on Zero
|
||||||
EPwmRegs[Num]->AQCTLA.bit.CAD = AQ_CLEAR;
|
EPwmRegs[Num]->AQCTLA.bit.CAD = AQ_CLEAR;
|
||||||
EPwmRegs[Num]->AQCTLB.bit.CAU = AQ_CLEAR; // Set PWM1A on Zero
|
EPwmRegs[Num]->AQCTLB.bit.CAU = AQ_CLEAR; // Set PWMxA on Zero
|
||||||
EPwmRegs[Num]->AQCTLB.bit.CAD = AQ_SET;
|
EPwmRegs[Num]->AQCTLB.bit.CAD = AQ_SET;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
18
Projects/epwm_test/src/biss.c
Normal file
18
Projects/epwm_test/src/biss.c
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
/*
|
||||||
|
* biss.c
|
||||||
|
*
|
||||||
|
* Created on: 26 äåê. 2023 ã.
|
||||||
|
* Author: seklyuts
|
||||||
|
*/
|
||||||
|
#include "f28x_project.h"
|
||||||
|
|
||||||
|
|
||||||
|
void init_Biss(void)
|
||||||
|
{
|
||||||
|
EALLOW;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
EDIS;
|
||||||
|
}
|
||||||
17
Projects/epwm_test/src/biss.h
Normal file
17
Projects/epwm_test/src/biss.h
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
/*
|
||||||
|
* biss.h
|
||||||
|
*
|
||||||
|
* Created on: 26 äåê. 2023 ã.
|
||||||
|
* Author: seklyuts
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SRC_BISS_H_
|
||||||
|
#define SRC_BISS_H_
|
||||||
|
|
||||||
|
|
||||||
|
void init_Biss(void);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* SRC_BISS_H_ */
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user