The MPLAB® Data Visualizer is a program used to process and visualize data from a
running embedded target. The program may be accessed as an MPLAB X IDE plugin or a
stand-alone program. In this assignment, the Data Visualizer will be configured
to graph the input and output of OP0 received over USART. The configuration is done
through a saved workspace, and the basics of how to display the data are explained. To
find out how to set up your own workspace, a detailed guide can be found by clicking on
the Documentation button in MPLAB Data Visualizer.
Todo: Configure MPLAB Data Visualizer to graph received OP0 input and output
samples.
Open the program and plug in an
already flashed device. Make sure the COM-port used for USART communication is not
already in use. The start screen will be similar to Figure 5-2.
Figure 5-2. Assignment 3: MPLAB®
Data Visualizer Starting Page
Load the workspace. Press the Load
Workspace button and add the workspace-file called Assignment3.json.
All the workspaces for this training can be found in
DataVisualizer. Two axes appear in the graph. These can be
configured on the panel on the right-hand side, as illustrated in Figure 5-3.
Figure 5-3. Assignment 3: Data
Visualizer Loaded Work Space
Choose the COM-port on the left-hand
side panel seen in Figure 5-3 to plot the data.
Make sure the Baud Rate is 115200 and press the Apply button to
set the baud rate. Press the Play button next to the COM field shown in Figure 2. Press the
Variable Streamers button to connect the decoder to the USART data
stream. Set the COM port as input to Decoder 1, as shown in Figure 3.
Figure 5-4. Assignment 3: Variable
Streamers
Press Show Live Data to start
plotting live data from the device.
Result: The
data streamed to the PC over USART are plotted in the MPLAB® Data Visualizer, as
shown in Figure 4. The
red waveform is the output from the DAC, while the green is the output from the op amp.
As expected, we can see that the output of the op amp closely follows the input to the
op amp. Figure 5-5. Assignment 3: Result
Info: The DAC outputs a 50 Hz sinusoidal wave with 256 mVpp and 256 mV DC
offset. The sinusoidal wave is pre-calculated at startup in the
sine_wave_table_init() function, and DAC updated with values upon TCB0 ISR
(SINE_WAVE_TIMER_vect).