Esempio n. 1
0
File: PWM.c Progetto: DruculaC/DDC2
void myPwm()
{
	// choose channel for pwm
	PWM_Channel(E_CHANNEL0);         
   // pwm out enable
	Init_PWM();                        
}
Esempio n. 2
0
void Extruder_Start_Heating(uint16_t _target)
{
	DBG_MSG("Target=%d", _target);
	PID_Init(&pid, EXTRUDER_PID_KP, EXTRUDER_PID_KI, EXTRUDER_PID_KD, EXTRUDER_PID_INIT_SUM);
	PWM_Channel(Ex1Heat_Ch, 90, false);
	currentOutput = 0;
	bHeating = true;
	targetTemp = _target;
}
Esempio n. 3
0
void Extruder_SetOutput(int output)
{
	if(output > 100)
		output = 100;
	else if(output < 0)
		output = 0;

	PWM_Channel(Ex1Heat_Ch, output, true);
	currentOutput = output;
}
Esempio n. 4
0
/*
 * 初始化PWM模块,设定脉冲频率(Hz)
 */
void PWM_Init(int freq)
{
	uint16_t period, prescaler;

	Timer_16bit_Calc(freq, &period, &prescaler);

	TIMx_Config(TIM2, period, prescaler);
	currentPeriod = period;

	for(int i=1; i<=4; i++)
		PWM_Channel(i, 50, false);

	TIMx_Enable(TIM2);

	// TIM2_SetInterrupt();
}
Esempio n. 5
0
void Extruder_Stop_Heating()
{
	PWM_Channel(Ex1Heat_Ch, 10, false);
	currentOutput = 0;
	bHeating = false;
}
Esempio n. 6
0
File: pwm.c Progetto: DruculaC/DDC3
void myPwm()
	{
	PWM_Channel(E_CHANNEL0);           // Select PWM channel.
   Init_PWM();                        // Enable PWM function and set PWM period.  
	}