#include<LCD4_128.h>
#include<FPU_128.h>
int GET(int dd)
{
return dd/2;
}
void main()
{
char c;
Init_Fpu();
Lcd_init();
switch(GET(16)*2)
{
case 8*1 :
LCD.LCD_STRING("8*1");
break;
case 8*2 :
LCD.LCD_STRING("8*2");
break;
}
}
with floating numbers
#include<LCD4_128.h>
#include<FPU_128.h>
float get(int dd)
{
return (float)dd/16.0;
}
void main()
{
char c;
Init_Fpu();
Lcd_init();
switch(get(8)/4.0)
{
case 1.14 :
LCD.LCD_STRING("1.14");
break;
case 0.125 :
LCD.LCD_STRING("0.125");
break;
default:
LCD.LCD_STRING("no match");
break;
}
}
// will print 0.125