Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

CC2640R2F: Sensor Controller Studio gives "syntax error or unknown identifier(s)" error

$
0
0

Part Number:CC2640R2F

I have a sensor controller studio project that was working fine until I tried to add another local variable to the Execution task.  See code below.  When I utilize U16 variable 'y', the code generator lists an error on line 32 "syntax error or unknown identifier(s)".  It also gives this error if I try to use 'y' outside the if() statement.  Using a constant in the place of 'y' works as I show, as does using the other variable 'n'.    What is going wrong here?

// Select ADC input for first signal
adcSelectGpioInput(AUXIO_A_AIN_AC);

// Enable the ADC
adcEnableSync(ADC_REF_FIXED, ADC_SAMPLE_TIME_2P7_US, ADC_TRIGGER_MANUAL);

U16 n = state.head;  
U16 y = state.headVR;

// Sample and convert first signal
adcGenManualTrigger();
adcReadFifo(output.u16curValueAC);
output.pSamplesAC[n] = output.u16curValueAC;

// Select ADC input for second signal
adcSelectGpioInput(AUXIO_A_AIN_DC);
// Sample and convert second signal
adcGenManualTrigger();
adcReadFifo(output.u16curValueDC);
output.pSamplesDC[n] = output.u16curValueDC;
//increment buffer index 'n' with wrapping
utilIncrAndWrap(n, BUFFER_SIZE; state.head);


// each time we reach end of SamplesAC/DC buffer, take one VREF sample
if (n == 0) {
    // Select ADC input for virtual reference signal
    adcSelectGpioInput(AUXIO_A_AIN_VREF);
    // Sample and convert virtual reference signal
    adcGenManualTrigger();
    adcReadFifo(output.u16curValueVR);
    //output.pSamplesVR[y] = output.u16curValueVR;  //line 32 gives "syntax error or unknown identifiers" error in code generator  
    output.pSamplesVR[2] = output.u16curValueVR;  //works
    //increment buffer index 'y' with wrapping
    utilIncrAndWrap(y, BUFFER_SIZE; state.headVR);
}

// Disable the ADC
adcDisable();

// Schedule the next execution, period setup in main CM3 applicaiton using: void scifStartRtcTicksNow(uint32_t tickPeriod), see scif.c for details
fwScheduleTask(1);

Thanks for your help.

Ed


Viewing all articles
Browse latest Browse all 262198

Trending Articles