I'm putting my nooby hat firmly back on here!
This following chain of multiple IFs, is absolutely slaughtering my modest 12lf1822's program space, I wonder if anyone would be so kind to offer up a better way (ie uses less code space) of approaching this....
Code:
if supply_in>= 253 then max_duty = 154
if supply_in> 250 and supply_in< 254 then max_duty = 155
if supply_in> 248 and supply_in< 251 then max_duty = 156
if supply_in> 245 and supply_in< 249 then max_duty = 157
if supply_in> 240 and supply_in< 243 then max_duty = 159
if supply_in> 237 and supply_in< 241 then max_duty = 160
if supply_in> 234 and supply_in< 238 then max_duty = 161
if supply_in> 231 and supply_in< 235 then max_duty = 163
if supply_in> 229 and supply_in< 232 then max_duty = 165
if supply_in> 226 and supply_in< 230 then max_duty = 167
if supply_in> 223 and supply_in< 227 then max_duty = 169
if supply_in> 220 and supply_in< 224 then max_duty = 172
if supply_in> 218 and supply_in< 221 then max_duty = 175
if supply_in> 215 and supply_in< 219 then max_duty = 179
if supply_in> 212 and supply_in< 216 then max_duty = 181
if supply_in> 210 and supply_in< 213 then max_duty = 182
if supply_in> 207 and supply_in< 211 then max_duty = 184
if supply_in> 204 and supply_in< 208 then max_duty = 188
if supply_in> 201 and supply_in< 205 then max_duty = 191
if supply_in> 199 and supply_in< 202 then max_duty = 195
if supply_in> 196 and supply_in< 200 then max_duty = 214
if supply_in> 193 and supply_in< 197 then max_duty = 238
if supply_in> 187 and supply_in<194 then max_duty = 251
if supply_in< 188 then max_duty = 255
Surprisingly, (to me at least) a 'select case' used even more program, space (which I realise would be quicker & more efficient, but I've got to roll with whatever takes the least amount of program space presently!
Could an array be brought into play or similar?
Bookmarks