Launch MATLAB graphical interface for interactive UART communication
Overview
The picgui block provides a convenient launcher for the MATLAB-based graphical user interface that enables interactive UART communication with Microchip devices. This GUI tool allows you to send and receive UART data interactively during development and debugging.
Block Dialog
The picgui block itself has an empty Simulink mask โ double-clicking it launches the MATLAB GUI shown below. Three illustrations, from most didactic to most realistic:
picgui interface โ annotated controls
Every control in the picgui window is labelled on this diagram โ connection settings (top-left), data-logging (Log.txt / Ren / Load / Delete), the M-script executed at each iteration, the Start / Stop receiver, and the idle-time (Delay) between UART reads. A companion MATLAB figure (bottom) shows the resulting real-time plot.
Real-time plot window
Data received over UART can be passed through a user-supplied MATLAB script (executed once per iteration) and plotted live. This example shows an original signal plus two low-pass-filtered versions at 1 Hz and 10 Hz:
Motor-control dashboard (real application)
When paired with a dsPIC33CK / dsPIC33AK motor-control firmware that streams measurements via the UART Tx-Matlab block, picgui becomes a live dashboard. Running at 2 000 rpm no-load, six panels show phase currents Iโ/I_b, speed reference vs. estimate, FFT on Iโ, d-q axes currents, and the E_d / E_q back-EMF decomposition:
When to use:
Real-time plotting โ Visualize signals from UART TxMatlab block
Interactive testing โ Send commands and view responses during development
Data logging โ Record UART communication to MATLAB workspace
Parameter tuning โ Adjust device parameters via UART interface
Quick debugging โ Monitor/send UART data without full External Mode setup
When NOT to use:
No UART TxMatlab โ picgui is designed for UART TxMatlab protocol (not raw UART)
The picgui works in conjunction with the UART Tx-Matlab block:
Add UART Tx-Matlab block to your model
Configure UART settings (baud rate, parity, etc.)
Launch picgui interface
Data sent via picgui is automatically handled by UART Tx-Matlab block
Received data appears in picgui receive window
Notes
Empty S-Function Block
The picgui block uses MCHP_EmptySFunction as its S-Function. This means:
Block has no effect during simulation
Block is not included in generated code
Block serves only as GUI launcher
MATLAB Dependency
The picgui GUI requires:
MATLAB environment (cannot run standalone)
Instrument Control Toolbox or similar for serial communication
Compatible USB-to-Serial driver for hardware connection
Real-Time vs External Mode
The picgui interface is primarily designed for:
External Mode: Interactive communication with running firmware
PIL Testing: Processor-In-Loop testing workflows
Standalone Operation: Direct serial communication outside Simulink
It is not designed for use during:
Normal Simulink simulation
Code generation compilation
Model verification tests
COM Port Configuration
Ensure your hardware is properly connected:
USB-to-Serial adapter or debugger connected
Correct COM port identified in Device Manager (Windows) or /dev (Linux)
No other application using the COM port
Appropriate driver installed
Device Support
Universal Support: The picgui interface works with all Microchip device families that support UART communication:
dsPIC30F/33F/33E/33C/33A
PIC24F/H
PIC32 (all variants)
SAM ARM devices
Examples
Basic Interactive Communication
% 1. Configure model with UART blocks% 2. Add picgui block to model% 3. Double-click picgui block% 4. In picgui GUI:% - Select COM port% - Set baud rate to match device% - Type command in send field% - Click Send button% - View response in receive window
Sending MATLAB Variables
% Create data in MATLAB workspacemyData =[12345];% In picgui:% 1. Select "Workspace Variable" option% 2. Enter variable name: myData% 3. Click Send% Variable contents are transmitted via UART
Automated Test Script
% Open picgui programmaticallypicgui;% Configure port (example - implementation depends on GUI)% Send test sequence% Capture responses% Validate communication