PWM and serial communication
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi,
i wish to communicate with mcu ATmega128 with PWM. I used to program the PWM pulse by setting the timer 0 and the mcu PWM port.
In Matlab, may i know how the PWM is generated, after i had the serial communication with the mcu code:
s=serial('COM6');
fopen(s);
fwrite(s,170,'unit8');
fwrite(s,170,'unit8');
fwrite(s,85,'unit8');
fwrite(s,85,'unit8');
fwrite(s,value,'unit8');
fwrite(s,value,'unit8');
fclose(s);
delete(s);
Besides, there's 1 more problem when I'm using fscanf(s,'*IDN?'), it show empty array and timer out because it can't reach the terminator. Is there any wrong in my code? Thanks. Your help is much appreciate.
댓글 수: 0
답변 (0개)
커뮤니티
더 많은 답변 보기: Power Electronics Community
참고 항목
카테고리
Help Center 및 File Exchange에서 Arduino Hardware에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!