Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

Motor Control ICs Forum Discussions

Yuyan_Tang
Employee
5 questions asked First question asked First reply posted
Employee
The script engine integrated in the MCE has proven to be very useful particularly for the IMC100/IMM100 series. Unfortunately the editor integrated in the MCEWizard is a rather simply version and the new ecosystem is still some way ahead.
This thread will introduce how to use Notepad++ (npp in the following) as an alternative. We configured it specifically for iMOTION script and would like to share this configuration with you.

If analog or digital pins are used for scripting, the resp. configuration has to be done in the MCEWizard.

The description below gives the configuration of npp for the following steps:
1) syntax highlighting
2) auto completion
3) script compilation

________________________________________
1) syntax highlighting

npp comes with syntax highlighting for a lot of predefined languages but also allows the definition of ‘user defined languages’.
The attached file “iMOTION Script udl.xml” contains the keyword definitions for iMOTION script based of MCE rev. 1.3.1.
Importing into npp works as follows:
- from the ‘language’ menu select ‘User Defined Language’ => ‘Define your language’
4595.attach

- Import the xml file

This will give you the keyword groups as well as the operator definitions etc.
4597.attach


The actual highlighting style is a rather subjective thing - fell free to adapt it to your personal preference via the Styler buttons.

Documentation for the udl can be found here:
https://ivan-radic.github.io/udl-documentation/

________________________________________
2) auto completion
Since it’s hard to memorize all the parameter names etc., we defined an auto completion file which contains the parameters as well as the symbols, functions etc.
Installation is done by simply copying the file ‘iMOTION Script.xml’ into the subfolder ‘autoCompletion’ in the npp installation (program) directory.
This requires admin rights.

Auto completion is enabled and configured in the preferences.
Depending on the setting npp will make suggestions right while typing or after hitting STRG+SPACE.
4598.attach


For functions on entering the opening bracket there is a short description plus the parameter list, which will be highlighted while typing.

________________________________________
3) script compilation
npp provides run commands that can be used to run the iMOTION script compiler.
Since the compiler call requires the specific type, we had to define individual compile commands for them:
- IMC101T compile
- IMC102T compile
etc

The command line we use for the actual call looks like this: (be aware of the quotation marks!)
cmd /c ""%MCEScript21%\iMotion_Script.exe" "$(FULL_CURRENT_PATH)" "$(CURRENT_DIRECTORY)\$(NAME_PART).ldf" "$(CURRENT_DIRECTORY)\$(NAME_PART).map" "IMC101T" & "$(NPP_FULL_FILE_PATH)" "$(CURRENT_DIRECTORY)\$(NAME_PART).ldf""

This opens a cmd window, calls the script compiler in the MCEWizard directory which generates *.map and *.ldf.
The resulting *.ldf is then opened showing the success or any potential errors very similar to the usage of MCEWizard.

Definition of these run commands is done as follows:
- click on Run => Run

- copy the command line into the window (correct the specific type if needed)
4601.attach

- click save and give it a name
- the new run commands will show up in the run menu
4602.attach

These commands are stored in the file ‘shortcuts.xml’ in the folder ‘%appdata%/Notepad++’.
Since npp overwrites the file on closing, it is not possible to edit it with npp itself, but with another test editor.

Further documentation for the auto completion can be found here:
https://npp-user-manual.org/docs/auto-completion/

________________________________________
0 Likes
0 Replies