hi every one.
I have some problem trying make some division with float variable.
some one can help me please.
main.c
while(0)
{
menu_state = PARAM_MENU;
param_menu = PARAM_MENU_FREQ;
pwmq_freq_ui16 = encoder_knob_read();
set_PWM1_FREQ();
//set_PWM1_DT();
sprintf(buffer1,"2-FREQ:%5uHz",pwmq_freq_ui16);
oled_setcursor(0,2);
oled_print_string(buffer1);
return 0;
}
// prototype function
void set_PWM1_FREQ(void)
{
PWM1_set_Freq(pwmq_freq_ui16);
}
pwm.c file
void PWM1_set_Freq(uint16_t Freq_PWM1)
{
float Freq_PWM1_F = (float)1/Freq_PWM1;
//uint16_t new_valor = (uint16_t)((65535*Freq_PWM1_F))/PWM1_CONST_2;
//
// if(OC1RS != new_valor)
// {
// OC1RS = (uint16_t)new_valor;
// }
}
if I do this float Freq_PWM1_F = (float)1/;
I get a:
in this moment ( break point on main.c in line 8 "set_PWM1_FREQ();" )
when I step the line 44 the watches editor clear all the value.
but if I try do this:
pwm.c
void PWM1_set_Freq(uint16_t Freq_PWM1)
{
float Freq_PWM1_F = (float)1/1000;
//uint16_t new_valor = (uint16_t)((65535*Freq_PWM1_F))/PWM1_CONST_2;
//
// if(OC1RS != new_valor)
// {
// OC1RS = (uint16_t)new_valor;
// }
}
works fine.
I know is confused my discription.
but if some one can try read and help I will aprecciate the kindness.
-
genebren
-
Cancel
-
Vote Up
0
Vote Down
-
-
Sign in to reply
-
More
-
Cancel
-
hazard
in reply to genebren
-
Cancel
-
Vote Up
0
Vote Down
-
-
Sign in to reply
-
More
-
Cancel
Comment-
hazard
in reply to genebren
-
Cancel
-
Vote Up
0
Vote Down
-
-
Sign in to reply
-
More
-
Cancel
Children