set order of multiple extern function block
Hello, I would like to implement the below C code from the Arduino IDE in Altair Embed for research purposes.
Two questions:
Is it possible to specify the order of calls for multiple external function blocks in embed?
The order of the function calls is in the c code.
How can I implement the delay function from the Arduino IDE in Embed?
Thanks for the help
volatile float z=0; //////functions////////////////// void Schleife(void){ for(unsigned int a=0;a<500;a++){ z=z+1; } } void zNull(void){ z=0; } ////////////////////////////////// void setup() {} void loop() { digitalWrite(49, HIGH); Schleife(); zNull(); digitalWrite(49, LOW); delay(1); }
Attachment: vsm file
Answers
-
Hi Nico,
There are couple of ways to get what you want. Here is one method if you still want to write code in extern blocks as you do in this case. I however recommend that you consider modelling the c based logic in embed natively itself . Let me know if you need help there.
Now back to your question. You could schedule a collection of blocks which is a compound block on various ways. Either at regular time intervals like what you need here or via an interrupt ..etc.
Here are the steps :
* Select the blocks that you would want to combine into a compound and right click and create a compound .
* This will create a compound block and then you could CTRL + RIGHT CLICK to bring up the dialog as below. Please note the Local Time step (sec) where you could input the value 1 . This means the compound block would be called at every 1 second.
Also attached is the diagram that is modified.
hope this helps,
--sreeram
1 -
Hello Sreeram Mohan,
Thanks for your help.
How can I program the c based logic in embed natively with the c code shown?
Is there an easier way without the external blocks?
Thank you and best regards Nico
0 -