You may want to think about what you are doing in the IF part of the problem:
IF HSCPV[2] <= (S#_STRT_SKP_1 / D#_IN_PER_CNT)
[/font]
You are comparing a 32 bit signed integer, HSCPV[2], against a floating point value as the result of the division. The TBASIC compiler CANNOT directly compare two different types of values. The TBASIC compiler will have to promote (convert) either HSCPV[2] to a floating point value or convert the floating point result of the division to an integer.
In either case you are comparing apples to oranges as the two types of numbers, float and integer, are not interchangeable. Floats and integers have limitations as to the range of values they can represent and to what accuracy they represent the values. Remember, in most cases, a float is an approximation of the actual value.
I would stick with integer variables on both sides of the equation. If you want to calculate 99% of some integer, multiply it by 99 and then divide by by 100. Be certain that you multiply first, then divide!
Another thing to consider is that HSCPV[2] will be treated by TBASIC as a 32-bit signed value. If you are using this counter to count stuff that only increments. HSCPV[2] will count up to some really big positive number and on the next count the value will become a really big negative number!
I'm a little concerned about your description of an "IF loop". In what way does an IF statement "loop"? I think of FOR/NEXT and WHILE/ENDWHILE as looping constructs. It is a next to impossible to get code to run in a loop with only an IF statement unless you add in a GOTO.
IF you comment out the IF and the ENDIF the code that is left will execute. If would not trust the color coding of the simulator as proof of anything. Set a variable or use a break point. Better yet run the code on real hardware.
I'd also restart your computer as the Java code that the simulator is written in can fail in real interesting ways. There may be nothing wrong with the code other that the simulator has gotten lost. This happens to me all of the time. It's one of life's little frustrations.
Gary D.