/*
* Ekrana yazdırma
*/
void print_i(uint16_t tam, uint16_t ondalik)
{
uint8_t text[16];
// 0123456789012345
strcpy(text, "Akim: ");
SetCursorToLCD(0, 0);
WriteStringToLCD(text);
text[0] = (tam / 1000) + 48;
text[1] = ((tam / 100) % 10) + 48;
text[2] = ((tam / 10) % 10) + 48;
text[3] = ((tam / 1) % 10) + 48;
text[4] = '.';
text[5] = ((ondalik / 10) % 10) + 48;
text[6] = ((ondalik / 1) % 10) + 48;
text[7] = 'A';
text[8] = '.';
SetCursorToLCD(1, 0);
WriteStringToLCD(text);
__delay_ms(1000);
}
/*
*
*/
void main(void)
{
uint16_t j, temp, t, o;
float i;
initSystem();
ClearLCDScreen();
while(1)
{
i = 0;
for(j = 0; j <= 255u; j++)
{
temp = adcOku(0);
if(i < temp)
{
i = temp;
}
}
i = 2.1 * (i - 512);
i /= 10;
t = (uint16_t) (i);
o = (uint16_t)((i - t) * 100);
print_i(t, o);
__delay_ms(200);
}
}