This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
你好,我嘗試做一個簡單的PWM的程式,希望透過修改Expressions中變數的值就可以即時改變PWM的DUTY,但是實際上我在修改Expressions的變數值後DUTY並不會改變,想請問我是哪部分程式出錯
main.c檔
board.c檔
board.h檔
執行結果
我在Expression中修改Dutyset值,但ccv值都沒有改變
是的,所有程序按顺序只会执行一次。
你可以在main函数的最后写一个while(1)循环,这样就构成了一个前后台程序结构。将初始化等只需要执行一次的代码放到while(1)之外;将需要不停执行的代码放到循环内,比如改变PWM参数等操作。