View previous topic :: View next topic |
Author |
Message |
MiniMe
Joined: 17 Nov 2009 Posts: 50
|
Matlab coder porting |
Posted: Tue Aug 13, 2013 1:32 pm |
|
|
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
|
|
Posted: Mon Aug 19, 2013 6:07 am |
|
|
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
|
Re: Matlab coder porting |
Posted: Mon Aug 19, 2013 6:57 am |
|
|
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
|
|
Posted: Sun Aug 25, 2013 10:48 am |
|
|
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: 9226 Location: Greensville,Ontario
|
|
Posted: Sun Aug 25, 2013 4:30 pm |
|
|
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 |
|
|
|