Path: news.mathworks.com!newsfeed-00.mathworks.com!kanaga.switch.ch!switch.ch!kanja.arnes.si!news-hub.siol.net!newsfeed1.eu.ignite.net!news.cesnet.cz!news.felk.cvut.cz!not-for-mail
From: Jan Houska <houska@humusoft.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: RS-232 and RTWT
Date: Sat, 07 Nov 2009 08:59:46 +0100
Organization: HUMUSOFT s.r.o.
Lines: 67
Message-ID: <hd39dj$2d9j$1@ns.felk.cvut.cz>
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>
NNTP-Posting-Host: hack.humusoft.cz
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: ns.felk.cvut.cz 1257580787 79155 88.208.79.130 (7 Nov 2009 07:59:47 GMT)
X-Complaints-To: usenet@news.felk.cvut.cz
NNTP-Posting-Date: Sat, 7 Nov 2009 07:59:47 +0000 (UTC)
User-Agent: Thunderbird 2.0.0.18 (Windows/20081105)
In-Reply-To: <hcvh6i$48t$1@fred.mathworks.com>
Xref: news.mathworks.com comp.soft-sys.matlab:583191


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