7 Appendix A: Plotting Graph in Data Visualizer

Note: For detailed information on Data Visualizer, refer to the Data Visualizer User's Guide.

In the example source code, the ADC result value is sent through USART to the serial terminal of the Data Visualizer and this serial terminal data is fed as input to plot the graph.

The data streamer protocol is used to send the ADC result to serial terminal.

How to use data streamer protocol to send 16-bit value:

The ADC has been configured for 10 bits and this 10-bit ADC result needs to be sent to an 8-bit USART. As one ADC result value will be sent as two bytes, a data streamer protocol has been used to send the ADC result to a serial terminal as below, so that one 16-bit value will be used to plot the graph.

USART_0_write(0x03);  //START
USART_0_write(adc_data_LSB);
USART_0_write(adc_data_MSB);
USART_0_write(0xFC); //END

Data Visualizer Configuration:

  • Open Atmel Studio → Tools → Data Visualizer.
  • In Data Visualizer, open Configuration → External Connection → Serial Port.
  • Select the EDBG Virtual COM port, and then select Connect.
  • Open Configuration → Visualization → Data Streamer.
  • In Data Stream Control Panel, under Configuration, browse to the configuration .txt file and then select Load.
    Note: The .txt file to be loaded in for Data Streamer has configuration: D, 1, 1, ADC0.
    Note: For more details on Data Streamer, refer to the Data Visualizer User's Guide-Data Stream Protocol.
  • Open Configuration → Visualization → Graph.
  • Drag the connections as shown with red arrows in Figure 7-1 to plot the graph.
Figure 7-1. Graph Plotting

To adjust the Y-axis in the graph, follow the points below:

  • Under Configuration in Graph, deselect Automatically Fit Y.
  • Click somewhere inside the plot area.
  • Scroll the mouse-wheel while pressing or holding the Ctrl key.
Note: For more details on Data Visualizer → Graph, refer to the Data Visualizer User's Guide-Graph.