[K230 Embedded AI Development Board Review] +RTC Timing and File Reading and Writing Applications
[Copy link]
RTC timing and file reading and writing functions are important in subsequent AI recognition applications, so the two are studied and tested together.
Before introducing this aspect, let me first talk about an interesting phenomenon. After burning the image, the K230 development board will store two directories in the virtual U disk. The contents are as follows:
Among them, some corresponding Python routines will be stored in the app directory, and can be called and run in CanMV IDE.
Figure 1 Virtual disk routine
Taking the RTC routine as an example, its operation process is shown in Figures 2 and 3.
Figure 2 Reading routine
Figure 3 Test routine
Through this test, we can find that the RTC data here is used in the form of an array.
When a loop structure is added, the RTC timing value can be dynamically output through the coordination of the delay function, as shown in Figures 4 and 5.
Figure 4 Program content
Figure 5: Operation effect
From the output results, we can find that the output format of the data is quite different from our daily format. So how can we transform it into the daily format?
As mentioned before, the RTC data is organized in an array, so different time values can be read through different array subscripts.
Through the program shown in Figure 6, we can get the output form we need.
Figure 6 Procedure and effect
In this way, time management and record keeping will meet actual needs and requirements.
The K230 development board also provides file reading and writing functions, and saves files to the SD card.
The program and running results for realizing the file reading and writing functions are shown in Figures 7 and 8.
Figure 7 Procedure and effect
Figure 8 File and content
However, when reading and writing multiple lines, the reading and writing program needs to be modified to the content shown in Figure 9.
Figure 9 Read and write by row
If the collected data is to be recorded in a file, the RTC function must be coordinated. The procedure for recording data marks is shown in FIG10 , and the recorded data content is shown in FIG11 .
Figure 10 Recording procedure
Figure 11 Record content
In this way, we have the function of recording and saving detection data on the K230 development board, which will later serve the corresponding AI vision applications.
|