Serial communication via Matlab protocol

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

      

I am using usb Tms570ls20216. On the board I have a bootloader. When I send b to the board, it will start flashing the boards after taking the abs file. It works correctly in hyperterminal, but it doesn't blink when working in Matlab. I am new to Matlab. There is something wrong in my code. I don't know if this is the right question to ask. Sorry if this is not the case.

+3


source to share


1 answer


Do you need to send a line at the end of your command b

? Like this:



fprintf(SerPIC, 'b\n');  %add line feed, no need for %s from the original code

      

0


source







All Articles