How are inputs and outputs defined in the code?
Do we need a main function to run it?
Is a do-while loop required to run it forever? or it loops itself as in Arduino.
How are inputs and outputs defined in the code?
Do we need a main function to run it?
Is a do-while loop required to run it forever? or it loops itself as in Arduino.
Hello Aviral,
Keep in mind that using the C-Script block is non-trivial and requires some deeper knowledge of PLECS. Try using PLECS blocks to create the required function first.
To start using the C-Script block, have a look at the C-Script chapter in the documentation and try some of the examples.
Best Regards
Falk
It’s not too bad to figure out. As Falk said start by reading the documentation and looking at the examples. It took me about a day to go through that and then try some simple scripts. I’m no expert now but I am now able to do state machines (although Plexim provides native support for state machines) and logic blocks in c-script. I’m actually converting some of these from Verilog into C.
I use a trigger so that the c-script is only executed on certain clock edges. It then might do a bunch of If/then/else statements, and updates its outputs, until asked to execute again.
…Roger
@Roger Need help about C-Script
How can I help?
Late here. Will try to answer tomorrow if you can give me some details.
Roger
I am trying to build MPPT block on C-script, there is no error in code. But still not getting desired duty cycle. Attached is the algorithm i implemented on C-script. Please guide me what changes i need to make.
MPPT.docx (294 KB)
ok probably best if someone from Plexim could help you but if I will try to find time to look at this, maybe this weekend.
…Roger
Okay thanks. Will contact you soon.