This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Sensor Controller Studio v1.3.0 generates incorrect code



Greetings.

I have encountered a situation where SCS 1.3 appears to generate the wrong code.  I pared the offending code down to this:

U16 spotSampleCount = 0;

// Keep looping until we are asked to stop by the main processor
do {
    // Reset the sample count if requested to do so by the main processor
    if( input.resetSampling != 0 ) {
        input.resetSampling = 0;
        spotSampleCount = 0;
    }
        
    // Increment the sample counter
    spotSampleCount = spotSampleCount + 1;
            
    // Read the high-speed RGB sensor every sample period
    if( spotSampleCount == input.spotPeriod ) {
        // Do some I2C stuff        
    }
    
    // Clear the sample counter after a sample is taken
    if( spotSampleCount >= input.spotPeriod ) {
        spotSampleCount = 0;
    }

} while( input.kill == 0 );


Note that in the generated listing code, the line 'spotSampleCount = 0' does not actually generate any instructions to perform the assignment.

               ;?     // Clear the sample counter after a sample is taken
               ;?     if( spotSampleCount >= input.spotPeriod ) {
0094 ---- 1879                             ld          R1, [#i2cLight/input/spotPeriod]
0095 ---- 8d29                             cmp         R0, R1
0096 ---- ae00                             bltu        /id0128
               ;?         spotSampleCount = 0;
               ;?     }
               /id0128:
               ;?

Thank you
Scott Wild