From: Edward on
Hi,
I am looking to send a serial signal through a RS232 serial port on my computer via simulink. Currently I am using the "to instrument" block in the instrument control toolbox however this does not work with real time workshop.

Is there an equivalent block for real time simulations using real time workshop?
From: Jan Houska on
Hi Edward,

Edward wrote:
> I am looking to send a serial signal through a RS232 serial port on my
> computer via simulink. Currently I am using the "to instrument" block in
> the instrument control toolbox however this does not work with real time
> workshop.
>
> Is there an equivalent block for real time simulations using real time
> workshop?

You can try Real-Time Windows Target which has RS232 I/O support. Please
see http://www.mathworks.com/products/rtwt .

Jan


--
Jan Houska HUMUSOFT s.r.o.
houska(a)humusoft.com Pobrezni 20
http://www.humusoft.com 186 00 Praha 8
tel: ++ 420 284 011 730 Czech Republic
fax: ++ 420 284 011 740
From: Edward on
Jan Houska <houska(a)humusoft.com> wrote in message <i367t2$16su$1(a)ns.felk.cvut.cz>...
> Hi Edward,
>
> Edward wrote:
> > I am looking to send a serial signal through a RS232 serial port on my
> > computer via simulink. Currently I am using the "to instrument" block in
> > the instrument control toolbox however this does not work with real time
> > workshop.
> >
> > Is there an equivalent block for real time simulations using real time
> > workshop?
>
> You can try Real-Time Windows Target which has RS232 I/O support. Please
> see http://www.mathworks.com/products/rtwt .
>
> Jan
>
>
> --

Thanks Jan,
I have attempted to build a simple model using real time worshop to send a serial signal.

I am using the "Packet Output" block with the device set as the serial port. All parameters for this are as needed by my device (baud rate etc...)

When i attempt to build it (even with just the Packet output block in the model by itself) i get the following error.
"Error: File: C:\Program Files\MATLAB\R2009b\toolbox\rtw\targets\rtwin\rtwin\rtwinlib.tlc Line: 43 Column: 38
The left-hand side of a . operator must be a valid scope identifier"

This is after choosing a fixed step solver as needed by compiler.

Any ideas what this means? and how i can fix it?

> Jan Houska HUMUSOFT s.r.o.
> houska(a)humusoft.com Pobrezni 20
> http://www.humusoft.com 186 00 Praha 8
> tel: ++ 420 284 011 730 Czech Republic
> fax: ++ 420 284 011 740
From: Edward on
"Edward " <thomson.ed(a)gmail.com> wrote in message <i37r1n$dsn$1(a)fred.mathworks.com>...
> Jan Houska <houska(a)humusoft.com> wrote in message <i367t2$16su$1(a)ns.felk.cvut.cz>...
> > Hi Edward,
> >
> > Edward wrote:
> > > I am looking to send a serial signal through a RS232 serial port on my
> > > computer via simulink. Currently I am using the "to instrument" block in
> > > the instrument control toolbox however this does not work with real time
> > > workshop.
> > >
> > > Is there an equivalent block for real time simulations using real time
> > > workshop?
> >
> > You can try Real-Time Windows Target which has RS232 I/O support. Please
> > see http://www.mathworks.com/products/rtwt .
> >
> > Jan
> >
> >
> > --
>
> Thanks Jan,
> I have attempted to build a simple model using real time worshop to send a serial signal.
>
> I am using the "Packet Output" block with the device set as the serial port. All parameters for this are as needed by my device (baud rate etc...)
>
> When i attempt to build it (even with just the Packet output block in the model by itself) i get the following error.
> "Error: File: C:\Program Files\MATLAB\R2009b\toolbox\rtw\targets\rtwin\rtwin\rtwinlib.tlc Line: 43 Column: 38
> The left-hand side of a . operator must be a valid scope identifier"
>
> This is after choosing a fixed step solver as needed by compiler.
>
> Any ideas what this means? and how i can fix it?
>
> > Jan Houska HUMUSOFT s.r.o.
> > houska(a)humusoft.com Pobrezni 20
> > http://www.humusoft.com 186 00 Praha 8
> > tel: ++ 420 284 011 730 Czech Republic
> > fax: ++ 420 284 011 740

Ok, i got everything compiling fine. To fix the above error you need to change the target file (in config settings) to real time workshop.

I dont know why, but after all that it is not sending out signals.
When i check the "data error" output of the packet output block it is "1" indicating a data error. I cannot figure out why this is. It doesnt seem to be sending out any signals to my device although when i test the serial connection (in the blocks configuration box) it confirms its OK.

I am inputing a vector with 6 doubles to the packet output block (to send over serial connection).
Thus i have its output packet size / packet field data types set to 48 / '6*double'.

Would this be the correct settings?
Does anyone know what could be causing the error?

Thanks for your help
From: Jan Houska on
Hi Edward,

Edward wrote:
> Ok, i got everything compiling fine. To fix the above error you need to
> change the target file (in config settings) to real time workshop.
>
> I dont know why, but after all that it is not sending out signals.
> When i check the "data error" output of the packet output block it is
> "1" indicating a data error. I cannot figure out why this is. It doesnt
> seem to be sending out any signals to my device although when i test the
> serial connection (in the blocks configuration box) it confirms its OK.
>
> I am inputing a vector with 6 doubles to the packet output block (to
> send over serial connection). Thus i have its output packet size /
> packet field data types set to 48 / '6*double'.
>
> Would this be the correct settings?
> Does anyone know what could be causing the error?

This looks like serial port error - the device is unable to transmit or
something like this. It may be also locked by another process. Don't
you, by chance, have opened it from some other application? This would
include opening it from MATLAB by "fopen".

Jan


--
Jan Houska HUMUSOFT s.r.o.
houska(a)humusoft.com Pobrezni 20
http://www.humusoft.com 186 00 Praha 8
tel: ++ 420 284 011 730 Czech Republic
fax: ++ 420 284 011 740