Path: news.mathworks.com!not-for-mail
From: "Alp " <akacar2@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: RS-232 and RTWT
Date: Sat, 7 Nov 2009 14:01:05 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 71
Message-ID: <hd3uj1$d9c$1@fred.mathworks.com>
References: <hcpv6r$3r4$1@fred.mathworks.com> <hcrepq$268h$1@ns.felk.cvut.cz> <hcu99l$8l5$1@fred.mathworks.com> <hcubpg$bei$1@ns.felk.cvut.cz> <hcvh6i$48t$1@fred.mathworks.com> <hd39dj$2d9j$1@ns.felk.cvut.cz>
Reply-To: "Alp " <akacar2@gmail.com>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1257602465 13612 172.30.248.35 (7 Nov 2009 14:01:05 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sat, 7 Nov 2009 14:01:05 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2072514
Xref: news.mathworks.com comp.soft-sys.matlab:583213


Jan Thank You so much 
System is working :) we used %g\r\n 

Jan Houska <houska@humusoft.com> wrote in message <hd39dj$2d9j$1@ns.felk.cvut.cz>...
> Hi Alp,
> 
> if you need to press Enter in HyperTerminal for your device to accept 
> the data, there's chance that you need to terminate the data by either 
> CR or LF or both. Please try changing the format string to '%d\r' (for 
> CR) or '%d\n' (for LF) of to '%d\r\n' (for both).
> 
> If that still doesn't help, please try to connect another PC instead of 
> your device to the other end of the communication line. Then, try to 
> send data from both HyperTerminal and Real-Time Windows Target and 
> compare the differences. This way, you should be able to figure out what 
> you should do with the format string to exactly match the format you are 
> sending from HyperTerminal.
> 
> Good Luck, Jan
> 
> 
> Alp wrote:
> > Thank you Jan
> > 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.
> > 
> > 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. 
> > 
> > Port:COM1
> > Boud Rate : 9600
> > Parity: N
> > Stop Bit: 1
> > 
> > Do you think there could be a problem about buffering? That is the last thing to coming my mind. Again Thank You
> > 
> > 
> > Jan Houska <houska@humusoft.com> wrote in message <hcubpg$bei$1@ns.felk.cvut.cz>...
> >> Hi Alp,
> >>
> >> have you been able to control your PIC from another Windows application 
> >> - not MATLAB, not Real-Time Windows Target? What data format were you using?
> >>
> >>  From the PIC code below it looks like the device expects the data in 
> >> ASCII, so you would need to use Stream Output. Further, it looks like 
> >> you are expecting an integer decimal number, so you should set the 
> >> format string to '%d'. Of course, you must ensure that baud rate, bit 
> >> length, parity, etc. settings of the PIC match those of Real-Time 
> >> Windows Target (settable in Board Setup).
> >>
> >> Other than this, I can't think of anything else at the moment. But I'd 
> >> definitely start from a working setup (if you have any) and gradually 
> >> change thing to the desired setup with Real-Time Windows Target.
> >>
> >> Good Luck, 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
> 
> 
> -- 
> 
> --
> 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