Hmm, if the problem is inside this piece of code, I'd say this
Code:
if(FTamaCount 300>=150) then
part shouldn't be something like
Code:
if&#40;&#40;FTamaCount<300&#41; and &#40;FTamaCount>=150&#41;&#41; then
If it's not that, then I think we need to see a bit more of the code

(Edit: I see the pascal tags mess up the code a bit, so it could be that your code is already in the mentioned format)