Hi,
I have a problem about "C funtion call".I don't know how to add the .c file.Can you explain more?
Thanks.
C function call
-
- Site Admin - Expert
- Posts: 616
- Joined: Wed Mar 07, 2007 11:23 pm
- Location: Bayonne- France
- Contact:
My advice is to place the c file in the same directory as your mdl file.
You must add the C file in
Simulation >> Configuration Parameters >> Custom Code >> include directory >> type the directory of your mdl file.
and
Simulation >> Configuration Parameters >> Custom Code >> Sources files >> type the filename : something.c
I will post an example soon.
Note however that this block is not functionnal in the evaluation version of the toolbox.
You must add the C file in
Simulation >> Configuration Parameters >> Custom Code >> include directory >> type the directory of your mdl file.
and
Simulation >> Configuration Parameters >> Custom Code >> Sources files >> type the filename : something.c
I will post an example soon.
Note however that this block is not functionnal in the evaluation version of the toolbox.
Re: C function call
I can't make the c function call work. Did you ever make further instructions or an example on this?
I made the two changes you suggested in this thread: 1) added the source code name to the configuration parameters, and I put it in the same directory that my mdl file is 2) I tried to add the path to the include directories, but it did not seem to like what I put in there. It was "C:\Documents and Settings\Jim\My Documents\PicMicro\InvertedPendulum_3030" but matlab complained about that. It did not complain as much when I removed that, but I get the error below
pic30-coff-cc1.exe: warning: Options have been disabled due to expired license
test2.c:31: error: syntax error before '.' token
gmake: *** [test2.o] Error 255
### Real-Time Workshop build procedure for model: 'test2' aborted due to an error.
I made the two changes you suggested in this thread: 1) added the source code name to the configuration parameters, and I put it in the same directory that my mdl file is 2) I tried to add the path to the include directories, but it did not seem to like what I put in there. It was "C:\Documents and Settings\Jim\My Documents\PicMicro\InvertedPendulum_3030" but matlab complained about that. It did not complain as much when I removed that, but I get the error below
pic30-coff-cc1.exe: warning: Options have been disabled due to expired license
test2.c:31: error: syntax error before '.' token
gmake: *** [test2.o] Error 255
### Real-Time Workshop build procedure for model: 'test2' aborted due to an error.
-
- Site Admin - Expert
- Posts: 616
- Joined: Wed Mar 07, 2007 11:23 pm
- Location: Bayonne- France
- Contact:
Re: C function call
Hi,
Up to now, some bugs were reported about the C call function
One bug appears when using C Function Call with one input and No output.
Most of these bugs are now fixed and will be released very soon in the next version (0.98)
Anyway, it may greatly help if you could upload on the forum a simple example (mdl + c files).
If the c file is in your model directory, you do not need to add the path of the c file.
Note anyway that any path you provide must be in the format "8.3" (old dos format with ~1 or ~x at the end of long directory name.
The matlab instruction rtw_alt_pathname('C:\Program files\zzz\...') convert a long name to its 8.3 name.
(but you should not need that)
Few thread about C function Call and with some examples:
Implementing the C Function Call
Passing a Vector to the C-Function Call block
C Function Call error for output size != 1
How much RAM area can a program use?
Lubin
Up to now, some bugs were reported about the C call function
One bug appears when using C Function Call with one input and No output.
Most of these bugs are now fixed and will be released very soon in the next version (0.98)
Anyway, it may greatly help if you could upload on the forum a simple example (mdl + c files).
If the c file is in your model directory, you do not need to add the path of the c file.
Note anyway that any path you provide must be in the format "8.3" (old dos format with ~1 or ~x at the end of long directory name.
The matlab instruction rtw_alt_pathname('C:\Program files\zzz\...') convert a long name to its 8.3 name.
(but you should not need that)
Few thread about C function Call and with some examples:
Implementing the C Function Call
Passing a Vector to the C-Function Call block
C Function Call error for output size != 1
How much RAM area can a program use?
Lubin
Re: C function call
Your QEI example solved my problem. I put my source code file name in the wrong box in the "custom code" configuration paramters. I had originally placed it in "Include custom c code in generated" instead of "Include list of addional" where it worked fine. Strange.
Who is online
Users browsing this forum: No registered users and 3 guests