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.

CCS/TMS570LS0432: Error #143

Part Number: TMS570LS0432

Tool/software: Code Composer Studio

Hello,

I would like to read out multiple ADC Channels and send them to the terminal.

Therefore I would like to use a for- loop with the number of adc channels I am using.

This is my Code:

unsigned int value1, value2, id1, id2, NumberInChars, IdInChars;
unsigned int value[8], id[8], ch_count= 0, i;
adcData_t adc_data[2];

adcInit();
sciInit();
gioInit();
gioSetDirection(gioPORTA, 0xFFFFFFFF);

while(1){

adcStartConversion(adcREG1, adcGROUP1); // Konvertierung starten
while(!adcIsConversionComplete(adcREG1, adcGROUP1)); // Warten, bis Konvertierung fertig ist


adcGetData(adcREG1, adcGROUP1, adc_data);

for (i=0;i<ch_count;i++){

value[i] = (unsigned int) adc_data[i].value;
id[i] = (unsigned int) adc_data[i].id;


IdInChars[i] = ltoa(id[i], (char*) command);
sciSend(scilinREG, IdInChars[i], command); // PIN-Channel:
sciSend(scilinREG, 2, (unsigned char *) ": ");


NumberInChars[i] = ltoa(value[i], (char*) command);
sciSend(scilinREG, NumberInChars[i], command); // Sensor data
sciSend(scilinREG, 2, (unsigned char *) ", ");
}

/* Code for only 2 ADC-Channels, which is working
value1= (unsigned int) adc_data[0].value;                       
id1 = (unsigned int) adc_data[0].id;
value2= (unsigned int) adc_data[1].value;
id2 = (unsigned int) adc_data[1].id;

IdInChars = ltoa(id1, (char*) command);
sciSend(scilinREG, IdInChars, command); // PIN-Channel:
sciSend(scilinREG, 2, (unsigned char *) ": ");
NumberInChars = ltoa(value1, (char*) command);
sciSend(scilinREG, NumberInChars, command); // Sensor data
sciSend(scilinREG, 2, (unsigned char *) ", ");

IdInChars = ltoa(id2, (char*) command);
sciSend(scilinREG, IdInChars, command); // PIN-Channel:
sciSend(scilinREG, 2, (unsigned char *) ": ");
NumberInChars = ltoa(value2, (char*) command);
sciSend(scilinREG, NumberInChars, command); // Sensor data
sciSend(scilinREG, 2, (unsigned char *) ", ");

*/

sciSend(scilinREG, 2, (unsigned char *) "\r\n"); // New line
adcStopConversion(adcREG1, adcGROUP1);


if(value1>128)                                  //LEDs
gioSetBit(gioPORTA, 1, 1);
else
gioSetBit(gioPORTA, 1, 0);

_delay_cycles(16000000-1);
gioToggleBit(gioPORTA, 0);

adcResetFiFo(adcREG1, adcGROUP1);

}

For the blue marked lines the error #143 (expression must have point-to-object pointer) occures..

(Furthermore I have a problem reading the ID of the ADC- Pins: Although I use ADIN0 and ADIN1, the number I get for both with the adc_data.id is 0.)

Thank you in advance!

Christian

  • I can only help with this one aspect of your post ...

    Christian Schau said:
    For the blue marked lines the error #143 (expression must have point-to-object pointer) occures..

    Add the compiler option --verbose_diagnostics.  This causes the compiler to echo the problem source line, with a mark on the point where the problem begins.  This often makes the problem easier to understand.  

    If that doesn't work, then I need a test case which allows me to reproduce the same behavior.  For the source file that sees the diagnostic, please follow the directions in the article How to Submit a Compiler Test Case.

    Thanks and regards,

    -George

  • I actually found the problem myself: In the old version IdInChars and NumberInChars were not declared as arrays. Now it works and the two different ADC-Values are shown in the terminal.

    However the ID of the pins isn't right: It is 0 for both pins.
    The two values are different though and i can change them using a potentiometer.

    Do you have any suggestions why thiis doesn't work properly? 

    Thank you :)

    Here is my compiler test case:

    Build Options (Compiler Version)

    "C:/ti/ccs900/ccs/tools/compiler/ti-cgt-arm_18.12.1.LTS/bin/armcl" -mv7R4 --code_state=32 --include_path="C:/Users/chris/workspace_v9/2xADC_2" --include_path="C:/Users/chris/workspace_v9/2xADC_2/include" --include_path="C:/ti/ccs900/ccs/tools/compiler/ti-cgt-arm_18.12.1.LTS/include" -g --preproc_with_comment --preproc_with_compile --diag_warning=225 --diag_wrap=off --display_error_number --enum_type=packed --abi=eabi --obj_directory="source"  "../source/sys_main.c"

    Preprocessed file:

    7215.sys_main.pp.txt

  • Ok. I actually missed to check the " Enable channel ID in converson results" check box.

    But why do the results switch to a random default value, if no voltage is applied to adc-pin?
    When a wire is connected to the pin, the conversion results are correct...
  • Hello,
    If ADC input is not connected but the channel is included to a group that is converted then the result for this channel will be unpredictable.
    In your code I can see ch_count is init to 0 but never changed. Then the for loop will never be executed.

    Best regards,
    Miro
  • Thank you,

    is it possible in some way to detect a open wire then? I tried a pull down resistor, but even though the adc pin ist connected to ground in open wire case, the value isn't zero..

    I fixed the loop:

    ch_count=adcGetData(adcReg1,adcGROUP1,adc_data)

    So the number of adc-pins is now stored in ch_count.

  • Hello,
    You can use Self-Test Mode to determine Open/Short on ADC Input Channels. This is described in Section 16.7.2.1 of device TRM: www.ti.com/.../spnu517c.pdf

    But when the sampled pin is Open the result will be always unknown.


    Best regards,
    Miro

  • Thank you very much!
    I can detect short cuts and open wires using the self-test mode now!