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.

Problems when using pointers

Other Parts Discussed in Thread: TMS320F28335

I'm having problems when using pointer to a vector In CCS 6    (for C200 TMS320F28335)

I have 3 float vectors on my code, and I want to use pointers in order to work with them more efficiently , because I have a lot of index manipulation.


 But I always have a lot of errors when building. Like:

line 66: error: declaration is incompatible with
          "float *pentrada"

Line 66: warning: a value of type "float *" cannot be
          used to initialize an entity of type "int"
  pentrada = &entrada[16];

This part of the code is:

float entrada[500];
float saida[500];
float filtro[17] = {
   -0.05332329190833,  0.01955569923624,  0.05182699489378,   0.0113522699158,
    0.04058293444255,   0.1874313285955,   0.1582950486624,  -0.1746695177164,
     0.6052366278191,  -0.1746695177164,   0.1582950486624,   0.1874313285955,
    0.04058293444255,   0.0113522699158,  0.05182699489378,  0.01955569923624,
   -0.05332329190833};

float *pentrada;
float *psaida;
float *pfiltro;

pentrada = &entrada[16];   (yes, the pointer needs to catch the address of the end of this vector)
psaida = &saida[0];
pfiltro = &filtro[0];

The errors are related to this part above ^


I've already tried:


psaida = saida;
pfiltro = filtro;

Can someone please show me where I'm going wrong?

 

 

  • Hi,

    I can't see anything necessarily wrong with the code you sent. To confirm this, I built your snippet of code and, as I expected, no errors were found.

    Perhaps the issue is happening at another part of your code?

    (BTW, the last two lines can be simplified as shown above).

    I am using CCSv6.2.0 with C2000 compiler version 15.12.3.LTS

    Regards,

    Rafael