CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

How to use C codes converted from Matlab to PIC

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Zek_De



Joined: 13 Aug 2016
Posts: 100

View user's profile Send private message

How to use C codes converted from Matlab to PIC
PostPosted: Fri Dec 30, 2016 2:08 pm     Reply with quote

Hello Friends,
I'm trying to understand to use C codes converted from Matlab.

Should the generated files be placed in the project folder? and then just #include<abc.h> is it ok? who know this?
Ttelmah



Joined: 11 Mar 2010
Posts: 19369

View user's profile Send private message

PostPosted: Fri Dec 30, 2016 2:37 pm     Reply with quote

You can include files from wherever you want. Use
Code:

#include "abc.h"

Or just put the full path in the include.

'<' is normally used for 'system' includes. Makes the compiler search the system include directories first. '"' instead says search in the 'default' directory (by default the current directory) first.

Remember you are going to have to do a lot of basic changes. Variable types in particular.
Zek_De



Joined: 13 Aug 2016
Posts: 100

View user's profile Send private message

PostPosted: Fri Dec 30, 2016 3:08 pm     Reply with quote

I wonder you have ever worked on it before?

You say me I have to do some changing in these code like variable types .
my example is this

function [c] = coderand( a,b)
c=a*b;
end

Simple code to understand. When I build to generate C code, Matlab give me so much folder, these are Target Source Files:

coderand.c
coderand.h
coderand_initialize.c
coderand_initialize.h
coderand_terminate.c
coderand_terminate.h
coderand_types.h
rtwtypes.h

and also in MATLAB files in my example so much folder, variables are double and I added all Target Source Files (CCS C has problem with it) and I called my function (named coderand) of course doesn't work and also I tried with mikroC and I added all Target Source Files (it's ok) but when I called coderand(a,b,c); error:illegal pointer conversion.

I don't know what I should do, this's little complicated but I'm studying communication engineering, this is why I use mostly Matlab and I have to solve this.
Zek_De



Joined: 13 Aug 2016
Posts: 100

View user's profile Send private message

PostPosted: Fri Dec 30, 2016 4:15 pm     Reply with quote

Thanks Ttelmah I solved, I didn't see in function const.
Code:
void coderand(const double a[6], const double b[3], double c[2]);

This is why I was getting error. It's ok now.
Ttelmah



Joined: 11 Mar 2010
Posts: 19369

View user's profile Send private message

PostPosted: Sat Dec 31, 2016 2:27 am     Reply with quote

If you used #DEVICE ANSI, or #DEVICE CONST=READ_ONLY, const would have the meaning that Matlab is assuming.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group