Prev: Changing mask parameters from a m-function
Next: why mvnrnd works with a singular covariance matrix
From: Matthew on 11 May 2010 13:08 Hello, My serial device uses 253 (0xFD) as a terminator, and MATLAB throws an error saying that it must be from 0 to 127 (0x7F) when I use set(mySerialObj, 'terminator', 253). Does anyone know how to work around this? Thanks Matthew
From: Ankit Desai on 12 May 2010 09:34 "Matthew " <mahughes(a)ryerson.ca> wrote in message <hsc2tk$htb$1(a)fred.mathworks.com>... > Hello, > My serial device uses 253 (0xFD) as a terminator, and MATLAB throws an error saying that it must be from 0 to 127 (0x7F) when I use set(mySerialObj, 'terminator', 253). Does anyone know how to work around this? > Thanks > Matthew Hi Matthew, Setting terminator > 127 is not supported by MATLAB Serial Port and Instrument Control Toolbox. You can work around the issue by using fread. However it can be really complicated/tricky. Commands like fscanf read data from inputbuffer until a terminator is reached. Similarly fprintf will append terminator to the data that is sent to the outputbuffer. To bypass the terminator usage you can use fread and fwrite. You can have each fwrite append 253 at the end of each write. As for read, you can read the data in the buffer and break down data into pieces by searching for 253. Breaking, combining, discarding of raw data can get quite tricky. Hope this helps, -Ankit
|
Pages: 1 Prev: Changing mask parameters from a m-function Next: why mvnrnd works with a singular covariance matrix |