C Caller Block in Simulink does not show port specification?

Thread Starter

TarikElec

Joined Oct 17, 2019
49
Hello,
as You can see C caller does not show Port specification of the c code of the MatLab video shown here:
C Call Block

Code:
           #ifndef HEADER_H_
           #define HEADER_H_

           // Global Variable

           extern double gVec[5];
           extern double sum;


          //Function
          extern void cumulativeAdder(void);

          #endif

source code as below:

Code:
#include "header.h"
double gVec[5];
double sum = 0;
void cumulativeAdder(void){
    int idx = 0, tmpSum = 0;
   
    for(; idx < 5, ++idx){
        tmpSum = tmpSum + gVec[idx);  // Function reads "gVec" as INPUT
        }
       
    sum = tmpSum; //Function writes to "sum" as OUTPUT
   
}

ccaller.png
 
You also have an error here:
Code:
        tmpSum = tmpSum + gVec[idx);  // Function reads "gVec" as INPUT

// should be

        tmpSum = tmpSum + gVec[idx];  // Function reads "gVec" as INPUT
 
after checking the Global variables, I have only checked this and still the problem is there
You'll need to go through the whole document on that link and make sure that you've done everything, as well as fixing that error I pointed out
C:
  tmpSum = tmpSum + gVec[idx);  // Function reads "gVec" as INPUT

// should be

tmpSum = tmpSum + gVec[idx];  // Function reads "gVec" as INPUT
 
Top