how to send data through serial port using matlab?

  • Permalink
  • submit to reddit
  • Email
  • Follow


i'm interfacing a microcontroller with pc. how to send data through serial port of pc, using matlab?
0
Reply e_rockerz (6) 3/11/2009 10:00:19 AM

See related articles to this posting


"mohan cp" <e_rockerz@yahoo.com> wrote in message 
news:gp823j$quk$1@fred.mathworks.com...
> i'm interfacing a microcontroller with pc. how to send data through serial 
> port of pc, using matlab?

s=serial('com1');
fopen(s);
fwrite(s,'12345');
fclose(s);

http://www.mathworks.com/serial 


0
Reply tjarvi (224) 3/11/2009 3:16:26 PM

"Trent Jarvi" <tjarvi@mathworks.com> wrote in message <gp8kka$ai$1@fred.mathworks.com>...
> 
> "mohan cp" <e_rockerz@yahoo.com> wrote in message 
> news:gp823j$quk$1@fred.mathworks.com...
> > i'm interfacing a microcontroller with pc. how to send data through serial 
> > port of pc, using matlab?
> 
> s=serial('com1');
> fopen(s);
> fwrite(s,'12345');
> fclose(s);
> 
> http://www.mathworks.com/serial 
> 
thank u.......
0
Reply e_rockerz (6) 3/12/2009 4:06:04 AM

"Trent Jarvi" <tjarvi@mathworks.com> wrote in message <gp8kka$ai$1@fred.mathworks.com>...
> 
> "mohan cp" <e_rockerz@yahoo.com> wrote in message 
> news:gp823j$quk$1@fred.mathworks.com...
> > i'm interfacing a microcontroller with pc. how to send data through serial 
> > port of pc, using matlab?
> 
> s=serial('com1');
> fopen(s);
> fwrite(s,'12345');
> fclose(s);
> 
> http://www.mathworks.com/serial 
> 
thank u
0
Reply e_rockerz (6) 3/12/2009 4:06:07 AM

"Trent Jarvi" <tjarvi@mathworks.com> wrote in message <gp8kka$ai$1@fred.mathworks.com>...
> 
> "mohan cp" <e_rockerz@yahoo.com> wrote in message 
> news:gp823j$quk$1@fred.mathworks.com...
> > i'm interfacing a microcontroller with pc. how to send data through serial 
> > port of pc, using matlab?
> 
> s=serial('com1');
> fopen(s);
> fwrite(s,'12345');
> fclose(s);
> 
> http://www.mathworks.com/serial 
> 

Hi,
Concerning this issue, i have two question:

1- Using "INSTRFIND" show me all ports, but all statue are close. How can i open them?
2-I did not get from above-mentioned code, how to send a data (e.g *.txt format)
to com1, would you give me some more helps!

thanks 
0
Reply jeff_dubi (28) 7/3/2009 3:37:01 PM

"karlo gonzales" wrote in message <h2l8is$deu$1@fred.mathworks.com>...
> "Trent Jarvi" <tjarvi@mathworks.com> wrote in message <gp8kka$ai$1@fred.mathworks.com>...
> > 
> > "mohan cp" <e_rockerz@yahoo.com> wrote in message 
> > news:gp823j$quk$1@fred.mathworks.com...
> > > i'm interfacing a microcontroller with pc. how to send data through serial 
> > > port of pc, using matlab?
> > 
> > s=serial('com1');
> > fopen(s);
> > fwrite(s,'12345');
> > fclose(s);
> > 
> > http://www.mathworks.com/serial 
> > 
> 
> Hi,
> Concerning this issue, i have two question:
> 
> 1- Using "INSTRFIND" show me all ports, but all statue are close. How can i open them?
> 2-I did not get from above-mentioned code, how to send a data (e.g *.txt format)
> to com1, would you give me some more helps!
> 
> thanks 


use this commend first 
delete(instrfindall)
0
Reply faizan5422 (1) 3/23/2013 4:15:06 PM

On Wednesday, March 11, 2009 8:46:26 PM UTC+5:30, Trent Jarvi wrote:
> "mohan cp" <e_rockerz@yahoo.com> wrote in message 
> news:gp823j$quk$1@fred.mathworks.com...
> > i'm interfacing a microcontroller with pc. how to send data through serial 
> > port of pc, using matlab?
> 
> s=serial('com1');
> fopen(s);
> fwrite(s,'12345');
> fclose(s);
> 
> http://www.mathworks.com/serial

you have given code to send data through serial cable in matlab.
how can i receive the same data in micro controller(Im using ARM 7 micro controller which runs with keil software).
please help me as soon as possible
0
Reply ravitej 4/3/2014 8:31:54 AM
comp.soft-sys.matlab 203298 articles. 528 followers. Post

6 Replies
218 Views

Similar Articles

[PageSpeed] 45


  • Permalink
  • submit to reddit
  • Email
  • Follow


Reply:

Similar Artilces:

how to read data from serial port using matlab in pc
how to read data from serial port using matlab "lingaraj athi" <lingsakv@yahoo.com> wrote in message <i1mqhv$2vo$1@fred.mathworks.com>... > how to read data from serial port using matlab Please find details with examples of IO using Serial Port in the documentation: http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_external/f92576.html ...

problem with sending data using simulink and serial port
Dear every body, I am dealing with the sending data from Matlab to Microcontroller using serial port. For my project, I intend to send data in the ASCII form, I used S- function with the main code for sending data as follow: --------------------- function sys=mdlOutputs(t,x,u,ser1) curtime = cputime ; data1 = u data1s = char(data1) fprintf(ser1, data1s); ------------------------------------ I used another code to receive the sending data by connect the serial port to another serial port with matlab running, the main code for receiving as follow: ----------...

sending and geting data to and from usb ports using matlab
Hello. i am a student. I use matlab 2011. i am working on a project where i control a simple 2 motor robot using my laptop. i wish to give orders to my robot wireless. so first i thought of using the bluetooth of my laptop. but i found out matlab does not support it. then i thought of using a bluetooth transmitter (bluetooth dongle) which will be connected to one of the usb ports. what shall i do in order to send data to that usb port. i read some of the answers and it seems it is not possible. if it is not possible then what alternatives are available. ...

sending ascii and hex data using visa serial port
Hi All, I am a noob to the whole labview development enviroment and have searched all over the forum to try and find some answer but have had no luck so far. Currently I am trying to implement serial communications using the serial port library vi (used in the basic serial read and write example) with a board that requires both ascii and binary data to be sent to it.&nbsp; For example&nbsp; this is how it is sent out in Visual Basic MSComm1.Output = "!B" + Chr$(IOVal) where Chr$(IOVal) is equivalent to $00 to $FF I have looked and started modifying the Basic Serial r...

how to send any kind of data be it image,text to a usb port using matlab
i want to send data to usb port of my laptop. a usb to ttl cable connects the laptop to a circuit. the circuit is a LED driver system, it does not contain a micro controller. which matlab functions and toolboxes will be required.? thanks ...

serial port reading the data but not displaying the read data in MATLAB
Scenario: i am currently doing a project on transmission of digital video images using matlab. what i need to do is to transmit the image data through the serial port of the computer. i have decompsed the image into individual pixels and i have written a matlab program for trnasmitting the image data. till this point i was sucessful. problem: my radio transmitter which connected to the serial port of the computer is transmitting the data the radio receiver connected to the serial of the another computer and is controlled by MATLAB. though my radio receiver is receiving the data matlab is r...

sending data to serial port
i want to get binary data from serial port of a pc.how can i do this? RTFM!! Just typing "serial port" in the Search tab of MatLab's help got me everything you need to know. I suggest you do the same. "SADIK MANZAK" <s_manzak@yahoo.com> schreef in bericht news:eed05bd.-1@webx.raydaftYaTP... | i want to get binary data from serial port of a pc.how can i do this? ...

Serial Port send the same data
Hi: I'm interfacing a PC with the pic 18FXX via USB. I'm using a driver that makes the USB port view as a COM port. When I send data from the pic y have no problem with it; but when I send data to the pic using the comand "fwrite" or "fprintf" I always get a zero value. I suspect that Matlab adds bytes at the beginning of the stream with 0 value. At the pic I'm reading one char (a byte). Does anybody know how Matlab frame it? Thanks "Marttin" <mttoliveri@gmail.com> wrote in message news:ef3ca5f.-1@webcrossing.raydaftYaTP... > Hi: > I'...

Sending data to the serial port (Linux)?
Hello and a nice new year! Is there an easy way to send data to the serial port under Linux? I have some values in a spreadsheet that need to be reformatted and sent to e.g. /dev/ttyS0. I think of exporting the spreadsheet as csv and read it into IDL, reformatting is easy and no problem but how do I send the strings to the serial interface? Probably by writing to another file and doing a 'cat foobar /dev/ttyS0'? Is the latter possible in the timed demo mode (I need to to this at home without access to our license server). If anybody is curious: The data are the program steps for a sl...

parsing data from a serial port ! how matlab do it !
im working ona project that reads accelerometer data from an accelerometer ( in the x,y,z directions) to a serial port , it also reads continous infrared signal and recognise it as a number ! i can parse my data in the serial port the way i want . example . (assume x,y,z are the accelrometer values and R is in the infrared code ) x200 y300 z400 R100 x200 y300 z400 R100 x200 y300 z400 R100 or : x200 y300 z400 R100 x200 y300 z400 x200 y300 z400 R100 my problem is that the accelerometer values are much faster than the infrared signal . so i dont usually get the s...

sending data to serial port #2
i want to get binary data from serial port of a pc.how can i do this? create a serial object: s = serial('COMx') define properties of the serial: set(s, 'baudrate', 19200) ... use fprintf, fscanf, fread ... to write and read from the serial. SADIK MANZAK wrote: > > > i want to get binary data from serial port of a pc.how can i do > this? ...

serial port
hello, i'm try to send/recive to/from a device but when i'm doing it i'm getting an error report about "timeout period" i didn't found anything about it and i need help!! this is my code: clc %converting a m*n matrix to one long row matrix %bw = imread('C:\Documents and Settings\matanya\Desktop\r1.bmp'); %imfinfo('C:\Documents and Settings\matanya\Desktop\r1.bmp') %[w h]=size(bw); row=[1 2 3]; %for i=1:w % for j=1:h % row=[row bw(i,j)]; % end %end %transmit and receive %1)creating a serial port object s = serial('COM1'); %in the ...

Sending data using the rs232 port
Hi, I want to send some data over the com port to my microcontroller. I installed the Java Communications API, and i tried to get the sample code working. But it didnt work. For some reason it cant find my Com port. portList = CommPortIdentifier.getPortIdentifiers(); This line is the source of the problem. the portList stays empty. FYI, im using windows XP, and i have an USB to rs232 converter (http://www.pci-card.com/usb-rs232-kabel.jpg) on COM1. Could it be that those converters aint supported by the Java Comm API? I already found a programm on serialio.com. that one does work. But i do...

problem with send the data to serial port
hello, i want to serially communicate the data like distance and angle to the controller with matlab,,but problem is that , it cant send to serial port of matlab...plz reply if you have any solution... ...

use Serial Port in Matlab 2006
Dear All, I have a problem about how to comunication with COM port use MATLAB... I want to control all pin of COM port (not only TxD n RxD pin), how to do that?? Pls help me... I'm waiting your answer.... Thank you Rgd, TAUFIQ 2006 was pretty long ago, but I think it is the same as now. If you look at the Matlab documentation for the serial port there is a link to the properties you can set. You can also find them like this: a = serial('COM1') get(a) b = a.PinStatus There in b you will have the status of the respective pins. You can then use a set() to change it. ...

Sending Data Continuously to Serial Port
Hi, I need to be able to send a a stream of data continuously through the serial port (at 19200 baud). I have set up a simple project that just sends "hello world" continuously through the port via a thread that seems to work until I close the port, when it often hangs (beachball) for up to say 7 - 8 seconds. The project has 3 bottons - 1 to open the port, another to close it and the third to start the thread. Here is the code: bOpenPort: serial1.port = popupMenu1.listIndex call serial1.open portOpen = true (this is a global) bClosePo...

Problem with receiving data from matlab serial port
hi, I AM Raghu Nandan Ravi and I am currently doing a project on transmission of digital video images using Matlab. I am having a problem with reading the data from the device connected to my serial port. when ever the receive buffer is full and when i simulate the program i have written it is giving error message that the time out has reached before the terminator occured. can any one help me with this problem. the program i have written is shown below.: ************************************************************ obj=serial('com6') set(obj,'baudrate',19200,'inp...

reading data from a serial port using regexp
my serial port data something like (values dont come in the same order ) ----------------------------------------- example of serial port output serial = A100 B200 C300 D700 A200 D500 .................. etc -------------------------------------- code: serial = serial('COM4'); fopen(s); output = 'a'; figure hold on for i = 1 : 200 output= fscanf(serial); d=regexp(output,'D\w*','match') DD=d{:,1}(2:end) plot ( DD, 'g') ; drawnow end ---------------------------------------...

how to take data from usb port using matlab
i want to take data from the usb port of my laptop .is there any port address for it? On 10-12-08 12:56 PM, vidit wrote: > i want to take data from the usb port of my laptop .is there any port > address for it? *If* the USB device is one that that Matlab happens to have a driver for (which is not generally the case), the a "usb port" on the device would be an device "endpoint" that the device reported it had along with the properties of the endpoint. If the properties were recognized, then the Instrument Control Toolbox might be able to find the endpoin...

Reading data from serial port using c++
I am interfacing with a C+ program file over an rs-232 connection i.e gener= ating a DLL file and calling that function from labview.<br><br>The functio= n work fine with the visual c++ 6.0 but whenever I am calling that function= from labview it is giving me the following error.<br><br>?An exception occ= urred within the external code called by a Call Library Node. This might ha= ve corrupted LabVIEW?s memory. Save any work to a new location and restart = Labview.?<br><br><br><br>I am attaching the code for your convenience.<br><= br&g...

serial port connection using minicom: no data
I'm trying to connect to a Storage-box via the serial port. The "Command Line Interface" is supposed to fire up when I use 115200 bps, 8 data bits, none-parity, stop bit =1 , and none for flow control. I tried setting these options using "minicom -s" Serial Device : /dev/ttyS0 Bps/Par/Bits : 115200 8N1 Hardware Flow Control : No | Software Flow Control : No I still don't get the CLI. Even after using "Press Enter once to launch the CLI." I tried using both ttyS0 and ttyS1 dmesg ...

using matlab serial to receive data asychronously
Hello all, I'm doing a stident project, making a MATLAB GUI using GUIDE to sort tomato. In my MATLAB GUI, i need to receive signal from uC and sensor that tomato is available to be captured, receive the image from PC camera, image processing, then send the result (tomato grade) to the uC. Then the uC will move stepper motor to place the tomato to its corresponding bag (3 bag, good, medium, poor tomato). I have been able to receive data from camera, image processing it, and send data to uC with my MATLAB GUI. Problem is, i cant receive signal from sensor and uC to start capture (so far, i ...

send some data to parallel port withing MATLAB
Hi All Is there any way to send some data to parallel port withing MATLAB, under win98 or win2000? Thanks in advance S. Rasouli Visit http://www.mathworks.com/products/daq/index.html -- the Data Acquisition Toolbox provides access to the parallel port. Also, it's a frequent topic in the newsgroup, and googling "MATLAB parallel port" gives good results. -Rob ------- Rob Purser Data Acquisition Software Engineer The Mathworks rob.purser@mathworks.com 508-647-7131 ----- The MathWorks, Inc. - 3 Apple Hill Drive, Natick, MA 01760 - 508-647-7000 "Saifollah Rasouli , rasoul...

How to read it data from USB port by using matlab?
I wanna to ask whether have anybody know how to read it the data from the USB port by using Matlab? Meng wrote: > I wanna to ask whether have anybody know how to read it the data from > the USB port by using Matlab? > http://www.mathworks.com/support/solutions/data/1-195HX.html?solution=1-195HX Is a good starting point. todd Essentially, there's no way to access the USB port directly. It's more like ethernet than a serial port, since it has a standard set of protocols for devices to share the communication channels. You have to write a device driver for the USB de...