diff --git a/macros/readbyteserial b/macros/readbyteserial new file mode 100644 index 0000000..f4784f5 --- /dev/null +++ b/macros/readbyteserial @@ -0,0 +1,8 @@ +function buf=readserial(h,n) +// 12/1/2009: corrected version after report of bug 3829 + if ~exists("n","local") then + N=serialstatus(h); n=N(1) + end + TCL_EvalStr("binary scan [read "+h+" "+string(n)+"] cu* ttybuf") + buf=evstr(TCL_GetVar("ttybuf"));//returns an array of bytes instead of char, useful since scilab does not want to cast strings into matrixes +endfunction