I am experimenting a bit with C++/PScript coding in PLD and you can see the mock-up below where I create 3 math functions.
The diagram is named “Math” so the functions are Math.Pow2, Math.Abs and Math.Sin – two of them in C++ and one in PScript. Assuming the target is C++ you can add C++ scripts using the Assign block. This is handy then you want to just add a few lines of code in C++ directly. PScript does the same in a generic way, but on the low level functions you will need to use C++ a bit. My first target is C++/STM32.
My first comment is that – yes it is possible to write target source code, but it is not a nice way to code as is. The editor I use is ok for text, but not for source code so I will need to change this. My plan is (1) to add a more decent editor for sourc code – double click to open an editor or something – (2) add an import function and support external functions so you can write target language code in your IDE and just include it from BSA. But, these changes will be for later.
Another issue is that Math will be a large library – the actual library will be an include, but I would like to be able to create this or similar in BSA- and yes I can. Looking on the picture above you will see that I run out of diagram space. This is the one drawback with diagrams – they take visual space. So in short – I need a sub-diagram option or “partial diagram” – simply an option to create a new diagram as an extension of a previous one so I get the “Math” prefix on all functions. The simple solution is to create a new diagram and call it “Math” and then let BSA auto-detect this being parts of the same diagram. Diagram name in BSA is the same as Class or Namespace in C++/C#.
It is a few things on the modeling level that need fixing before I have a release:
- Annoying line errors. Diagram lines are sometimes a bit off and you don’t see it before you copy or re-load a diagram. This must be fixed.
- A consolidation of tools available in PLD.
- Listing known errors.
- Implement Copy function.
- Add partial diagrams.
- Fix select function to be consistent.
- Fix internal diagram to diagram links.
That’s it – after that I release a Beta and start on C++/STM32 code generation. Next is adding HMI back in and supporting C#. The plan is to support C#/WPF for HMI and C++/STM32. I need to start somewhere and these are the two that is easiest to implement for me.