<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264868</link>
    <title>MATLAB Central Newsreader - RS-232 and RTWT</title>
    <description>Feed for thread: RS-232 and RTWT</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Tue, 03 Nov 2009 19:10:19 -0500</pubDate>
      <title>RS-232 and RTWT</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264868#691807</link>
      <author>Alp </author>
      <description>We have a project which contains PIC microcontroller, RS-232 interface and PC (with Matlab, Simulink).We have to connect PIC to PC via RS-232 and sent datas in real time. &lt;br&gt;
I found this link when I search related topics includes RS-232 and PIC keywords.&lt;br&gt;
&lt;a href=&quot;http://hades.mech.northwestern.edu/index.php/Serial_communication_with_Matlab&quot;&gt;http://hades.mech.northwestern.edu/index.php/Serial_communication_with_Matlab&lt;/a&gt; &lt;br&gt;
However, this example does not working in Simulink's Embedded Matlab Block. PIC should get the 4digit number, we could not send the data from simulink to PIC. Is there anybody work on RTWT Simulink , RS-232 and PIC to help us?</description>
    </item>
    <item>
      <pubDate>Wed, 04 Nov 2009 08:42:34 -0500</pubDate>
      <title>Re: RS-232 and RTWT</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264868#691963</link>
      <author>Jan Houska</author>
      <description>Hi,&lt;br&gt;
&lt;br&gt;
Alp wrote:&lt;br&gt;
&amp;gt; We have a project which contains PIC microcontroller, RS-232 interface and PC (with Matlab, Simulink).We have to connect PIC to PC via RS-232 and sent datas in real time. &lt;br&gt;
&amp;gt; I found this link when I search related topics includes RS-232 and PIC keywords.&lt;br&gt;
&amp;gt; &lt;a href=&quot;http://hades.mech.northwestern.edu/index.php/Serial_communication_with_Matlab&quot;&gt;http://hades.mech.northwestern.edu/index.php/Serial_communication_with_Matlab&lt;/a&gt; &lt;br&gt;
&amp;gt; However, this example does not working in Simulink's Embedded Matlab Block. PIC should get the 4digit number, we could not send the data from simulink to PIC. Is there anybody work on RTWT Simulink , RS-232 and PIC to help us?&lt;br&gt;
&lt;br&gt;
You can try the Packet Output or Stream Output block, and choose &lt;br&gt;
Standard Devices, Serial Port as the data acquisition driver. These &lt;br&gt;
blocks are available since R2007b. Please see the &quot;rtpacketio&quot; and &lt;br&gt;
&quot;rtstreamio&quot; examples - although they use UDP and not RS232, the &lt;br&gt;
principle is the same and they can be changed to use RS232 just by &lt;br&gt;
changing the data acquisition driver.&lt;br&gt;
&lt;br&gt;
Good Luck, Jan&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
--&lt;br&gt;
Jan Houska                                           HUMUSOFT s.r.o.&lt;br&gt;
houska@humusoft.com                                  Pobrezni 20&lt;br&gt;
&lt;a href=&quot;http://www.humusoft.com&quot;&gt;http://www.humusoft.com&lt;/a&gt;                              186 00 Praha 8&lt;br&gt;
tel: ++ 420 284 011 730                              Czech Republic&lt;br&gt;
fax: ++ 420 284 011 740</description>
    </item>
    <item>
      <pubDate>Thu, 05 Nov 2009 10:27:01 -0500</pubDate>
      <title>Re: RS-232 and RTWT</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264868#692338</link>
      <author>Alp </author>
      <description>Thank you for your help. We tried your way ,but we cannot achived to get proper result. I am telling you our project with its details. I hope you can find our missings. We want to produce PWM signal (from B0 pin) from PIC according to coming signal from Simulink (0 to 1000). We used MAX232 IC for converting +12V,-12V to 5V,0V.&lt;br&gt;
CCS C Program of PIC16F877:&lt;br&gt;
&lt;br&gt;
#include &amp;lt;16f877.h&amp;gt;  &lt;br&gt;
#include &amp;lt;stdlib.h&amp;gt;&lt;br&gt;
#fuses XT,NOWDT,NOPROTECT,NOBROWNOUT,NOLVP,NOPUT,NOWRT,NODEBUG,NOCPD&lt;br&gt;
#use delay (clock=4000000)&lt;br&gt;
#use rs232 (baud=9600, xmit=pin_C6, rcv=pin_C7, parity=N, stop=1) &lt;br&gt;
#use fast_io(b)&lt;br&gt;
&lt;br&gt;
long int A=63536;&lt;br&gt;
char   klavye[16];  &lt;br&gt;
int16 x=0;&lt;br&gt;
#int_rda  &lt;br&gt;
void serihaberlesme_kesmesi ()&lt;br&gt;
{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;disable_interrupts(int_rda); &lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;output_high(pin_c5); &lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;gets(klavye);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;output_low(pin_c5); &lt;br&gt;
}&lt;br&gt;
//****************** Timer1 Interrupt  (1-2 ms)  ****&lt;br&gt;
#int_timer1  &lt;br&gt;
void  timer1_kesme () &lt;br&gt;
{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;output_low(pin_b0);&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
//****************** Timer0 Interrupt (20 ms) *****&lt;br&gt;
#int_timer0 &lt;br&gt;
void  timer0_kesme () &lt;br&gt;
{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;output_high(pin_b0);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;set_timer0(177);   // TMR0&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;set_timer1(A);   // TMR1&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
void main ( )&lt;br&gt;
{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;setup_psp(PSP_DISABLED);      &lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;setup_timer_2(T2_DISABLED,0,1); &lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;setup_CCP1(CCP_OFF);         &lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;setup_CCP2(CCP_OFF);          &lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;setup_adc_ports(NO_ANALOGS);  &lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;setup_adc(ADC_OFF);      &lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;set_tris_b(0x00); &lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;output_b(0x00);   &lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;setup_timer_0(RTCC_INTERNAL | RTCC_DIV_256);   // Timer0 &lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;set_timer0(177);     // TMR0 &lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;setup_timer_1(T1_INTERNAL | T1_DIV_BY_1);   // Timer1 &lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;enable_interrupts(INT_timer1); &lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;enable_interrupts(INT_timer0); &lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;enable_interrupts(GLOBAL);  &lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;while(1) &lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;x=atol(klavye);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;A=64536-x;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;enable_interrupts(int_rda);&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
Simulink File:&lt;br&gt;
&lt;br&gt;
Constant--&amp;gt;Slider Gain--&amp;gt;Stream Output (or Packet Output)&lt;br&gt;
&lt;br&gt;
Thank you again..</description>
    </item>
    <item>
      <pubDate>Thu, 05 Nov 2009 11:09:35 -0500</pubDate>
      <title>Re: RS-232 and RTWT</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264868#692345</link>
      <author>Jan Houska</author>
      <description>Hi Alp,&lt;br&gt;
&lt;br&gt;
have you been able to control your PIC from another Windows application &lt;br&gt;
- not MATLAB, not Real-Time Windows Target? What data format were you using?&lt;br&gt;
&lt;br&gt;
&amp;nbsp;From the PIC code below it looks like the device expects the data in &lt;br&gt;
ASCII, so you would need to use Stream Output. Further, it looks like &lt;br&gt;
you are expecting an integer decimal number, so you should set the &lt;br&gt;
format string to '%d'. Of course, you must ensure that baud rate, bit &lt;br&gt;
length, parity, etc. settings of the PIC match those of Real-Time &lt;br&gt;
Windows Target (settable in Board Setup).&lt;br&gt;
&lt;br&gt;
Other than this, I can't think of anything else at the moment. But I'd &lt;br&gt;
definitely start from a working setup (if you have any) and gradually &lt;br&gt;
change thing to the desired setup with Real-Time Windows Target.&lt;br&gt;
&lt;br&gt;
Good Luck, Jan&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Alp wrote:&lt;br&gt;
&amp;gt; Thank you for your help. We tried your way ,but we cannot achived to get proper result. I am telling you our project with its details. I hope you can find our missings. We want to produce PWM signal (from B0 pin) from PIC according to coming signal from Simulink (0 to 1000). We used MAX232 IC for converting +12V,-12V to 5V,0V.&lt;br&gt;
&amp;gt; CCS C Program of PIC16F877:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; #include &amp;lt;16f877.h&amp;gt;  &lt;br&gt;
&amp;gt; #include &amp;lt;stdlib.h&amp;gt;&lt;br&gt;
&amp;gt; #fuses XT,NOWDT,NOPROTECT,NOBROWNOUT,NOLVP,NOPUT,NOWRT,NODEBUG,NOCPD&lt;br&gt;
&amp;gt; #use delay (clock=4000000)&lt;br&gt;
&amp;gt; #use rs232 (baud=9600, xmit=pin_C6, rcv=pin_C7, parity=N, stop=1) &lt;br&gt;
&amp;gt; #use fast_io(b)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; long int A=63536;&lt;br&gt;
&amp;gt; char   klavye[16];  &lt;br&gt;
&amp;gt; int16 x=0;&lt;br&gt;
&amp;gt; #int_rda  &lt;br&gt;
&amp;gt; void serihaberlesme_kesmesi ()&lt;br&gt;
&amp;gt; {&lt;br&gt;
&amp;gt;    disable_interrupts(int_rda); &lt;br&gt;
&amp;gt;    output_high(pin_c5); &lt;br&gt;
&amp;gt;    gets(klavye);&lt;br&gt;
&amp;gt;    output_low(pin_c5); &lt;br&gt;
&amp;gt; }&lt;br&gt;
&amp;gt; //****************** Timer1 Interrupt  (1-2 ms)  ****&lt;br&gt;
&amp;gt; #int_timer1  &lt;br&gt;
&amp;gt; void  timer1_kesme () &lt;br&gt;
&amp;gt; {&lt;br&gt;
&amp;gt;     output_low(pin_b0);&lt;br&gt;
&amp;gt; }&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; //****************** Timer0 Interrupt (20 ms) *****&lt;br&gt;
&amp;gt; #int_timer0 &lt;br&gt;
&amp;gt; void  timer0_kesme () &lt;br&gt;
&amp;gt; {&lt;br&gt;
&amp;gt;     output_high(pin_b0);&lt;br&gt;
&amp;gt;     set_timer0(177);   // TMR0&lt;br&gt;
&amp;gt;     set_timer1(A);   // TMR1&lt;br&gt;
&amp;gt; }&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; void main ( )&lt;br&gt;
&amp;gt; {&lt;br&gt;
&amp;gt;    setup_psp(PSP_DISABLED);      &lt;br&gt;
&amp;gt;    setup_timer_2(T2_DISABLED,0,1); &lt;br&gt;
&amp;gt;    setup_CCP1(CCP_OFF);         &lt;br&gt;
&amp;gt;    setup_CCP2(CCP_OFF);          &lt;br&gt;
&amp;gt;    setup_adc_ports(NO_ANALOGS);  &lt;br&gt;
&amp;gt;    setup_adc(ADC_OFF);      &lt;br&gt;
&amp;gt;    &lt;br&gt;
&amp;gt;    set_tris_b(0x00); &lt;br&gt;
&amp;gt;    output_b(0x00);   &lt;br&gt;
&amp;gt;     &lt;br&gt;
&amp;gt;    setup_timer_0(RTCC_INTERNAL | RTCC_DIV_256);   // Timer0 &lt;br&gt;
&amp;gt;    set_timer0(177);     // TMR0 &lt;br&gt;
&amp;gt;    setup_timer_1(T1_INTERNAL | T1_DIV_BY_1);   // Timer1 &lt;br&gt;
&amp;gt;    enable_interrupts(INT_timer1); &lt;br&gt;
&amp;gt;    enable_interrupts(INT_timer0); &lt;br&gt;
&amp;gt;    enable_interrupts(GLOBAL);  &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;    while(1) &lt;br&gt;
&amp;gt;    {&lt;br&gt;
&amp;gt;    x=atol(klavye);&lt;br&gt;
&amp;gt;    A=64536-x;&lt;br&gt;
&amp;gt;    enable_interrupts(int_rda);&lt;br&gt;
&amp;gt;    }&lt;br&gt;
&amp;gt; }&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Simulink File:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Constant--&amp;gt;Slider Gain--&amp;gt;Stream Output (or Packet Output)&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Thank you again..&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
-- &lt;br&gt;
&lt;br&gt;
--&lt;br&gt;
Jan Houska                                           HUMUSOFT s.r.o.&lt;br&gt;
houska@humusoft.com                                  Pobrezni 20&lt;br&gt;
&lt;a href=&quot;http://www.humusoft.com&quot;&gt;http://www.humusoft.com&lt;/a&gt;                              186 00 Praha 8&lt;br&gt;
tel: ++ 420 284 011 730                              Czech Republic&lt;br&gt;
fax: ++ 420 284 011 740</description>
    </item>
    <item>
      <pubDate>Thu, 05 Nov 2009 21:48:02 -0500</pubDate>
      <title>Re: RS-232 and RTWT</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264868#692534</link>
      <author>Alp </author>
      <description>Thank you Jan&lt;br&gt;
We had connected PC to PIC via RS-232 using HyperTerminal Application. Also Matlab, but not real time. As you know HyperTerminal sends data as character string. When we write the 4-digit number and press Enter it sends to the PIC. According to signal our PWM value changes.&lt;br&gt;
&lt;br&gt;
We worked procceses on things you said. However, it did not worked. When the PIC get signals from Stream Output Block resets to zero the initial PWM value of the PIC. I think it is not a understandable signal for PIC. I tried all character types for sending to PIC, but again it is not working. Also, I am pretty sure for the RS-232 spesifications like boud rate or stop bits. &lt;br&gt;
&lt;br&gt;
Port:COM1&lt;br&gt;
Boud Rate : 9600&lt;br&gt;
Parity: N&lt;br&gt;
Stop Bit: 1&lt;br&gt;
&lt;br&gt;
Do you think there could be a problem about buffering? That is the last thing to coming my mind. Again Thank You&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Jan Houska &amp;lt;houska@humusoft.com&amp;gt; wrote in message &amp;lt;hcubpg$bei$1@ns.felk.cvut.cz&amp;gt;...&lt;br&gt;
&amp;gt; Hi Alp,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; have you been able to control your PIC from another Windows application &lt;br&gt;
&amp;gt; - not MATLAB, not Real-Time Windows Target? What data format were you using?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;  From the PIC code below it looks like the device expects the data in &lt;br&gt;
&amp;gt; ASCII, so you would need to use Stream Output. Further, it looks like &lt;br&gt;
&amp;gt; you are expecting an integer decimal number, so you should set the &lt;br&gt;
&amp;gt; format string to '%d'. Of course, you must ensure that baud rate, bit &lt;br&gt;
&amp;gt; length, parity, etc. settings of the PIC match those of Real-Time &lt;br&gt;
&amp;gt; Windows Target (settable in Board Setup).&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Other than this, I can't think of anything else at the moment. But I'd &lt;br&gt;
&amp;gt; definitely start from a working setup (if you have any) and gradually &lt;br&gt;
&amp;gt; change thing to the desired setup with Real-Time Windows Target.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Good Luck, Jan&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Jan Houska                                           HUMUSOFT s.r.o.&lt;br&gt;
&amp;gt; houska@humusoft.com                                  Pobrezni 20&lt;br&gt;
&amp;gt; &lt;a href=&quot;http://www.humusoft.com&quot;&gt;http://www.humusoft.com&lt;/a&gt;                              186 00 Praha 8&lt;br&gt;
&amp;gt; tel: ++ 420 284 011 730                              Czech Republic&lt;br&gt;
&amp;gt; fax: ++ 420 284 011 740</description>
    </item>
    <item>
      <pubDate>Sat, 07 Nov 2009 07:59:46 -0500</pubDate>
      <title>Re: RS-232 and RTWT</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264868#692858</link>
      <author>Jan Houska</author>
      <description>Hi Alp,&lt;br&gt;
&lt;br&gt;
if you need to press Enter in HyperTerminal for your device to accept &lt;br&gt;
the data, there's chance that you need to terminate the data by either &lt;br&gt;
CR or LF or both. Please try changing the format string to '%d\r' (for &lt;br&gt;
CR) or '%d\n' (for LF) of to '%d\r\n' (for both).&lt;br&gt;
&lt;br&gt;
If that still doesn't help, please try to connect another PC instead of &lt;br&gt;
your device to the other end of the communication line. Then, try to &lt;br&gt;
send data from both HyperTerminal and Real-Time Windows Target and &lt;br&gt;
compare the differences. This way, you should be able to figure out what &lt;br&gt;
you should do with the format string to exactly match the format you are &lt;br&gt;
sending from HyperTerminal.&lt;br&gt;
&lt;br&gt;
Good Luck, Jan&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Alp wrote:&lt;br&gt;
&amp;gt; Thank you Jan&lt;br&gt;
&amp;gt; We had connected PC to PIC via RS-232 using HyperTerminal Application. Also Matlab, but not real time. As you know HyperTerminal sends data as character string. When we write the 4-digit number and press Enter it sends to the PIC. According to signal our PWM value changes.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; We worked procceses on things you said. However, it did not worked. When the PIC get signals from Stream Output Block resets to zero the initial PWM value of the PIC. I think it is not a understandable signal for PIC. I tried all character types for sending to PIC, but again it is not working. Also, I am pretty sure for the RS-232 spesifications like boud rate or stop bits. &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Port:COM1&lt;br&gt;
&amp;gt; Boud Rate : 9600&lt;br&gt;
&amp;gt; Parity: N&lt;br&gt;
&amp;gt; Stop Bit: 1&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Do you think there could be a problem about buffering? That is the last thing to coming my mind. Again Thank You&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Jan Houska &amp;lt;houska@humusoft.com&amp;gt; wrote in message &amp;lt;hcubpg$bei$1@ns.felk.cvut.cz&amp;gt;...&lt;br&gt;
&amp;gt;&amp;gt; Hi Alp,&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; have you been able to control your PIC from another Windows application &lt;br&gt;
&amp;gt;&amp;gt; - not MATLAB, not Real-Time Windows Target? What data format were you using?&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;  From the PIC code below it looks like the device expects the data in &lt;br&gt;
&amp;gt;&amp;gt; ASCII, so you would need to use Stream Output. Further, it looks like &lt;br&gt;
&amp;gt;&amp;gt; you are expecting an integer decimal number, so you should set the &lt;br&gt;
&amp;gt;&amp;gt; format string to '%d'. Of course, you must ensure that baud rate, bit &lt;br&gt;
&amp;gt;&amp;gt; length, parity, etc. settings of the PIC match those of Real-Time &lt;br&gt;
&amp;gt;&amp;gt; Windows Target (settable in Board Setup).&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; Other than this, I can't think of anything else at the moment. But I'd &lt;br&gt;
&amp;gt;&amp;gt; definitely start from a working setup (if you have any) and gradually &lt;br&gt;
&amp;gt;&amp;gt; change thing to the desired setup with Real-Time Windows Target.&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; Good Luck, Jan&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt;&lt;br&gt;
&amp;gt;&amp;gt; Jan Houska                                           HUMUSOFT s.r.o.&lt;br&gt;
&amp;gt;&amp;gt; houska@humusoft.com                                  Pobrezni 20&lt;br&gt;
&amp;gt;&amp;gt; &lt;a href=&quot;http://www.humusoft.com&quot;&gt;http://www.humusoft.com&lt;/a&gt;                              186 00 Praha 8&lt;br&gt;
&amp;gt;&amp;gt; tel: ++ 420 284 011 730                              Czech Republic&lt;br&gt;
&amp;gt;&amp;gt; fax: ++ 420 284 011 740&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
-- &lt;br&gt;
&lt;br&gt;
--&lt;br&gt;
Jan Houska                                           HUMUSOFT s.r.o.&lt;br&gt;
houska@humusoft.com                                  Pobrezni 20&lt;br&gt;
&lt;a href=&quot;http://www.humusoft.com&quot;&gt;http://www.humusoft.com&lt;/a&gt;                              186 00 Praha 8&lt;br&gt;
tel: ++ 420 284 011 730                              Czech Republic&lt;br&gt;
fax: ++ 420 284 011 740</description>
    </item>
    <item>
      <pubDate>Sat, 07 Nov 2009 14:01:05 -0500</pubDate>
      <title>Re: RS-232 and RTWT</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/264868#692880</link>
      <author>Alp </author>
      <description>Jan Thank You so much &lt;br&gt;
System is working :) we used %g\r\n &lt;br&gt;
&lt;br&gt;
Jan Houska &amp;lt;houska@humusoft.com&amp;gt; wrote in message &amp;lt;hd39dj$2d9j$1@ns.felk.cvut.cz&amp;gt;...&lt;br&gt;
&amp;gt; Hi Alp,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; if you need to press Enter in HyperTerminal for your device to accept &lt;br&gt;
&amp;gt; the data, there's chance that you need to terminate the data by either &lt;br&gt;
&amp;gt; CR or LF or both. Please try changing the format string to '%d\r' (for &lt;br&gt;
&amp;gt; CR) or '%d\n' (for LF) of to '%d\r\n' (for both).&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; If that still doesn't help, please try to connect another PC instead of &lt;br&gt;
&amp;gt; your device to the other end of the communication line. Then, try to &lt;br&gt;
&amp;gt; send data from both HyperTerminal and Real-Time Windows Target and &lt;br&gt;
&amp;gt; compare the differences. This way, you should be able to figure out what &lt;br&gt;
&amp;gt; you should do with the format string to exactly match the format you are &lt;br&gt;
&amp;gt; sending from HyperTerminal.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Good Luck, Jan&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Alp wrote:&lt;br&gt;
&amp;gt; &amp;gt; Thank you Jan&lt;br&gt;
&amp;gt; &amp;gt; We had connected PC to PIC via RS-232 using HyperTerminal Application. Also Matlab, but not real time. As you know HyperTerminal sends data as character string. When we write the 4-digit number and press Enter it sends to the PIC. According to signal our PWM value changes.&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; We worked procceses on things you said. However, it did not worked. When the PIC get signals from Stream Output Block resets to zero the initial PWM value of the PIC. I think it is not a understandable signal for PIC. I tried all character types for sending to PIC, but again it is not working. Also, I am pretty sure for the RS-232 spesifications like boud rate or stop bits. &lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Port:COM1&lt;br&gt;
&amp;gt; &amp;gt; Boud Rate : 9600&lt;br&gt;
&amp;gt; &amp;gt; Parity: N&lt;br&gt;
&amp;gt; &amp;gt; Stop Bit: 1&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Do you think there could be a problem about buffering? That is the last thing to coming my mind. Again Thank You&lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; Jan Houska &amp;lt;houska@humusoft.com&amp;gt; wrote in message &amp;lt;hcubpg$bei$1@ns.felk.cvut.cz&amp;gt;...&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; Hi Alp,&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; have you been able to control your PIC from another Windows application &lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; - not MATLAB, not Real-Time Windows Target? What data format were you using?&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;  From the PIC code below it looks like the device expects the data in &lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; ASCII, so you would need to use Stream Output. Further, it looks like &lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; you are expecting an integer decimal number, so you should set the &lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; format string to '%d'. Of course, you must ensure that baud rate, bit &lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; length, parity, etc. settings of the PIC match those of Real-Time &lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; Windows Target (settable in Board Setup).&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; Other than this, I can't think of anything else at the moment. But I'd &lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; definitely start from a working setup (if you have any) and gradually &lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; change thing to the desired setup with Real-Time Windows Target.&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; Good Luck, Jan&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt;&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; Jan Houska                                           HUMUSOFT s.r.o.&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; houska@humusoft.com                                  Pobrezni 20&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; &lt;a href=&quot;http://www.humusoft.com&quot;&gt;http://www.humusoft.com&lt;/a&gt;                              186 00 Praha 8&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; tel: ++ 420 284 011 730                              Czech Republic&lt;br&gt;
&amp;gt; &amp;gt;&amp;gt; fax: ++ 420 284 011 740&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; -- &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; --&lt;br&gt;
&amp;gt; Jan Houska                                           HUMUSOFT s.r.o.&lt;br&gt;
&amp;gt; houska@humusoft.com                                  Pobrezni 20&lt;br&gt;
&amp;gt; &lt;a href=&quot;http://www.humusoft.com&quot;&gt;http://www.humusoft.com&lt;/a&gt;                              186 00 Praha 8&lt;br&gt;
&amp;gt; tel: ++ 420 284 011 730                              Czech Republic&lt;br&gt;
&amp;gt; fax: ++ 420 284 011 740</description>
    </item>
  </channel>
</rss>

