Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to use To Instrument Block in Simulink to send variable Data to Serial Port??

Status
Not open for further replies.

xpress_embedo

Advanced Member level 4
Joined
Jul 5, 2011
Messages
1,154
Helped
161
Reputation
396
Reaction score
189
Trophy points
1,353
Location
India
Activity points
10,591
Hello!! Everyone i am new in Simulink and wants to send data over Serial Port using Serial Port. I came to know about blocks in Instrument Control Toolbox. Serial Send, Serial Receive, To Instrument and Query

As i have to send data, i choose serial send.

I configure the Serial Configuration and then use Serial Send block to send data, get unexpected data. I changed to "To Instrument Block" and read this tutorial

https://www.mathworks.in/help/instr...odels-to-send-and-receive-data.html#brbv5x6-1

to send data to Serial Port.

But Suppose i want to send "xpress_embedo\r\n" whole string to serial port then how can i do this. Please some one help me.
 

you can send the ascii code, and on the other side(i don't know what you use to recieve the data) for example a micro,scan the data with %c or %s(depending on which micro or which language you use) for a array of characters or string.
in rs232 protocol you can only send a binary data,eventhough matlab sends on multiple formats, but at last it is converted to binary
so you can code your string with an algorithm and send it over com port and recieve the binary data ,and encode it with down to up of your used algorithm
hope this helps :)
 


you can use serial send block to send data over com port
you can use a constant block to give the input data of serial send block,just be sure to change the sample time from -1(inherieted) to sth else
to istrument block also should work , and many pages i read says it's working fine, but i tested without any result
about the string one , i never heared that u can send data as string
you can do as isaid,code your string as integer in transmiter side and encode it in the reciever side
you can use several blocks in simulink to do that ;)
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top