日本語
English
Steps for FFT Analysis of Analog Input and Graph Display (5/5)
Procedure
- Step 10: Create a CSV File
- 10-1. Output a file with FilePut
- 10-2. Add a periodic task
- 10-3. Program assignment settings
- Step 11: Acquire Data
- 11-1. Sample analog data
- Step 12: Open in Excel
- 12-1. Copy the file from the SD card to the PC
Step 10: Create a CSV File
10-1. Output a file with FilePut
Add a new program to create the test file
Line 0: turning the CsvWrite flag ON starts the program that creates the CSV file
Line 1: put a title row in the first line and calculate the resolution (Resolution)
Line 0: turning the CsvWrite flag ON starts the program that creates the CSV file
Line 1: put a title row in the first line and calculate the resolution (Resolution)
Line 4:
The string to write is stored in WriteStr
Two columns, frequency and power spectrum, are written to the file
A String is limited to a maximum of 1986 bytes, so assuming roughly 100 lines fit, writing is repeated every 100 lines, and writing ends after 2048 lines
The string to write is stored in WriteStr
Two columns, frequency and power spectrum, are written to the file
A String is limited to a maximum of 1986 bytes, so assuming roughly 100 lines fit, writing is repeated every 100 lines, and writing ends after 2048 lines
10-2. Add a periodic task
Creating the write data lengthens the scan time, so create a separate task to run it
Add a periodic task (priority 17)
Add a periodic task (priority 17)
10-3. Program assignment settings
Assign the file creation program to the task added in 10-2
Step 11: Acquire Data
11-1. Sample analog data
Turn FFTStart ON to sample analog data
The graph of the sampled and FFT-calculated data looks like this
Turn the CsvWrite flag ON to write this FFT data to a CSV file
The CSV file is created on the SD card with the file name 'PowerSpectrum.csv'
The graph of the sampled and FFT-calculated data looks like this
Turn the CsvWrite flag ON to write this FFT data to a CSV file
The CSV file is created on the SD card with the file name 'PowerSpectrum.csv'
Step 12: Open in Excel
12-1. Copy the file from the SD card to the PC
Copy the CSV file of the acquired data to the PC and open it in Excel
The CSV file acquired above is here → PowerSpectrum.csv
The CSV file acquired above is here → PowerSpectrum.csv
This completes the FFT procedure
Adjust the sampling frequency, number of data points, filters and so on to focus on the data you want
