2012-04-03 19 views
3
SerPIC = serial('COM10'); 
set(SerPIC,'BaudRate', 115200, 'DataBits', 8, 'Parity', 'none','StopBits', 1, 'FlowControl', 'software'); 
fopen(SerPIC); %--open the serial port to the PIC 
fprintf(SerPIC, '%s', 'b'); 
fid = fopen('D:\pipt1.abs'); 
tline = fgets(fid); 
while ischar(tline) 
    fprintf(SerPIC, '%s',tline) 
    tline = fgets(fid); 
end 
fclose(fid); 
fclose(SerPIC) %--close the serial port when done 
delete(SerPIC) 
clear SerPIC 

私はTms570ls20216 usbを使用しています。ボードにはブートローダがあります。ボードにbを送ると、absファイルを取った後にボードが点滅します。そのハイパーターミナルでは正常に動作しますが、matlabで動作している間は点滅しません。私はmatlabに新しいです。私のコードに何か間違っていますか?私はこれが質問をするのに適切な場所かどうかはわかりません。もしそうでなければ、申し訳ありません。matlabシリアル通信

答えて

0

bコマンドの最後に改行を送信する必要がありますか?このように:

fprintf(SerPIC, 'b\n'); %add line feed, no need for %s from the original code 
関連する問題