Abstract:
This document provides a description of configuring and using the Debugging Output option in Crimson 3.1.
Products:
CR Series HMI / Graphite® HMI / DA Series Data Station
Use Case:
Debugging programming in Crimson 3.1.
Required Software:
Crimson® 3.1 Build 3111.000 or later
Introduction
Diagnosing programs with Crimson used to require using tags within programs to determine their status. As of build 3111.00, Crimson 3.1 offers a debugging output to aid in finding problems. Care should be taken in its use, as too much debugging output can slow the system.
The debug output can be monitored using one of the drivers (serial or Ethernet) or by enabling the Web Server's System Pages and Debug Console, which are found on the Features tab of the Web Server section.
Each line starts with a timestamp in seconds and millisecond, followed by the name of the task that is executing the code. (This will typically be USER but can be SCANNER for triggers or DISPATCH for programs run in the background.) The balance of the line shows the action that was carried out, with indentation being used to show nested program calls. The very first line shows the action that set the whole chain in motion, this being an On Press action on an image button located on Page1. You will notice that the action has two parameters, these being the x and y coordinates of the touch event that triggered the button. Subsequent function calls also include any parameters, plus, if appropriate the return value.
081.775 : USER : Pages.Page1.BevelButton1.Action.Press(px = 60, py = 58)
081.775 : USER : Program1(void)
081.775 : USER : Program1(void)
081.775 : USER : Random(100)
081.775 : USER : temp := 47
081.775 : USER : i := 0
081.775 : USER : Beep(30, 500)
081.775 : USER : Tag1 := 47
081.775 : USER : i := 0
081.775 : USER : Tag2 := 0
081.775 : USER : i := 1
081.775 : USER : Tag2 := 1
081.775 : USER : i := 2
081.775 : USER : Tag2 := 2
081.775 : USER : i := 3
081.775 : USER : Tag2 := 3
081.775 : USER : i := 4
081.775 : USER : Tag2 := 4
081.775 : USER : i := 5
081.775 : USER : Tag2 := 5
081.775 : USER : i := 6
081.775 : USER : Tag2 := 6
081.775 : USER : i := 7
081.775 : USER : Tag2 := 7
081.775 : USER : i := 8
081.775 : USER : Tag2 := 8
081.775 : USER : i := 9
081.775 : USER : Tag2 := 9
081.775 : USER : i := 10
081.775 : USER : Program2(void)
081.775 : USER : Program3(void)
081.775 : USER : Tag1 := 91
081.775 : USER : LogSave(void)
081.775 : USER : return
081.775 : USER : return
The examples used in this Tech Note are from the simple database that is attached (link at the bottom) to this article.
Usage
While this is a very helpful feature, care should be taken in its use. It is not intended for use in a completed final application, but only for debugging during configuration. It should thus be turned off when the unit is put into service.
Debug Console Communication Driver
In the Communications category in Crimson 3.1+ select the desired Ethernet or serial port then click on the Driver Selection Pick… button.
Select <System> Manufacturer and Debug Console driver as shown above.
In the case of the serial driver select the desired Port Settings to be matched in the terminal emulator.
When using the Ethernet port set the TCP/IP port and Terminal Mode to appropriate settings for the terminal emulator being used.
Web Server Debug Console
In the Crimson 3.1 Web Server, enable the Debug Console after enabling the System Pages in the Features tab as shown below.
Alerts in Debug Console
Alert 2.46 indicates a fatal alert of an unknown certificate.
Enabling Debug Output for Services and Cloud Connectors
1. Click on the Connector to debug.
2. Click on the Network Tab.
3. Set the Debug Output to Enabled.
Enabling the Programming Debugging Output
1. Open the Crimson database loaded into the unit.
2. Navigate to the Programs section.
3. Click on Programs at the top of the Navigation Pane.
4. Set Enable Debug to Yes.
5. Set the other options as needed:
Debug Programs: Indicate whether trace output should be provided for the execution of programs that have their Enable Debugging option set to Default. This setting can be overridden for each program in the database.
Debug Actions: Indicate whether trace output should be provided for actions triggered by the user interface, tag data changes, etc. Enabling this setting will produce more output, but will allow you to see the cause of each action in your database.
Debug Expressions: Indicate whether trace output should be provided for expression evaluation. Enabling this setting will produce voluminous output as Crimson uses expressions for everything, including, for example, the colors of items displayed on the user interface.
Trace Options: Indicate which items should be included in the trace output.
Entry and Exit: Indicates when a program is entered (by the program name and arguments) and exited (return). If a program calls another program, the call will be indented, as shown in the second code block below.
Crimson 3.1 Debug Console
Time is 06/26/19 16:32:30
587.890 : USER : Program1(void)
587.890 : USER : return
132.200 : USER : Program1(void)
132.200 : USER : Program2(void)
132.200 : USER : return
132.200 : USER : return
Local Assignments: Outputs a trace for each local variable assignment within a program. Assignments made in subroutines are indented.
441.845 : USER : temp := 37
441.845 : USER : i := 0
441.845 : USER : i := 0
441.845 : USER : i := 1
441.845 : USER : i := 2
441.845 : USER : i := 3
441.845 : USER : i := 4
441.845 : USER : i := 5
441.845 : USER : i := 6
441.845 : USER : i := 7
441.845 : USER : i := 8
441.845 : USER : i := 9
441.845 : USER : i := 10
Tag Assignments: Outputs a trace for each tag assignment within a program. Assignments made in subroutines are indented.
849.400 : USER : Tag1 := 43
849.400 : USER : Tag2 := 0
849.400 : USER : Tag2 := 1
849.400 : USER : Tag2 := 2
849.400 : USER : Tag2 := 3
849.400 : USER : Tag2 := 4
849.400 : USER : Tag2 := 5
849.400 : USER : Tag2 := 6
849.400 : USER : Tag2 := 7
849.400 : USER : Tag2 := 8
849.400 : USER : Tag2 := 9
849.400 : USER : Tag1 := 9
Functions Calls: Outputs a trace of function calls. Calls made from subroutines are indented.
074.825 : USER : Beep(30, 500)
Passive Calls: Outputs a trace of passive function calls. Calls made from subroutines are indented. Function Calls MUST be enabled for this to provide a trace.
395.620 : USER : Beep(30, 500)
395.620 : USER : LogSave(void)
Program Calls: Outputs a trace of program calls. Calls made from subroutines are indented. Function Calls MUST be enabled for this to provide a trace.
395.620 : USER : Beep(30, 500)
395.620 : USER : Program2(void)
Disclaimer
It is the customer's responsibility to review the advice provided herein and its applicability to the system. Red Lion makes no representation about specific knowledge of the customer's system or the specific performance of the system. Red Lion is not responsible for any damage to equipment or connected systems. The use of this document is at your own risk. Red Lion standard product warranty applies.
Red Lion Technical Support
If you have any questions or trouble contact Red Lion Technical Support by clicking here or calling 1-877-432-9908.
For more information: http://www.redlion.net/support/policies-statements/warranty-statement