Real Time Workshop Serial Example

  • Follow


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?
0
Reply Edward 8/2/2010 5:03:03 AM

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@humusoft.com                                  Pobrezni 20
http://www.humusoft.com                              186 00 Praha 8
tel: ++ 420 284 011 730                              Czech Republic
fax: ++ 420 284 011 740
0
Reply houska1 (253) 8/2/2010 10:50:09 AM


Jan Houska <houska@humusoft.com> wrote in message <i367t2$16su$1@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@humusoft.com                                  Pobrezni 20
> http://www.humusoft.com                              186 00 Praha 8
> tel: ++ 420 284 011 730                              Czech Republic
> fax: ++ 420 284 011 740
0
Reply Edward 8/3/2010 1:23:03 AM

"Edward " <thomson.ed@gmail.com> wrote in message <i37r1n$dsn$1@fred.mathworks.com>...
> Jan Houska <houska@humusoft.com> wrote in message <i367t2$16su$1@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@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
0
Reply Edward 8/3/2010 3:25:05 AM

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@humusoft.com                                  Pobrezni 20
http://www.humusoft.com                              186 00 Praha 8
tel: ++ 420 284 011 730                              Czech Republic
fax: ++ 420 284 011 740
0
Reply Jan 8/11/2010 7:49:36 AM

4 Replies
438 Views

(page loaded in 0.11 seconds)

Similiar Articles:













7/22/2012 6:25:54 PM


Reply: