hassan1980
Full Member level 4
pic sine wave generator
Did anyone before deal with such thing?
Did anyone before deal with such thing?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
////////////////////////////////////////////////////////////////////////
const unsigned int8 Duty0 [] = {7,15,23,31,38,46,53,61,68,75,82,88,95,101,107,113,118,123,128,133,137,141,144,147,150,153,155,156,158,159,159,160}; // 126 Vac@24Vdc
const unsigned int8 Duty1 [] = {7,15,23,30,38,45,52,60,67,74,80,87,93,99,105,111,116,121,126,130,134,138,142,145,148,150,152,154,155,156,157,157};
.......
const unsigned int8 Duty30 [] = {5,10,15,20,25,30,35,40,44,49,54,58,62,66,70,74,77,81,84,87,90,92,95,97,99,100,102,103,104,104,105,105}; // 117Vac@18Vdc
const unsigned int8 Duty31 [] = {5,10,15,20,25,30,35,39,44,49,53,57,61,65,69,73,77,80,83,86,89,91,94,96,97,99,100,102,102,103,103,104};
const unsigned int8 Duty32 [] = {5,10,15,20,24,29,34,39,43,48,52,57,61,65,69,72,76,79,82,85,88,90,92,95,96,98,99,100,101,102,102,102};
////////////////////////////////////////////////////////////////////////
void CarregaPWM ( void )
{
if ( direcao == CRESCENTE ) PWM_counter++ ;
else PWM_counter-- ;
switch ( PWM_counter )
{
case 0 : NivelMinimo() ; set_pwm1_duty ( 0 ) ; break ;
case 1 : set_pwm1_duty ( Duty[PWM_counter] ) ; break ;
case 2 : set_pwm1_duty ( Duty[PWM_counter] ) ; break ;
..........
case 29 : set_pwm1_duty ( Duty[PWM_counter] ) ; break ;
case 30 : set_pwm1_duty ( Duty[PWM_counter] ) ; break ;
case 31 : NivelMaximo() ; set_pwm1_duty ( Duty[PWM_counter] ) ; break ;
}
}
////////////////////////////////////////////////////////////////////////
void AvaliaBateria ( void )
{
switch ( NivelBateriaAtualizado )
{
case 0 : Duty[PWM_counter] = Duty0[PWM_counter] ; Beep = CONTINUO ; break ;
case 1 : Duty[PWM_counter] = Duty1[PWM_counter] ; Beep = CONTINUO ; break ;
.......
case 31 : Duty[PWM_counter] = Duty31[PWM_counter] ; Beep = MUDO ; break ;
case 32 : Duty[PWM_counter] = Duty32[PWM_counter] ; Beep = MUDO ; break ;
}
}