How can I use PORTMON to monitor my serial port?

179 views (last 30 days)
I can communicate with my device through Hyperterminal but not through MATLAB. I would like to use a serial port monitor to determine the precise bits that are sent to my device so that I can ensure I have configured my MATLAB serial port object correctly. Therefore, I would like a brief guideline on using PORTMON.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 18 Apr 2023
Edited: MathWorks Support Team on 19 Apr 2023
First, download and install PORTMON (version 3.02 or earlier):
To use PORTMON, follow these steps:
1. Start by ensuring that the application with which you are communicating with the serial port (MATLAB, HYPERTERMINAL etc.) is not open.
2. Start portmon by invoking portmon.exe from its installation folder.
3. Select Computer -> Connect Local, since we want to monitor communication between an application installed on our local system and the SERIAL port.
4. Next, go to Edit -> Max Output Bytes..., and change the default (64) to a value that accomodates the amount of data expected to be written or read.
5. Go to Edit -> Filter/Highlight..., change the default settings to the following values, and click APPLY:
Include: *
Exclude: IOCTL_SERIAL_GET*;IRP_MJ_C*
Highlight: IRP_MJ_WRITE;IRP_MJ_READ
6. Under the Options menu, ensure that the item: Show Hex is selected, this way you will be able to observe even the non-printing characters (Line feed, horizontal tab, carraige return etc.) that are exchanged over the serial port.
7. Go to Capture -> Ports, and ensure that the serial port that is to be observed, is checkmarked. If not, select the port.
8. Select, Capture -> Capture Events
9. Now start your application of interest i.e. MATLAB or hyperterminal or any other application. This is the application whose serial port communication we want to monitor.
NOTE: It is very critical that you open the SERIAL port client (MATLAB / HYPERTERMINAL) AFTER selecting the Capture Events option in PORTMON, and the correct port under the Capture -> Ports menu. Otherwise, you may receive an error from PORTMON that the SERIAL port is already in use.
Once you have followed these instructions, you should be able to issue commands in an application such as MATLAB or Hyperterminal and see the exact bits that are sent to and received from the device.

More Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!