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 CCS Technical Support

Matlab coder porting

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



Joined: 17 Nov 2009
Posts: 50

View user's profile Send private message

Matlab coder porting
PostPosted: Tue Aug 13, 2013 1:32 pm     Reply with quote

Hey!

I offer you under 100 lines on computer generated code. Most common use-case in MATLAB world. A PID... simplest P block.

The problem:
Due low C experience I'm not able to handle "higher" concepts of C. The code doesn't compile.

The challenge:
You can fix the code and contribute to community by proving tips and "know-hows".


I managed to tinker with code generation options and decrease code modularity so everything is compact and simple. (coder options screens added below).

Project file:
http://www.filedropper.com/pic18f4550matlab

Code generation options screens:
http://www.filedropper.com/matlabcodegenerationoptions

Thank you in advance!
Sergeant82d



Joined: 01 Nov 2009
Posts: 55
Location: Central Oklahoma

View user's profile Send private message

PostPosted: Mon Aug 19, 2013 6:07 am     Reply with quote

How about you provide a good-faith effort at a CCS program? Find a template for the 18F4550 you want to use. Spend some time figuring out what the program you want to use, does. Rough out some functions which should perform the tasks involved, even if they don't actually do anything right now.

Get to a compiling state.
Post your code, along with specifics of what you want to do.

THEN, maybe, you'll get some help, once you've shown that you've tried to help yourself.

Hope this helps

(BTW, I had written some rather obnoxious, satirical blather originally, but changed my mind and deleted it, keeping only what I think might help)
oxo



Joined: 13 Nov 2012
Posts: 219
Location: France

View user's profile Send private message

Re: Matlab coder porting
PostPosted: Mon Aug 19, 2013 6:57 am     Reply with quote

MiniMe wrote:
Hey!

I offer you under 100 lines on computer generated code. Most common use-case in MATLAB world. A PID... simplest P block.

The problem:
Due low C experience I'm not able to handle "higher" concepts of C. The code doesn't compile.

The challenge:
You can fix the code and contribute to community by proving tips and "know-hows".


I managed to tinker with code generation options and decrease code modularity so everything is compact and simple. (coder options screens added below).

Project file:
http://www.filedropper.com/pic18f4550matlab

Code generation options screens:
http://www.filedropper.com/matlabcodegenerationoptions

Thank you in advance!


Consultation rates are 50€ per hour. Please send a purchase order to cover 40 hours at that rate. A deposit of 60% is required before project start.
MiniMe



Joined: 17 Nov 2009
Posts: 50

View user's profile Send private message

PostPosted: Sun Aug 25, 2013 10:48 am     Reply with quote

I am very sorry for expressing my intentions unclearly.

The "problem" to solve was actually pretty simple. To change minimal amount of code to get it to compilable state.

Main function already most important function " rt_OneStep()" it means that it recalculates required controlled variables to provide next state of controller. In the "next state" there are also the input and output variable of the controller.

The code is generated from Simulink model. (image below)



PID block is like a math function. The input and output does change the behavior of the function. It is very "doable" by using simple C that i can handle. The thing is it is very difficult (for me) to figure out the reason why code does not compile.


Again, I am very sorry for your misused time.
Still I am very thankful for your responses.
temtronic



Joined: 01 Jul 2010
Posts: 9241
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Sun Aug 25, 2013 4:30 pm     Reply with quote

You'll have to post your PIC C program, PIC type, compiler version and an example of what you expect of input vs. output.

Doing PIC with a PIC is fairly easy (1-3 lines) but we need some real code to help you.

hth
jay
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