Author Topic: SW Template flow  (Read 511 times)

Offline jonbhanson

  • PLUS+1 User
  • **
  • Posts: 5
  • Karma: +0/-0
SW Template flow
« on: March 17, 2025, 08:45:13 PM »
I appreciate the SW template, thanks to whomever created them.

However, I am a bit confused about the execution flow through the template.


Inside the Input page, there is a sub-page for receiving CAN data (clever use of the tin can for the icon, by the way!)
Assuming some data is received on the CAN bus that needs to be subsequently processed by the application, it seems likely that the data from the CAN page will need to flow to some process page within the top level application page.
My confusion is that there is not really a "proper" way to send the output of the CAN page to the input of the process page.  The data would have to flow either 1. backwards from the CAN page through the Main bus on the left or 2. out of the CAN page the InPage bus on the right and then backwards into the application page. 



I understand that technically this will work because data placed on a wire is immediately propagated to the other nodes on that wire, so page order is what matters for execution order.  However, it seems like a bad practice to have the signal feeding backwards so to speak when the general rule is for program flow to be left to right.

What would make more sense to me is that the Input sub-pages should feed their outputs into the inputs of the application pages. 



Am I missing something here?  How do applications that use this template feed signals from CAN Rx or other input pages to the application processes?

Thanks!
Jon

Offline Lukey

  • PLUS+1 Expert
  • ****
  • Posts: 78
  • Karma: +8/-0
Re: SW Template flow
« Reply #1 on: March 18, 2025, 01:10:37 AM »
Personally I don't use the SW Template, I have my own style/template.

I've only seen the SW Template implemented once by another programmer and the 'flow' was a mess.

They don't even teach you to use the SW Template in any of the Danfoss training I have done...

Ultimately you are correct, you need to go backwards on yourself and tie the processed CAN information back to the Input bus so that you can use it else where;
Or just adjust the template as per your screen shots, there is no rules.

Also a good thing to know/remember is that the software processes GUIDE code differently, it isn't exactly left to right, search for 'About Execution Order' in the user manual (Press keyboard F1 button to launch the manual from GUIDE)

Offline Stefan

  • Administrator
  • PLUS+1 Expert
  • *
  • Posts: 74
  • Karma: +1/-0
Re: SW Template flow
« Reply #2 on: March 18, 2025, 02:27:36 PM »
Hello,

The way to use the template is to make sub-busses for e.g. CAN_Rx (see image).

When you want to connect to the bus you have created, e.g. CAN_Rx above, you have bring it out from the Main bus (see image).

I hope this will help to understand the template.

Have a nice day!