tengo problema para escalar un valor ... en el lcd me muestra cualquier valor como resultado
de la operacion matematica
la idea seria
entrada 1
2v ____ -1 bar
10v ____ 5 bar
formato de salida
0,000
entrada 2
2v ____ 0 temp
10 v ____ 150 temp
formato de salida
000,0
new float:presionCAMARA
new float:temperaturaCAMARA
new float:presionv1
new float:temperaturav2
PlcMain()
{
LcdClear()
for(;;)
{ prestemp()
Vin12FilterOn(200, 2000)
prestemp()
//LcdPrintf(0, 0, "I1 %02.2f %01.3f", presionv1, presionCAMARA )
LcdPrintf(0, 0, "I2 %f", temperaturav2)
LcdPrintf(0, 1, "t2 %f",Float:temperaturaCAMARA)
// Conmutar led D1 "DEBUG".
LedToggle()
DelayMS(500)
}
// Retorno..
return 0
}
prestemp()
{
presionv1 = Float: Vin1ReadVolt()
temperaturav2 = Float: Vin2ReadVolt()
//0,75 -2,5
//18,75 -37,5
presionCAMARA = Float:(presionv1*0.75)-2.5
//temperaturaCAMARA = Float: (temperaturav2*18.75)-37.5
temperaturaCAMARA = Float: (temperaturav2*0.15)
//presion = -0.80
//temperaturaCAMARA = -135.8
}