Task Code Editor Panel

Overview

The Sensor Controller task is implemented using the Task Code Programming Language.

All tasks have these task code editor panels:

  • Initialization Code : Runs one time when the System CPU application starts the task
  • Execution Code : Runs one time for each task iteration triggered by the RTC, or when triggered manually by the System CPU application
  • Termination Code : Runs one time when the System CPU application stops the task

Tasks that use event triggers to wake up the Sensor Controller have one or more Event Handler X Code panels, where X is a letter A , B or C . The event trigger indexes that are used in task code are mapped to event handler code letters in the Task Panel .

Editor

The task code editor provides common source code editor functionality:

  • Line wrapping always enabled
  • Left margin with line numbers
  • Syntax highlighting for comments, operators and language keywords
  • Automatic indentation of the current line while typing
  • Automatic indentation of all code when opening a project
  • Standard behavior cut, copy and paste
  • Standard behavior undo and redo

Documentation pops up automatically when typing a procedure call. The pop-up is triggered by typing the ” ( “, ” , ” or ” ; ” in the call, but can also be triggered by pressing Ctrl + Space . The description displayed matches the cursor position in the procedure call.

Code completion displays a list containing language keywords, constants, data structure variables and procedures, with associated documentation on the side. It is possible to disable this feature through a preference setting.

Search and Replace

Use commands in the Edit menu to perform search operations and show the search (and replace) bar:

  • Find… - Ctrl+F : Display the search bar below the text editor
  • Find Previous - Shift+F3 : Find and select previous match in the text editor
  • Find Next - F3 : Find and select next match in the text editor
  • Replace… - Ctrl+H : Display the search and replace bar below the text editor

Search options can be configured in the search bar:

  • Match case - Shall the search be case sensitive?
  • Match whole word - Shall the search match whole words only? (ignored when the search string is not a word)

All matching strings are highlighted in the text editor while the search bar is active.

Replace operations are only available in the search and replace bar:

  • Replace selected match, then find the next match
  • Replace all (highlighted) matches

To close the search bar, press the Close button or the Esc key.

Commenting and Uncommenting Lines

Use commands in the Edit menu to comment and uncomment lines of code:

  • Comment Selected Lines - Ctrl+K : Add // at the start of each selected line
  • Uncomment Selected Lines - Ctrl+Shift+K : Remove // (if present) at the start of each selected line

List Views

Constant List

Displays constants that are available for use in the Sensor Controller task code.

The list contains both user-defined constants (bright, at the top), and constants defined by resources and I/O mapping (dimmed, at the bottom). The user-defined constants are also available to the System CPU application, through the generated SCIF driver.

Use the Constants and Data Structures panel to add, edit and remove constants. There are shortcuts in the task code editor panel’s Constants and Data Structures menu, and in the constant list:

  • To add a new user-defined constant:
    • Use menu command:
      • Add Constant - Alt+N
  • To edit an existing user-defined constant:
    • Double-click on the constant in the list
    • Select a constant in the list, and then use menu command:
      • Edit Selected Constant

To remove a constant, navigate manually to the Constants and Data Structures panel, and click on the action button (three dots) for the constant.

Data Structure List

Displays the data structures used to store global variables. The data structures are available both to Sensor Controller task code and to the System CPU application, through the generated SCIF driver.

The list contains both user-defined data structure members (bright), and constants defined by resources and I/O mapping (dimmed).

Use the Constants and Data Structures panel to add, edit and remove data structure members. There are shortcuts in the task code editor panel’s Constants and Data Structures menu, and in the data structure list:

  • To add a new user-defined data structure member:
    • Double-click on the data structure (for example output ) in the list
    • Use menu commands:
      • Add “cfg” Data Structure Member - Alt+C
      • Add “input” Data Structure Member - Alt+I
      • Add “output” Data Structure Member - Alt+O
      • Add “state” Data Structure Member - Alt+S
  • To edit an existing user-defined data structure member:
    • Double-click on the data structure member in the list
    • Select a data structure member in the list, and then use menu command:
      • Edit Selected Data Structure Member

To remove a data structure member, or move a member to a different data structure, go to the Constants and Data Structures panel, and click on the action button (three dots) for the data structure member.

Procedure List

Displays a list of procedures available for use in the task code. Procedures become available when enabling the associated resource in the Task Panel .

Double-click on the list entries to display documentation in the help document viewer.