problem string to int

Hello everyone,
I want recuperate a value from Labview (val8bit), when it’s in continuous mode, it works witout any problem, but when it is in TTL mode, it doesn’t work. following is my code. For continous voltage, i just add that line if (val8bit>=0), because it seems when I want to change the value from 2V to 3V(it works 2V to 0 then 0 to 3V) and i want to avoid that 0V. But it soesn’t work in TTL mode, anyone could help me, thanks very much

val8bit = (inputString.toInt());

if(TTL1>=600)
{
for (int x = 0; x < 7; x++) // Boucle de transformation décimal/binaire.
{
poids = val8bit / pow(2,7-x);
if (val8bit>0) {
if (poids >=1 )
{
SignalCNA= 1;

digitalWrite(CNAPins, HIGH); //Si a la sorite on a une valeur binaire 1 on l’emploie 1 à CNA

}
else
{
SignalCNA= 0;

digitalWrite(CNAPins, LOW);
}
}
val8bit = val8bit - ( SignalCNA* (pow(2,7-x)) );
Serial.print(SignalCNA);

Serial.print("\t");
}
}
else
{
for (int x = 1; x < 7; x++)
{
digitalWrite(CNAPins, LOW);

// digitalWrite(CNAPins[1], HIGH);
}

}