How to use the virtual oscilloscope in Keil5 for software simulation

First of all, open a project, compile it, and there is no error. I use the advanced timer TIM1 complementary output program, and the output signal pins are PA8 and PB13 respectively. Change some configurations
before using : Click the magic wand option in keil5: select debug, tick the use silmlator circled in the upper circle, and then change the second circle according to your actual needs (I Use CM3, F103ZET6, if you use F103RC, change ZE to RC), as shown in the figure below: After changing the configuration, click the debug button above, and then click the virtual oscilloscope button here to enter the software simulation interface and click setup here Enter the configuration interface, click the box on the upper right to add the GPIO pin number to be detected and output (I use PA8 here, the input format is: GPIOX_IDR.n), and then press Enter to confirm. Select bit (bit) in display type , and then click close to close the window. (If there is an error message like unknown signal here, it means that the things configured in the magic wand in the first step are not configured properly, just reconfigure) Then click the full -speed run button in the upper left corner , and you can see the output of the waveform. The following is the effect after I add the pin PB13 which is the complementary output of PA8. finished .



insert image description here

insert image description here

insert image description here


insert image description here

insert image description here

insert image description here

///Replenish:

How to view the period and frequency of the output PWM in this virtual environment:
After running the output waveform at full speed, use the mouse wheel to change the size of the PWM wave to a suitable size, and randomly select a position of the waveform (it is recommended to choose the endpoint), and time 1 will appear at the bottom of the graph. Then put the mouse at the end of a pwm, time 2 will appear, cycle = time 2-time 1, and the frequency can be calculated from this cycle. If you choose two pwm waves, just divide the result/2.
The duty cycle can also be calculated similarly, only need to calculate the high level (low level) time, and then divide by the period.
As shown in the figure below:
insert image description here
Note:
The output frequency calculated by this method is the actual output frequency, which may be different from the value set in the program due to errors in the software program. If the frequency is set to 10KHZ in the program, the actual output may only be 9KHZ. But this result is consistent with the actual measurement with an oscilloscope.

Guess you like

Origin blog.csdn.net/weixin_43737995/article/details/98049869