0

I have been trying to get the ultrasonic data from an arduino using serial communication toolbox in scilab to be brought in the xcos simulation. To do this I followed Include a Scilab function/script as a block in xcos/scicos and created my own function. Is there a way to plot the serialread data in xcos scope? or i think my implementation is wrong in the scilab function. Iam Using Windows 10 64bit

SCILAB function

function y = serialREAD(a)
    h = openserial(7, "9600,n,8,1") // open COM7
    for ii = 1:a
        y = strtod(part(readserialline(h), [1,2,3])) * (a/a)
    end
    closeserial(h)

endfunction

endfunction

XCOS block diagram

enter image description here

The ERROR [ This error has been solved converted the string to a double using the strtod ]

enter image description here

The Data in CMscope but not in realtime only after the simulation my final integration time is 100.

enter image description here

  • please study [this post](https://stackoverflow.com/a/54960839/4999991) thoroughly. And please mention the operating system you are using. – Foad S. Farimani Mar 07 '19 at 10:08
  • Studying the post and other few things I have successfully plotted the data in xcos but the problem is it is not in real time only after the simulation. I have Edited my function and will add a screenshot of the results –  Mar 07 '19 at 14:12
  • would you share files? on github gists for example. – Foad S. Farimani Mar 07 '19 at 14:56
  • absolutely here is the github link https://github.com/mentablack/XCOS-SerialREAD-Block.git –  Mar 08 '19 at 00:10
  • I'm working on this issue because it is also required for my own research. I am trying to implement MATLAB's serial functionality in for Scilab. the latest developments can be seen in [this gist](https://gist.github.com/Foadsf/44fe9b5e2bcb02b22392adf6d8f7a871). feel free to study it and leave comments over there if you have questions. – Foad S. Farimani Mar 09 '19 at 11:38
  • Ok thanks for the resources . I'll try first by using the FROMWORKSPACE BLOCK to get the data from the serialread line to xcos –  Mar 10 '19 at 11:22

0 Answers0