From: Edward on
Hi All,
I am trying to send a serial signal using real time workshop and cannot seem to get it working correctly.

I am using a "Packet Output" Block and am trying to send some bytes of data over a serial connection (RS232) to a device.

For the moment i am trying to just send 3 bytes and my device is not receiving anything at all. When i check the "Data Error" and "Data Ready" outputs of the packet output block both are "1".

I am (for the moment) just trying to send a simple constant signal, which is from a constant block. It has a vector with the 3 numbers i am to send.

I have tried playing around with the "output packet field data types" and "output packet size" in the block parameters. Currently i have them set to '3*double' and 24, which should correspond to the vector from the constant block.

I dont know why i am getting the data error output (always 1), which i am guessing is why the signal is not being sent to my device.

Any help would be appreciated.

Thanks
From: Walter Roberson on
Edward wrote:

> I am trying to send a serial signal using real time workshop and cannot
> seem to get it working correctly.
>
> I am using a "Packet Output" Block and am trying to send some bytes of
> data over a serial connection (RS232) to a device.
>
> For the moment i am trying to just send 3 bytes and my device is not
> receiving anything at all. When i check the "Data Error" and "Data
> Ready" outputs of the packet output block both are "1".
>
> I am (for the moment) just trying to send a simple constant signal,
> which is from a constant block. It has a vector with the 3 numbers i am
> to send.
>
> I have tried playing around with the "output packet field data types"
> and "output packet size" in the block parameters. Currently i have them
> set to '3*double' and 24, which should correspond to the vector from the
> constant block.

I do not know what is causing the problem.

I do notice that in the first part of your description you say that you
want to send 3 bytes, and in the last part you say 3*double . Is there
an automatic conversion from double to bytes happening there? If so, is
it by doing the equivalent of uint8() or the equivalent of int8() or is
it doing the equivalent of typecast(x,'uint8') and then sending so many
underlying bytes of the representation of the double?

When I see a transmission problem such as you describe, I would first
check that the baud rate is set the same on both sides, and if it was, I
would check to be sure that DTR is being asserted when the port is
fopen()'d and that DSR is being received at the other end. To do that I
would either check with a voltmeter or (if I have one around) with one
of those little in-line RS232 devices that have LEDs that light up
according to the pins that are asserted, or (if I have one around) with
a logic probe or serial scope.

I can't count the number of times I've encountered a cable that wasn't
wired the way I expected. I refrain from saying "wasn't wired properly"
because *most* of the cables had _some_ designed use that they were fine
for, even if only for use with some deliberately non-standard serial
port; the cables that weren't wired properly were mostly ones I had
wired myself :(
From: Edward on
Walter Roberson <roberson(a)hushmail.com> wrote in message <nb56o.57015$lS1.44857(a)newsfe12.iad>...
> Edward wrote:
>
> > I am trying to send a serial signal using real time workshop and cannot
> > seem to get it working correctly.
> >
> > I am using a "Packet Output" Block and am trying to send some bytes of
> > data over a serial connection (RS232) to a device.
> >
> > For the moment i am trying to just send 3 bytes and my device is not
> > receiving anything at all. When i check the "Data Error" and "Data
> > Ready" outputs of the packet output block both are "1".
> >
> > I am (for the moment) just trying to send a simple constant signal,
> > which is from a constant block. It has a vector with the 3 numbers i am
> > to send.
> >
> > I have tried playing around with the "output packet field data types"
> > and "output packet size" in the block parameters. Currently i have them
> > set to '3*double' and 24, which should correspond to the vector from the
> > constant block.
>
> I do not know what is causing the problem.
>
> I do notice that in the first part of your description you say that you
> want to send 3 bytes, and in the last part you say 3*double . Is there
> an automatic conversion from double to bytes happening there? If so, is
> it by doing the equivalent of uint8() or the equivalent of int8() or is
> it doing the equivalent of typecast(x,'uint8') and then sending so many
> underlying bytes of the representation of the double?
>
> When I see a transmission problem such as you describe, I would first
> check that the baud rate is set the same on both sides, and if it was, I
> would check to be sure that DTR is being asserted when the port is
> fopen()'d and that DSR is being received at the other end. To do that I
> would either check with a voltmeter or (if I have one around) with one
> of those little in-line RS232 devices that have LEDs that light up
> according to the pins that are asserted, or (if I have one around) with
> a logic probe or serial scope.
>
> I can't count the number of times I've encountered a cable that wasn't
> wired the way I expected. I refrain from saying "wasn't wired properly"
> because *most* of the cables had _some_ designed use that they were fine
> for, even if only for use with some deliberately non-standard serial
> port; the cables that weren't wired properly were mostly ones I had
> wired myself :(

Sorry, I forgot to mention that i am doing this through simulink. I have successfully comminicated to the device using standard simulink (no real time workshop) so i know the cable is fine. I have tried changing the data type to 3*uint8 with an output size of 3 but with no success as well.
What do you mean when you say check the baud rate is the same "on both sides"? what is each "side". In the packet output box i have the baud rate on the serial setup as 9600, which is what my device requires.

Also, if it is any help:
- i am using the "real time windows target" system target file in the simulation configurations
- fixed step solver - ODE3

I really cant seem to figure this one out, it seems like it is just an incorrect setting somewhere as i have achieved success using the "To Instrument" block but this does not work in real time properly (which is what i need).

Any ideas?