PWM. Problem
Posted: Wed Feb 23, 2011 6:02 pm
HI, All,
I need a bit of help.
I have a program that I have made to control A piece of equipment By PWM. I have to limit the PWM but need to have 10% steps, the program I have made will simulate fine.
However when I go to compile it gives me a error. (See below)
J:\Projects\PinCure\FlowCode Files\UV LED Controller V1-0.c(1022): error: can't convert 'float' to 'unsigned char'
J:\Projects\PinCure\FlowCode Files\UV LED Controller V1-0.c(1022:17): error: failed to generate expression
J:\Projects\PinCure\FlowCode Files\UV LED Controller V1-0.c(1042): error: can't convert 'float' to 'unsigned char'
J:\Projects\PinCure\FlowCode Files\UV LED Controller V1-0.c(1042:17): error: failed to generate expression
J:\Projects\PinCure\FlowCode Files\UV LED Controller V1-0.c(1062): error: can't convert 'float' to 'unsigned char'
J:\Projects\PinCure\FlowCode Files\UV LED Controller V1-0.c(1062:17): error: failed to generate expression
J:\Projects\PinCure\FlowCode Files\UV LED Controller V1-0.c(1082): error: can't convert 'float' to 'unsigned char'
J:\Projects\PinCure\FlowCode Files\UV LED Controller V1-0.c(1082:17): error: failed to generate expression
J:\Projects\PinCure\FlowCode Files\UV LED Controller V1-0.c(1102): error: can't convert 'float' to 'unsigned char'
J:\Projects\PinCure\FlowCode Files\UV LED Controller V1-0.c(1102:17): error: failed to generate expression
J:\Projects\PinCure\FlowCode Files\UV LED Controller V1-0.c(1122): error: can't convert 'float' to 'unsigned char'
J:\Projects\PinCure\FlowCode Files\UV LED Controller V1-0.c(1122:17): error: failed to generate expression
J:\Projects\PinCure\FlowCode Files\UV LED Controller V1-0.c(1142): error: can't convert 'float' to 'unsigned char'
J:\Projects\PinCure\FlowCode Files\UV LED Controller V1-0.c(1142:17): error: failed to generate expression
J:\Projects\PinCure\FlowCode Files\UV LED Controller V1-0.c(1162): error: can't convert 'float' to 'unsigned char'
J:\Projects\PinCure\FlowCode Files\UV LED Controller V1-0.c(1162:17): error: failed to generate expression
J:\Projects\PinCure\FlowCode Files\UV LED Controller V1-0.c(1450:17): warning: expression was optimized out
I have worked out that this is being generated due to me having a decimal point in my PWM values IE 30.4
IS there a way a can avoid this error but keep the values I have as a lot of the PWM levels I have created need to have the Decimal value.
Thanks
Tristan
I need a bit of help.
I have a program that I have made to control A piece of equipment By PWM. I have to limit the PWM but need to have 10% steps, the program I have made will simulate fine.
However when I go to compile it gives me a error. (See below)
J:\Projects\PinCure\FlowCode Files\UV LED Controller V1-0.c(1022): error: can't convert 'float' to 'unsigned char'
J:\Projects\PinCure\FlowCode Files\UV LED Controller V1-0.c(1022:17): error: failed to generate expression
J:\Projects\PinCure\FlowCode Files\UV LED Controller V1-0.c(1042): error: can't convert 'float' to 'unsigned char'
J:\Projects\PinCure\FlowCode Files\UV LED Controller V1-0.c(1042:17): error: failed to generate expression
J:\Projects\PinCure\FlowCode Files\UV LED Controller V1-0.c(1062): error: can't convert 'float' to 'unsigned char'
J:\Projects\PinCure\FlowCode Files\UV LED Controller V1-0.c(1062:17): error: failed to generate expression
J:\Projects\PinCure\FlowCode Files\UV LED Controller V1-0.c(1082): error: can't convert 'float' to 'unsigned char'
J:\Projects\PinCure\FlowCode Files\UV LED Controller V1-0.c(1082:17): error: failed to generate expression
J:\Projects\PinCure\FlowCode Files\UV LED Controller V1-0.c(1102): error: can't convert 'float' to 'unsigned char'
J:\Projects\PinCure\FlowCode Files\UV LED Controller V1-0.c(1102:17): error: failed to generate expression
J:\Projects\PinCure\FlowCode Files\UV LED Controller V1-0.c(1122): error: can't convert 'float' to 'unsigned char'
J:\Projects\PinCure\FlowCode Files\UV LED Controller V1-0.c(1122:17): error: failed to generate expression
J:\Projects\PinCure\FlowCode Files\UV LED Controller V1-0.c(1142): error: can't convert 'float' to 'unsigned char'
J:\Projects\PinCure\FlowCode Files\UV LED Controller V1-0.c(1142:17): error: failed to generate expression
J:\Projects\PinCure\FlowCode Files\UV LED Controller V1-0.c(1162): error: can't convert 'float' to 'unsigned char'
J:\Projects\PinCure\FlowCode Files\UV LED Controller V1-0.c(1162:17): error: failed to generate expression
J:\Projects\PinCure\FlowCode Files\UV LED Controller V1-0.c(1450:17): warning: expression was optimized out
I have worked out that this is being generated due to me having a decimal point in my PWM values IE 30.4
IS there a way a can avoid this error but keep the values I have as a lot of the PWM levels I have created need to have the Decimal value.
Thanks
Tristan