Halt Notifier Plugin for the MPLAB® X IDE

Last modified by Microchip on 2024/06/24 06:32

Overview

The Halt Notifier plugin for MPLAB® X IDE (SW100200) provides the ability to be alerted when a target is halted. Notifications can be customized with actions, for example: issuing an audio alert, sending an email, or running a script.

This can be very useful when debugging your code. The plugin can let you know when the debugging has halted (for example, it has reached a breakpoint). It then notifies you so you can take action if needed.

Install and Launch the Halt Notifier Plugin

Open MPLAB X IDE and install the Halt Notifier plugin. For installation instructions, see Install plug-ins supplied by Microchip.

Once the plugin is installed, from the MPLAB X IDE menu bar select Tools > Embedded > Halt Notifier to launch the plugin.

The default is set to “Disable”. You can enable the halt notifications and select any combination of notification methods.

halt notifier window

Halt Notifier Window

Back to Top

Add Halt Notifier Icon to Toolbar

By default, the Halt Notifier icon is not visible. The icon can be added to the toolbar in three ways:

Go to View > Toolbars and check "HaltNotifier". See (1) in Figure 1.

Position the pointer over a movable object’s grabber or splitter (splitter.gif) in the toolbar to change the pointer to MoveCursor.png. Right-click and select "HaltNotifier".

add icon to toolbar

Add Icon an to the Toolbar


Select "Customize" from the bottom of the list of available toolbars - see (2) in Figure 1 - to open the Customize Toolbar dialog - see Figure 2. Locate the icon in the Tools folder labeled “Enable/Disable/Configure Notifications” and drag it to the toolbar.

Using any of the above methods, the Halt Notifier icon icon.gifis added to the toolbar.

customize the toolbars

Customize Toolbars

Back to Top

Enable, Disable, and Configure Notifications

Audio, email, and script notifications can be enabled or disabled through the toolbar icon or the Halt Notifier window. You can toggle the state between enable and disable by clicking the icon. Use the drop-down list to open the Halt Notifier window to configure notifications.

Enable Notifications
Enable Notifications

Disable Notifications

Disable Notifications

Configure Notifications

Configure Notifications

Back to Top

Customize Audio Notification

To configure audio settings, check Audio Notification in the Halt Notifier window and click Settings

Audio Notification Settings

Audio Notification Settings

In the Audio Settings window, the default audio alert is the beep sound. You can change the alert to an audio file, browse for the file, and specify the duration in seconds. Click OK when done. When a breakpoint is encountered in MPLAB X IDE, an audio file is played.

audio setting window

Audio Settings Window

Back to Top

Customize Email Notification

To configure email settings, check “Email Notification” in the Halt Notifier window and click Settings.

email notification settings

Email Notification Settings

The Email Settings window opens.

  • Email ID: In the “Email ID” fields for the Sender’s Address and Recipient’s Address, type the appropriate email addresses (for example, Gmail, Yahoo, Outlook, etc.). Multiple recipients’ addresses can be entered by separating them with a comma (,).
  • Password: Type your email account password in the “Password” field.
  • Port: SMTP servers normally use port 25, but there are other options. For example, port 587 is supported by most outgoing SMTP servers and it is useful for unencrypted or TLS connections. Port 465 is good for connecting via SSL.
  • Authentication: Check if authentication is required.
  • Connection Security: The standard SMTP email transfer goes without encryption. To secure it, use STARTTLS or SSL/TLS.
  • SMTP Server: In this field, select or type the name of your email server or one provided by your Internet Service Provider. The following are the most popular server names. If yours is not listed, contact your email provider.
ProviderURLSMTP
1&11and1.comsmtp.1and1.com
airmailairmail.netmail.airmail.net
aolaol.comsmtp.aol.com
at&tatt.netoutbound.att.net
bluewinbluewin.chsmtpauths.bluewin.ch
bt connectbtconnect.commail.btconnect.tom
comcastcomcast.netsmtp.comcast.net
earthlinkearthlink.netsmtpauth.earthlink.net
gmailgmail.comsmtp.gmail.com
gmxgmx.netmail.gmx.net
hotpophotpop.commail.hotpop.com
liberolibero.itmail.libero.it
lycoslycos.comsmtp.lycos.com
o2o2.comsmtp.o2.com
orangeorange.netsmtp.orange.net
outlook.com (formerly hotmail)outlook.comsmtp.live.com
tintin.itmail.tin.it
tiscalitiscali.co.uksmtp.tiscali.co.uk
verizonverizon.netoutgoing.verizon.net
virginvirgin.netsmtp.virgin.net
wanadoowanadoo.frsmtp.wanadoo.fr
yahooyahoo.commail.yahoo.com
 
email settings window

Email Settings Window

Click OK when done.

When a breakpoint is encountered in MPLABX IDE, an email is sent to the recipient’s address. The email contains information about the Project name, Project directory, Debug directory, and the reason for the halt. 

sample email

Sample Email

Back to Top

Customize Script Notification

To configure the script settings select “Script Notification” in the Halt Notifier window and click Settings.

script notification setting

Script Notification Settings

In the Script Settings window, you select the script file you want to execute when a halt occurs. The window also shows a list of default scripting languages that are supported. You can add or remove any scripting language or reset the list to the default scripting languages.

Script settings window

Script Settings Window

Back to Top

Select a Script File

To use Script Notification, you must select a script file in the Script Settings window.

To choose a script file,

click Browse.

The script file language should be within the list of scripting languages in the Script Settings window. If it does not match, add the scripting language (see Add a Scripting Language) to the list and then select the script file.

select a script

Select Script File

When MPLAB X IDE encounters a breakpoint, the selected script is executed and the output of the script file, if any, will be directed to the MPLAB X IDE output window. The Project name, Project directory, Debug directory, and reason for halt information will be passed as an argument along with the script (see example below).

A script can contain whatever actions you want to take place when a halt occurs. One example is sending a text message. See the next two topics on how to send a text message using WhatsApp and Twitter.

Example: Python script to send a text message via Verizon 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
"""
python textmsg.py "project_name,project_dir,debug_dir,halt_reason"
 
"""


import smtplib
import sys

username = "account@gmail.com"
password = "password"
vtext = "1112223333@vtext.com"

my_string = sys.argv[1]
my_list = my_string.split(",")
for i in range(len(my_list)):
    str1 = my_list[0]
    str2 = my_list[1]
    str3 = my_list[2]
    str4 = my_list[3]

message = {"Project " + str1
           + "\nProject Directory " + str2
           + "\nDebug Directory " + str3
           + "\nHalt Reason " + str4}

msg = """From %s
To: 
%s
Subject: text-message
%s""" % (username, vtext, message)

server = smtplib.SMTP('smtp.gmail.com',587)
server.starttls
server.login(username,password)
server.sendmail(username,vtext,msg)
server.quit()

Back to Top

Send a Text Message Using Yowsup and WhatsApp Messenger

Yowsup is a Python library that lets you use the WhatsApp service. It allows you to log in and provides you with all the capabilities of an official Whatsapp client. You can create a full-fledged custom Whatsapp client.

Back to Top

Send a Text Message Using Twitter

There are several Twitter APIs available for sending messages. All of Twitter’s APIs are based on the HTTP protocol. Any software you write that uses Twitter’s APIs sends a series of structured messages to Twitter’s servers.

There are many scripting languages supported by Twitter and can be seen in Twitter Tools and Libraries.

Back to Top

Add a Scripting Language

To add a scripting language, click Add. A new row is created within the list.

Double-click in each empty field (do not use the <TAB> key) and type in the appropriate Display Name, Executable, and Extension. When done, press the <ENTER> key. Then, you can select a script file.

add a scripting language

Add a Scripting Language

Back to Top

Delete a Scripting Language

To delete a scripting language from the list, click anywhere in the row to be deleted and click Delete. See Figure 5. Default scripting languages cannot be deleted.

delete a scripting language

Delete a Scripting Language

Back to Top

Reset the Language List

To return the scripting language list to the default settings,

click Reset

scripting language list before reset

Scripting Language List BEFORE Reset

List of scripting languages after rest

Scripting Language List AFTER Reset

Back to Top

Close the Halt Notifier Window

When you are finished configuring the settings (see Enable, Disable, and Configure Notifications)

Click OK to close the Halt Notifier Settings window.

You can enable/disable or configure notifications via the toolbar icon (see Add Halt Notifier Icon to Toolbar).

Back to Top