Simulink Real-Time I/O Reference

Simulink Real-Time I/O Reference
‫معرفی چند منبع در زمینه آموزش برنامه نویسی ‪ MATLAB‬یا متلب‬
‫کتاب های به زبان انگلیسی‬
‫عنوان‪Matlab, Third Edition: A Practical Introduction to :‬‬
‫‪Programming and Problem Solving‬‬
‫ترجمه عنوان‪ :‬متلب‪ :‬مقدمه ای عملی بر برنامه نويسی و حل مساله‪ ،‬چاپ سوم‬
‫مولفین‪Stormy Attaway :‬‬
‫سال چاپ‪2013 :‬‬
‫انتشارات‪Butterworth-Heinemann :‬‬
‫کتاب های به زبان فارسی‬
‫عنوان‪ :‬اصول و مبانی متلب برای علوم مهندسی‬
‫مولفین‪ :‬برايان هان‪ ،‬دانیل تی‪ ،‬والنتین‬
‫مترجمین‪ :‬رامین موالنا پور‪ ،‬سارا موالناپور‪ ،‬نینا اسدی پور‬
‫انتشارات‪ :‬سها دانش‬
‫لینک دسترسی‪ :‬لینک‬
‫لینک دسترسی‪ :‬لینک‬
‫عنوان‪MATLAB For Dummies :‬‬
‫ترجمه عنوان‪ :‬تلب به زبان ساده‬
‫مولفین‪Jim Sizemore, John Paul Mueller :‬‬
‫سال چاپ‪2014 :‬‬
‫انتشارات‪For Dummies :‬‬
‫عنوان‪ :‬کاربرد ‪ MATLAB‬در علوم مهندسی‬
‫مولفین‪ :‬حیدرعلی شايانفر‪ ،‬حسین شايقی‬
‫انتشارات‪ :‬ياوريان‬
‫لینک دسترسی‪ :‬لینک‬
‫لینک دسترسی‪ :‬لینک‬
‫عنوان‪Essential MATLAB for Engineers and Scientists :‬‬
‫عنوان‪ :‬برنامه نويسی ‪ MATLAB‬برای مهندسان‬
‫ترجمه عنوان‪ :‬آنچه بايد مهندسین و دانشمندان از متلب بدانند‬
‫مولفین‪ :‬محمود کشاورز مهر‪ ،‬بهزاد عبدی‬
‫مولفین‪Brian Hahn, Daniel Valentine:‬‬
‫سال چاپ‪2013 :‬‬
‫انتشارات‪Academic Press :‬‬
‫انتشارات‪ :‬نوپردازان‬
‫لینک دسترسی‪ :‬لینک‬
‫لینک دسترسی‪ :‬لینک‬
‫عنوان‪MATLAB: An Introduction with Applications :‬‬
‫عنوان‪ :‬آموزش کاربردی مباحث پیشرفته با ‪MATLAB‬‬
‫ترجمه عنوان‪ :‬مقدمه ای بر متلب و کاربردهای آن‬
‫مولفین‪ :‬نیما جمشیدی‪ ،‬علی ابويی مهريزی‪ ،‬رسول مواليی‬
‫مولف‪Amos Gilat :‬‬
‫انتشارات‪ :‬عابد‬
‫سال چاپ‪2014 :‬‬
‫انتشارات‪Wiley :‬‬
‫لینک دسترسی‪ :‬لینک‬
‫لینک دسترسی‪ :‬لینک‬
‫عنوان‪MATLAB For Beginners: A Gentle Approach:‬‬
‫عنوان‪ :‬کاملترين مرجع آموزشی و کاربردی ‪MATLAB‬‬
‫ترجمه عنوان‪ :‬متلب برای افراد مبتدی با يک رويکرد تدريجی‬
‫مولفین‪ :‬علی اکبر علمداری‪ ،‬نسرين علمداری‬
‫مولف‪Peter I. Kattan:‬‬
‫انتشارات‪ :‬نگارنده دانش‬
‫سال چاپ‪2008 :‬‬
‫انتشارات‪CreateSpace Independent Publishing Platform :‬‬
‫لینک دسترسی‪ :‬لینک‬
‫لینک دسترسی‪ :‬لینک‬
‫عنوان‪MATLAB for Engineers :‬‬
‫عنوان‪ :‬برنامه نويسی ‪ MATLAB‬برای مهندسین‬
‫ترجمه عنوان‪ :‬متلب برای مهندسین‬
‫مولف‪ :‬استفن چاپمن‬
‫مولف‪Holly Moore :‬‬
‫سال چاپ‪2011 :‬‬
‫انتشارات‪Prentice Hall :‬‬
‫لینک دسترسی‪ :‬لینک‬
‫عنوان‪Mastering MATLAB :‬‬
‫ترجمه عنوان‪ :‬تسلط بر متلب‬
‫مولفین‪Duane C. Hanselman, Bruce L. Littlefield :‬‬
‫سال چاپ‪2011 :‬‬
‫انتشارات‪Prentice Hall :‬‬
‫لینک دسترسی‪ :‬لینک‬
‫مترجم‪ :‬سعدان زکائی‬
‫انتشارات‪ :‬دانشگاه صنعتی خواجه نصیرالدين طوسی‬
‫لینک دسترسی‪ :‬لینک‬
‫عنوان‪ :‬آموزش گام به گام محاسبات عددی با متلب‬
‫مولف‪ :‬کلیو مولر‬
‫مترجم‪ :‬رسول نصیری‬
‫انتشارات‪ :‬نشر گستر‬
‫لینک دسترسی‪ :‬لینک‬
‫منابع آموزشی آنالین‬
‫عنوان‪ :‬مجموعه فرادرسهای برنامهنويسی متلب‬
‫مدرس‪ :‬دکتر سید مصطفی کالمی هريس‬
‫مدت زمان‪ ۹ :‬ساعت و ‪ ۳‬دقیقه‬
‫زبان‪ :‬فارسی‬
‫ارائه دهنده‪ :‬فرادرس‬
‫لینک دسترسی‪ :‬لینک‬
‫عنوان‪ :‬مجموعه فرادرسهای متلب برای علوم و مهندسی‬
‫مدرس‪ :‬دکتر سید مصطفی کالمی هريس‬
‫مدت زمان‪ 14 :‬ساعت و ‪ 2۲‬دقیقه‬
‫زبان‪ :‬فارسی‬
‫ارائه دهنده‪ :‬فرادرس‬
‫لینک دسترسی‪ :‬لینک‬
‫عنوان‪ :‬مجموعه فرادرسهای برنامه نويسی متلب پیشرفته‬
‫مدرس‪ :‬دکتر سید مصطفی کالمی هريس‬
‫مدت زمان‪ ۲ :‬ساعت و ‪ 12‬دقیقه‬
‫زبان‪ :‬فارسی‬
‫ارائه دهنده‪ :‬فرادرس‬
‫لینک دسترسی‪ :‬لینک‬
‫عنوان‪Introduction to Programming with MATLAB :‬‬
‫ترجمه عنوان‪ :‬آشنايی با برنامهنويسی متلب‬
‫مدرسین‪Akos Ledeczi, Michael Fitzpatrick, Robert Tairas :‬‬
‫زبان‪ :‬انگلیسی‬
‫ارائه دهنده‪Vanderbilt University :‬‬
‫لینک دسترسی‪ :‬لینک‬
‫عنوان‪Introduction to MATLAB :‬‬
‫ترجمه عنوان‪ :‬مقدمهای بر متلب‬
‫مدرس‪Danilo Šćepanović :‬‬
‫زبان‪ :‬انگلیسی‬
‫ارائه دهنده‪MIT OCW :‬‬
‫لینک دسترسی‪ :‬لینک‬
‫عنوان‪Up and Running with MATLAB :‬‬
‫ترجمه عنوان‪ :‬شروع سريع کار با متلب‬
‫مدرس‪Patrick Royal :‬‬
‫زبان‪ :‬انگلیسی‬
‫ارائه دهنده‪lynda.com :‬‬
‫لینک دسترسی‪ :‬لینک‬
‫عنوان‪Modelling and Simulation using MATLAB :‬‬
‫ترجمه عنوان‪ :‬مدلسازی و شبیهسازی با استفاده از متلب‬
‫مدرسین‪ Prof. Dr.-Ing. Georg Fries :‬و دیگران‬
‫زبان‪ :‬انگلیسی‬
‫ارائه دهنده‪iversity.org :‬‬
‫لینک دسترسی‪ :‬لینک‬
Simulink® Real-Time™
I/O Reference
R2015a
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
How to Contact MathWorks
Latest news:
www.mathworks.com
Sales and services:
www.mathworks.com/sales_and_services
User community:
www.mathworks.com/matlabcentral
Technical support:
www.mathworks.com/support/contact_us
Phone:
508-647-7000
The MathWorks, Inc.
3 Apple Hill Drive
Natick, MA 01760-2098
Simulink® Real-Time™ I/O Reference
© COPYRIGHT 2000–2015 by The MathWorks, Inc.
The software described in this document is furnished under a license agreement. The software may be used
or copied only under the terms of the license agreement. No part of this manual may be photocopied or
reproduced in any form without prior written consent from The MathWorks, Inc.
FEDERAL ACQUISITION: This provision applies to all acquisitions of the Program and Documentation
by, for, or through the federal government of the United States. By accepting delivery of the Program
or Documentation, the government hereby agrees that this software or documentation qualifies as
commercial computer software or commercial computer software documentation as such terms are used
or defined in FAR 12.212, DFARS Part 227.72, and DFARS 252.227-7014. Accordingly, the terms and
conditions of this Agreement and only those rights specified in this Agreement, shall pertain to and
govern the use, modification, reproduction, release, performance, display, and disclosure of the Program
and Documentation by the federal government (or other entity acquiring for or through the federal
government) and shall supersede any conflicting contractual terms or conditions. If this License fails
to meet the government's needs or is inconsistent in any respect with federal procurement law, the
government agrees to return the Program and Documentation, unused, to The MathWorks, Inc.
Trademarks
MATLAB and Simulink are registered trademarks of The MathWorks, Inc. See
www.mathworks.com/trademarks for a list of additional trademarks. Other product or brand
names may be trademarks or registered trademarks of their respective holders.
Patents
MathWorks products are protected by one or more U.S. patents. Please see
www.mathworks.com/patents for more information.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Revision History
November 2000
June 2001
September 2001
July 2002
September 2002
September 2003
June 2004
August 2004
October 2004
November 2004
March 2005
September 2005
March 2006
May 2006
September 2006
March 2007
September 2007
March 2008
October 2008
March 2009
September 2009
March 2010
September 2010
April 2011
September 2011
March 2012
September 2012
March 2013
September 2013
March 2014
October 2014
March 2015
Online only
Online only
Online only
Online only
Online only
Online only
Online only
Online only
Online only
Online only
Online only
Online only
Online only
Online only
Online only
Online only
Online only
Online only
Online only
Online only
Online only
Online only
Online only
Online only
Online only
Online only
Online only
Online only
Online only
Online only
Online only
Online only
Revised for Version 1.1 (Release 12)
Revised for Version 1.2 (Release 12.1)
Revised for Version 1.3 (Release 12.1+)
Revised for Version 2 (Release 13)
Revised for Version 2.0.1 (Release 13)
Revised for Version 2.0.1 (Release 13SPI)
Revised for Version 2.5 (Release 14)
Revised for Version 2.6 (Release 14+)
Revised for Version 2.6.1 (Release 14SP1)
Revised for Version 2.7 (Release 14SP1+)
Revised for Version 2.7.2 (Release 14SP2)
Revised for Version 2.8 (Release 14SP3)
Revised for Version 2.9 (Release 2006a)
Revised for Version 3.0 (Release 2006a+)
Revised for Version 3.1 (Release 2006b)
Revised for Version 3.2 (Release 2007a)
Revised for Version 3.3 (Release 2007b)
Revised for Version 3.4 (Release 2008a)
Revised for Version 4.0 (Release 2008b)
Revised for Version 4.1 (Release 2009a)
Revised for Version 4.2 (Release 2009b)
Revised for Version 4.3 (Release 2010a)
Revised for Version 4.4 (Release 2010b)
Revised for Version 5.0 (Release 2011a)
Revised for Version 5.1 (Release 2011b)
Revised for Version 5.2 (Release 2012a)
Revised for Version 5.3 (Release 2012b)
Revised for Version 5.4 (Release 2013a)
Revised for Version 5.5 (Release 2013b)
Revised for Version 6.0 (Release 2014a)
Revised for Version 6.1 (Release 2014b)
Revised for Version 6.2 (Release 2015a)
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ | ‪www.MatlabSite.com‬‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Contents
Introduction, RS-232, GPIB
1
2
Simulink Real-Time I/O Library
I/O Driver Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Speedgoat I/O Modules . . . . . . . . . . . . . . . . . . . . . . . . .
Third-Party Driver Blocks . . . . . . . . . . . . . . . . . . . . . . .
I/O Driver Block Library . . . . . . . . . . . . . . . . . . . . . . . .
Memory-Mapped Devices . . . . . . . . . . . . . . . . . . . . . . . .
ISA Bus I/O Devices . . . . . . . . . . . . . . . . . . . . . . . . . . .
PCI Bus I/O Devices . . . . . . . . . . . . . . . . . . . . . . . . . . .
Simulink Real-Time I/O Driver Structures . . . . . . . . . .
Simulink Real-Time Support and SimState . . . . . . . . . .
PWM and FM Driver Block Notes . . . . . . . . . . . . . . . . .
Driver Block Documentation . . . . . . . . . . . . . . . . . . . .
1-2
1-2
1-2
1-3
1-4
1-4
1-4
1-5
1-7
1-9
1-10
Add I/O Blocks to Simulink Model . . . . . . . . . . . . . . . . .
1-11
Defining I/O Block Parameters . . . . . . . . . . . . . . . . . . .
1-13
Serial Communications Support
RS-232 I/O Drivers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Hardware Connections for RS-232 . . . . . . . . . . . . . . . .
Links Between Development and Target Computers . . .
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
2-2
2-3
2-3
v
RS-232/422/485 Drivers (Composite) . . . . . . . . . . . . . . . .
Adding RS-232 Blocks . . . . . . . . . . . . . . . . . . . . . . . . . .
Building and Running the Real-Time Application
(Composite) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
RS-232/422/485 Simulink Block Reference . . . . . . . . . .
2-10
2-11
Boards and Blocks — Alphabetical List . . . . . . . . . . . .
2-17
2-5
2-6
CAN, Ethernet, EtherCAT
CAN I/O Support
3
vi
Contents
CAN Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Simulink Real-Time CAN Library . . . . . . . . . . . . . . . . .
Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Sending and Receiving Remote Frames . . . . . . . . . . . . .
3-2
3-2
3-3
3-4
Supported Softing Boards . . . . . . . . . . . . . . . . . . . . . . . .
CAN-AC2-PCI with SJA1000 Controller . . . . . . . . . . . .
CAN-AC2-104 with SJA1000 Controller . . . . . . . . . . .
3-6
3-7
3-17
Model Execution Driven by CAN Messages . . . . . . . . .
CAN-AC2 (ISA) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CAN-AC2-PCI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CAN-AC2-104 (PC/104) . . . . . . . . . . . . . . . . . . . . . . . .
3-56
3-56
3-57
3-58
Initialization and Termination CAN Messages . . . . . .
3-60
CAN Data Frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3-62
Timeouts When Receiving CAN Messages . . . . . . . . . .
3-63
Blocks — Alphabetical List . . . . . . . . . . . . . . . . . . . . . . .
3-65
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
4
5
CAN I/O Support for FIFO
CAN FIFO Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
FIFO Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
FIFO Mode Drivers for CAN Boards from Softing . . . . .
4-2
4-2
4-4
Acceptance Filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4-43
CANdb DBC Format Databases . . . . . . . . . . . . . . . . . . .
4-45
CAN FIFO Loopback Tests . . . . . . . . . . . . . . . . . . . . . . .
4-46
Blocks — Alphabetical List . . . . . . . . . . . . . . . . . . . . . . .
4-49
Model-Based Ethernet Communications Support
Model-Based Ethernet Communications . . . . . . . . . . . . .
What Is Model-Based Ethernet Communications? . . . . .
PCI Bus and Slot Numbers . . . . . . . . . . . . . . . . . . . . . .
MAC Addresses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Network Buffer Pointers . . . . . . . . . . . . . . . . . . . . . . . .
Filter Type and Filter Address Blocks . . . . . . . . . . . . . .
Execution Priority . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Simulink Real-Time Ethernet Block Library . . . . . . . . .
5-2
5-2
5-2
5-3
5-4
5-4
5-4
5-4
Using Simulink Real-Time for Ethernet
Communications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5-5
Blocks — Alphabetical List . . . . . . . . . . . . . . . . . . . . . . .
5-6
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
vii
6
7
viii
Contents
Network Buffer Library for Model-Based
Ethernet Communications Support
Network Buffer Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . .
6-2
Blocks — Alphabetical List . . . . . . . . . . . . . . . . . . . . . . .
6-3
Model-Based EtherCAT Communications
Support
Modeling EtherCAT Networks . . . . . . . . . . . . . . . . . . . . .
Blocks and Tasks . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Order of Network Events . . . . . . . . . . . . . . . . . . . . . . .
7-3
7-3
7-4
Install EtherCAT Hardware and Software for
Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7-6
EtherCAT Installation and Setup Requirements . . . . . .
7-7
Configure EtherCAT Hardware . . . . . . . . . . . . . . . . . . . .
7-8
Scan EtherCAT Network . . . . . . . . . . . . . . . . . . . . . . . . .
7-9
Configure EtherCAT Master Node Data . . . . . . . . . . . .
7-11
Create EtherCAT Task . . . . . . . . . . . . . . . . . . . . . . . . . .
7-12
Configure EtherCAT Task Inputs . . . . . . . . . . . . . . . . .
7-14
Configure EtherCAT Task Outputs . . . . . . . . . . . . . . . .
7-16
Export and Save EtherCAT Configuration . . . . . . . . . .
7-18
Install EtherCAT Network for Execution . . . . . . . . . . .
7-19
Configure EtherCAT Master Node Model . . . . . . . . . . .
7-20
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Configure EtherCAT Init Block . . . . . . . . . . . . . . . . . . .
7-21
Configure EtherCAT PDO Receive Blocks . . . . . . . . . .
7-23
Configure EtherCAT PDO Transmit Blocks . . . . . . . . .
7-24
Configure EtherCAT Model Configuration Parameters
7-25
Fixed-Step Size Derivation . . . . . . . . . . . . . . . . . . . . . . .
7-27
EtherCAT Protocol Mapping . . . . . . . . . . . . . . . . . . . . .
7-28
EtherCAT Configurator Component Mapping . . . . . . .
7-29
EtherCAT-Compatible Ethernet Chip Sets . . . . . . . . . .
Intel Gigabit Ethernet Chip Sets . . . . . . . . . . . . . . . . .
Intel Fast Ethernet (10/100) Chip Sets . . . . . . . . . . . .
7-30
7-30
7-32
EtherCAT Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . .
7-33
EtherCAT Init Block Error Values . . . . . . . . . . . . . . . .
7-34
EtherCAT Init Block DC Error Values . . . . . . . . . . . . .
7-36
Blocks — Alphabetical List . . . . . . . . . . . . . . . . . . . . . . .
7-37
UDP
8
Real-Time UDP Communication Support
Using Real-Time UDP Communications . . . . . . . . . . . . .
8-2
Blocks — Alphabetical List . . . . . . . . . . . . . . . . . . . . . . .
8-3
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
ix
9
IP Library for Real-Time UDP Communication
Support
Low-Level Internet Protocol Library . . . . . . . . . . . . . . .
9-2
Blocks — Alphabetical List . . . . . . . . . . . . . . . . . . . . . . .
9-3
UDP I/O Support
10
User Datagram Protocol (UDP) . . . . . . . . . . . . . . . . . . .
10-2
UDP Transport Protocol . . . . . . . . . . . . . . . . . . . . . . . . .
10-3
Two-Way Data Exchange Using UDP . . . . . . . . . . . . . .
10-6
UDP Communication Setup . . . . . . . . . . . . . . . . . . . . .
10-11
UDP and Variable-Size Signals . . . . . . . . . . . . . . . . . .
10-12
Boards and Blocks — Alphabetical List . . . . . . . . . . .
10-14
Parallel Ports, J1939, Shared Memory
Parallel Ports
11
Using Parallel Ports . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Using the Parallel Port as an Interrupt Source . . . . . .
Using Add-On Parallel Port Boards . . . . . . . . . . . . . . .
x
Contents
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
11-2
11-2
11-3
11-4
Boards and Blocks — Alphabetical List . . . . . . . . . . . .
SAE J1939
12
13
11-5
SAE J1939 Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12-2
Blocks — Alphabetical List . . . . . . . . . . . . . . . . . . . . . . .
12-3
Shared Memory Support
GE Fanuc Embedded Systems Shared Memory . . . . . .
13-2
Create GE Fanuc Shared Partitions . . . . . . . . . . . . . . .
13-3
Initialize GE Fanuc Shared Nodes . . . . . . . . . . . . . . . .
13-5
GE Fanuc Shared Partition Structure . . . . . . . . . . . . .
13-7
GE Fanuc Shared Node Initialization Structure . . . . .
Board Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Board Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Board Node ID . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13-9
13-9
13-10
13-12
GE Intelligent Platforms Shared Memory . . . . . . . . .
13-14
Create GE Intelligent Platforms Shared Partitions . .
13-15
Initialize GE Intelligent Platforms Shared Nodes . . .
13-18
GE Intelligent Platforms Shared Partition Structure
13-20
GE Intelligent Platforms Shared Node Initialization
Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Board Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13-22
13-23
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
xi
Curtiss-Wright Electronic Systems Shared Memory .
13-25
Create Curtiss-Wright Shared Partitions . . . . . . . . . .
13-26
Initialize Curtiss-Wright Shared Nodes . . . . . . . . . . .
13-28
Curtiss-Wright Shared Partition Structure . . . . . . . .
Alignment Examples . . . . . . . . . . . . . . . . . . . . . . . . .
13-29
13-32
Curtiss-Wright Shared Node Initialization Structure
Board Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Board Timeout . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Board Data Filter . . . . . . . . . . . . . . . . . . . . . . . . . . .
Virtual Paging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Board Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13-34
13-34
13-36
13-36
13-37
13-37
Boards and Blocks — Alphabetical List . . . . . . . . . . .
13-39
Video, XCP
14
xii
Contents
Video Image Processing
Process Video Images Using Simulink Real-Time . . . .
14-2
USB Video Display on Development Computer . . . . . .
14-3
USB Video Display on Target Computer . . . . . . . . . . .
14-4
Camera Link Camera Display on Development
Computer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
14-5
Camera Link Camera Display on Target Computer . .
14-6
Acquire Images from Camera Link Cameras . . . . . . . .
14-7
Camera Link Camera Triggering . . . . . . . . . . . . . . . . . .
14-8
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Serial Camera Configuration . . . . . . . . . . . . . . . . . . . .
14-12
Install BitFlow Neon-CLB Support . . . . . . . . . . . . . . .
14-14
Boards and Blocks — Alphabetical List . . . . . . . . . . .
14-15
XCP Support
15
XCP Protocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15-2
XCP Block Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15-3
Blocks — Alphabetical List . . . . . . . . . . . . . . . . . . . . . . .
15-4
Adlink
16
Boards and Blocks — Alphabetical List . . . . . . . . . . . . . . . .
16-2
BittWare
17
Running Models with BittWare Blocks . . . . . . . . . . . . . . . . .
Model Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Frame Size, Sample Rate, and Sample Time Parameter
Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
17-2
17-2
17-4
xiii
BVM, Contec, Curtiss-Wright
BVM
18
Boards and Blocks — Alphabetical List . . . . . . . . . . . .
18-2
Contec
19
Boards and Blocks — Alphabetical List . . . . . . . . . . . .
19-3
Curtiss-Wright Electronic Systems
20
Board and Blocks — Alphabetical List . . . . . . . . . . . . .
20-2
Diamond, FlexRay, GE
Diamond
21
Boards and Blocks — Alphabetical List . . . . . . . . . . . .
xiv
Contents
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
21-4
22
Model-Based FlexRay Communications Support
Install FlexRay Hardware and Software for
Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22-3
FlexRay Installation and Setup Requirements . . . . . .
22-4
Configure FlexRay Node for Signal Access . . . . . . . . .
22-5
Create Busmirror Project for Signal Access . . . . . . . . .
22-6
Select FlexRay Node for Signal Access . . . . . . . . . . . . .
22-9
Refine FlexRay Node for Signal Access . . . . . . . . . . .
22-10
Generate Project Code for Signal Access . . . . . . . . . .
22-13
Prepare FlexRay Network for Signal Access . . . . . . .
22-17
Prepare FlexRay Model for Signal Access . . . . . . . . .
22-18
Configure FlexRay Config Blocks for Signal Access .
22-20
Configure FlexRay Write Frame Signals Blocks for
Signal Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22-22
Configure FlexRay Read Frame Signals Blocks for Signal
Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22-27
Configure FlexRay POC Status Blocks for Signal
Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22-30
Configure FlexRay Model Configuration Parameters for
Signal Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22-31
Configure FlexRay Node for PDU Access . . . . . . . . . .
22-34
Create Busmirror Project for PDU Access . . . . . . . . .
22-35
Select FlexRay Node for PDU Access . . . . . . . . . . . . .
22-38
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
xv
Refine FlexRay Node for PDU Access . . . . . . . . . . . . .
22-39
Generate Project Code for PDU Access . . . . . . . . . . .
22-42
Prepare FlexRay Network for PDU Access . . . . . . . . .
22-46
Prepare FlexRay Model for PDU Access . . . . . . . . . . .
22-47
Configure FlexRay Config Blocks for PDU Access . . .
22-49
Configure FlexRay Pack PDU Blocks . . . . . . . . . . . . .
22-51
Configure FlexRay Write PDU Blocks . . . . . . . . . . . . .
22-55
Configure FlexRay Commit Frame Block for PDU
Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22-59
Configure FlexRay Read PDU Blocks . . . . . . . . . . . . .
22-61
Configure FlexRay Unpack PDU Blocks . . . . . . . . . . .
22-64
Configure FlexRay POC Status Blocks for PDU
Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22-66
Configure FlexRay Model Configuration Parameters for
PDU Access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22-67
xvi
Contents
Configure FlexRay Node for Error Injection . . . . . . .
22-70
Create Busmirror Project for Error Injection . . . . . .
22-71
Select FlexRay Node for Error Injection . . . . . . . . . .
22-74
Refine FlexRay Node for Error Injection . . . . . . . . . .
22-75
Generate Project Code for Error Injection . . . . . . . . .
22-77
Prepare FlexRay Network for Error Injection . . . . . .
22-81
Prepare FlexRay Model for Error Injection . . . . . . . .
22-82
Configure FlexRay Config Blocks for Error Injection
22-84
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Configure FlexRay Write Frame Signals Blocks for Error
Injection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22-86
Configure FlexRay Read Frame Signals Blocks for Error
Injection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22-91
Configure FlexRay Error Injection Blocks . . . . . . . . .
22-94
Configure FlexRay POC Status Blocks for Error
Injection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22-99
Configure FlexRay Model Configuration Parameters for
Error Injection . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22-100
23
Evaluate Clear from Bus Preconditions . . . . . . . . . .
Frame Triggering Assigned to Nonsynchronization
Slot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Frame Triggering Assigned to Nonzero Buffer . . . . .
22-103
FlexRay Troubleshooting . . . . . . . . . . . . . . . . . . . . . .
Model Configuration . . . . . . . . . . . . . . . . . . . . . . . .
Build and Download . . . . . . . . . . . . . . . . . . . . . . . .
Execution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
22-105
22-105
22-105
22-106
Blocks — Alphabetical List . . . . . . . . . . . . . . . . . . . . .
22-107
22-103
22-103
GE Intelligent Platforms
ARINC 429 Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
23-2
MIL-STD-1553 Support . . . . . . . . . . . . . . . . . . . . . . . . . .
23-3
MIL-STD-1553 Initialization . . . . . . . . . . . . . . . . . . . . . .
23-5
Remote Terminal Operation . . . . . . . . . . . . . . . . . . . . . .
23-6
Bus Controller Operation . . . . . . . . . . . . . . . . . . . . . . . .
23-8
Remote Terminal and Bus Controller Operation . . . .
23-10
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
xvii
Bus Monitor Operation . . . . . . . . . . . . . . . . . . . . . . . . .
23-12
Boards and Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
23-14
SBS Technologies Support . . . . . . . . . . . . . . . . . . . . . .
23-17
Boards and Blocks — Alphabetical List . . . . . . . . . . .
23-19
General Standards, HUMUSOFT
General Standards
24
PMC-ADADIO Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24-2
Adding A/D Blocks for Analog Input . . . . . . . . . . . . . . .
24-4
Adding Enable Signal Blocks for Input Enable . . . . . .
24-6
Adding D/A Blocks for Analog Output . . . . . . . . . . . . .
24-8
Interleaving Analog Input and Output Blocks . . . . . .
24-10
Using Multiple PMC-ADADIO Boards . . . . . . . . . . . . .
24-12
Overview of Audio Applications . . . . . . . . . . . . . . . . .
24-14
Boards and Blocks — Alphabetical List . . . . . . . . . . .
24-15
HUMUSOFT
25
Boards and Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
xviii
Contents
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
25-2
MathWorks, Measurement Computing, MPL
MathWorks
26
27
xPC TargetBox Support . . . . . . . . . . . . . . . . . . . . . . . . .
26-2
xPC TargetBox I/O Options . . . . . . . . . . . . . . . . . . . . . .
26-3
Measurement Computing
Boards and Blocks — Alphabetical List . . . . . . . . . . . .
MPL
28
Boards and Blocks — Alphabetical List . . . . . . . . . . . .
29
27-2
28-2
National Instruments
Boards and Blocks — Alphabetical List . . . . . . . . . . . . . . . .
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
29-5
xix
NAII, Quanser, Real Time Devices
30
North Atlantic Industries, Inc.
Boards and Blocks — Alphabetical List . . . . . . . . . . . .
30-2
Quanser
31
Boards and Blocks — Alphabetical list . . . . . . . . . . . . .
31-2
Real Time Devices
32
Boards and Blocks — Alphabetical List . . . . . . . . . . . .
32-2
Sensoray, Speedgoat, Texas Instruments
Sensoray
33
Boards and Blocks — Alphabetical List . . . . . . . . . . . .
xx
Contents
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
33-2
Speedgoat
34
Speedgoat FPGA Support . . . . . . . . . . . . . . . . . . . . . . . .
34-2
Blocks — Alphabetical List . . . . . . . . . . . . . . . . . . . . . . .
34-5
Speedgoat Real-Time Target Machines . . . . . . . . . . .
34-113
Speedgoat I/O Modules . . . . . . . . . . . . . . . . . . . . . . . .
34-114
Speedgoat Communication Protocols . . . . . . . . . . . .
34-116
Texas Instruments
35
Boards and Blocks — Alphabetical List . . . . . . . . . . . .
35-2
UEI, Versalogic, Miscellaneous
36
United Electronic Industries (UEI)
Specifying UEI Boards . . . . . . . . . . . . . . . . . . . . . . . . . .
Changing the Board Associated with the Block . . . . . .
Getting Information on a Specific Board . . . . . . . . . . .
36-4
36-4
36-4
Analog Input Frame Driver Blocks . . . . . . . . . . . . . . . .
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Notes on Master and Slave Boards . . . . . . . . . . . . . . .
Interrupt Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . .
IRQ Source Block . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Example Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
36-6
36-6
36-6
36-7
36-9
36-9
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
xxi
Boards and Blocks — Alphabetical List . . . . . . . . . . .
Versalogic
37
Boards and Blocks — Alphabetical List . . . . . . . . . . . .
38
36-11
37-2
Target Management and Displays and Logging
Blocks
Asynchronous Event Support . . . . . . . . . . . . . . . . . . . . .
Adding an Asynchronous Event . . . . . . . . . . . . . . . . . .
Asynchronous Interrupt Examples . . . . . . . . . . . . . . .
38-2
38-2
38-4
Blocks — Alphabetical List . . . . . . . . . . . . . . . . . . . . . . .
38-5
Utility Drivers, Serial Internal Drivers
Utility Blocks
39
Blocks — Alphabetical List . . . . . . . . . . . . . . . . . . . . . . .
xxii
Contents
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
39-2
A
Serial Communications Support with Internal
Drivers
RS-232/422/485 Internal Blocks . . . . . . . . . . . . . . . . . . . .
A-2
Blocks — Alphabetical List . . . . . . . . . . . . . . . . . . . . . . .
A-3
Drivers No Longer Recommended for Use
40
Simulink Real-Time Drivers No Longer
Recommended for Use
Library of Drivers No Longer Recommended for Use .
Drivers No Longer Recommended . . . . . . . . . . . . . . . .
Drivers Updated . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
40-3
40-3
40-4
Drivers No Longer Recommended for Use —
Alphabetical List . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
40-5
ACCES I/O Drivers No Longer Recommended for Use
40-6
Advantech Drivers No Longer Recommended for Use
40-9
Analogic Drivers No Longer Recommended for Use .
40-85
BittWare Drivers No Longer Recommended for Use
40-102
Diamond Drivers No Longer Recommended for Use
40-111
Displays and Logging Blocks No Longer Recommended
for Use . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
40-140
GE Intelligent Platforms Drivers No Longer
Recommended for Use . . . . . . . . . . . . . . . . . . . . . . .
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
40-145
xxiii
HUMUSOFT Drivers No Longer Recommended for
Use . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
40-161
J1939 Drivers No Longer Recommended for Use . . .
40-169
Keithley Drivers No Longer Recommended for Use
40-181
MathWorks Drivers No Longer Recommended for
Use . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
40-208
Measurement Computing Drivers No Longer
Recommended for Use . . . . . . . . . . . . . . . . . . . . . . .
40-213
National Instruments Drivers No Longer Recommended
for Use . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
40-432
Real Time Devices Drivers No Longer Recommended for
Use . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
40-464
Texas Instruments Drivers No Longer Recommended for
Use . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
40-489
xxiv
Contents
UDP Blocks No Longer Recommended for Use . . . .
40-496
Utility Blocks No Longer Recommended for Use . . .
40-501
XCP Drivers No Longer Recommended for Use . . . .
40-505
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
‫‪Introduction, RS-232, GPIB‬‬
‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ | ‪www.MatlabSite.com‬‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ | ‪www.MatlabSite.com‬‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
1
Simulink Real-Time I/O Library
• “I/O Driver Blocks” on page 1-2
• “Add I/O Blocks to Simulink Model” on page 1-11
• “Defining I/O Block Parameters” on page 1-13
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
1
Simulink Real-Time I/O Library
I/O Driver Blocks
In this section...
“Speedgoat I/O Modules” on page 1-2
“Third-Party Driver Blocks” on page 1-2
“I/O Driver Block Library” on page 1-3
“Memory-Mapped Devices” on page 1-4
“ISA Bus I/O Devices” on page 1-4
“PCI Bus I/O Devices” on page 1-4
“Simulink Real-Time I/O Driver Structures” on page 1-5
“Simulink Real-Time Support and SimState” on page 1-7
“PWM and FM Driver Block Notes” on page 1-9
“Driver Block Documentation” on page 1-10
The Simulink Real-Time environment is a solution for prototyping, testing, and
deploying real-time systems using standard desktop computer hardware. In support of
this, the software allows you to add I/O blocks to your model. The blocks of the Simulink
Real-Time library provides a particular function of an I/O board. By using I/O blocks in
your model, you can generate executable code tuned specifically for your hardware.
You add I/O driver blocks to your Simulink model to connect your model to physical I/
O boards. These I/O boards then connect to the sensors and actuators in the physical
system.
Speedgoat I/O Modules
Speedgoat real-time target machines are available with a number of I/O modules. See
“Speedgoat I/O Modules”.
Third-Party Driver Blocks
In addition to the blocks contained in the Simulink Real-Time library, you can also use
third-party driver blocks in your Simulink Real-Time model. The description of these
blocks is beyond the scope of the Simulink Real-Time documentation. See the provider of
the third-party driver blocks for information on those boards and driver blocks.
1-2
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
I/O Driver Blocks
I/O Driver Block Library
A driver block does not represent an entire board, but an I/O section supported by a
board. Therefore, the Simulink Real-Time library can have more than one block for
each physical board. I/O driver blocks are written as C-code S-functions (noninlined Sfunctions). The source code for the C-code S-functions is included with the Simulink RealTime software.
Note, if your model contains I/O blocks, take hardware latency values into account for the
model sample time. Use the Simulink Real-Time Interactive Guide tool to find latency
values for the supported boards:
http://www.mathworks.com/support/product/XP/productnews/interactive_guide/xPC_Target_Interactive_Guide.html
The Simulink Real-Time system supports PCI and ISA buses. If the bus type is not
indicated in the driver block number, you can determine the bus type of a driver block
by checking the block's parameter dialog box. The last parameter is either a PCI slot, for
PCI boards, or a base address, for ISA boards.
You can open the I/O device driver library with the MATLAB® command slrtlib. The
library slrtlib contains sublibraries grouped by the type of I/O function they provide.
This library also contains the following blocks:
• Simulink Real-Time Driver Examples — When you double-click this block, the
Demos tab in the MATLAB Help Navigator opens, displaying the Simulink RealTime examples and example groups.
• Help for Simulink Real-Time — When you double-click this block, the Simulink
Real-Time roadmap page is displayed. You can access the Simulink Real-Time
documentation with this block.
Note: The Simulink Real-Time documentation describes only the Simulink RealTime blocks. It does not describe the actual board. Refer to the board manufacturer
documentation for information about the boards.
When you double-click one of I/O block groups, the sublibrary opens, displaying a list
grouped by manufacturer. Double-clicking one of the manufacturer groups then displays
the set of I/O device driver blocks for the specified I/O functionality (for example, A/D, D/
A, Digital Inputs, Digital Outputs, and so on).
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
1-3
1
Simulink Real-Time I/O Library
When you double-click one of the blocks, a Block Parameters dialog box opens, allowing
you to enter hardware-specific parameters. Parameters typically include
• Sample time
• Number of channels
• Voltage range
• PCI slot (PCI boards)
• Base address (ISA/104 boards)
Memory-Mapped Devices
The Simulink Real-Time software reserves a 112 KB memory space for memory-mapped
devices in the address range
C0000 - DBFFF
Drivers for some memory-mapped devices, such as the Softing CAN-AC2-104 board,
support an address range higher than that supported by the Simulink Real-Time
software. You must select an address range supported by both the device driver and the
Simulink Real-Time software.
ISA Bus I/O Devices
There are two types of ISA boards:
• Jumper addressable ISA cards
• PnP (Plug and Play) ISA cards
The Simulink Real-Time software only supports jumper addressable ISA cards (non-PnP
ISA boards) where you have to set the base address manually.
PCI Bus I/O Devices
The Simulink Real-Time I/O library supports I/O boards with a PCI bus. During the boot
process, the BIOS creates a conflict-free configuration of base addresses and interrupt
lines for the PCI devices in the target system. The user does not need to define base
address information in the dialog boxes of the drivers.
PCI device driver blocks have an additional entry in their dialog boxes. This entry is
called PCI Slot (-1 Autodetect) and allows you to use several identical PCI boards
1-4
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
I/O Driver Blocks
within one target system. This entry uses a default value of -1, which allows the driver
to search the entire PCI bus to find the board. If you specify a single number, X, greater
than 0, the driver uses the board in bus 0, slot X. When more than one board of the same
type is found, you must use a designated slot number and avoid the use of autodetection.
For manually setting the slot number you use a number greater than or equal to 0. If the
board is not able to locate this slot in the target computer, your real-time application will
generate an error message after downloading.
If this additional entry is set to a value equal to or greater than 0, you must be aware
of the manufacturer's identification number (Vendor ID) and the board identification
number (Device ID) of those boards supported by the I/O library. When the target is
booted, the BIOS is executed and the target computer monitor shows parameters for the
PCI boards installed on the target computer. An example is shown below:
Bus No. Device
No.
Func.
No.
Vendor
ID
Device
ID
Device Class
IRQ
0
4
1
8086
7111
IDE
controller
14/15
0
4
2
8086
7112
Serial bus
controller
10
0
11
0
1307
000B
Unknown PCI
device
N/A
1
0
0
12D2
0018
Display
controller
11
In this example, the third line indicates the location of the Measurement Computing™
PCI-DIO48 board. This is known since the Measurement Computing vendor ID is
0x1307 and the device ID is 0xb. In this case, you can see that the Measurement
Computing board is plugged into PCI slot 11 (Device No.), and that this value must be
entered in the dialog box entry in your I/O device driver for each model that uses this I/O
device.
Simulink Real-Time I/O Driver Structures
Properties for Simulink Real-Time I/O drivers are usually defined using the parameter
dialog box associated with each Simulink block. However, for more advanced drivers, the
available fields defined by text boxes, check boxes, and pull-down lists are inadequate
to define the behavior of the driver. In such cases, you must provide a more textual
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
1-5
1
Simulink Real-Time I/O Library
description to indicate what the driver has to do at runtime. Textual in this context refers
to a programming-language-like syntax and style.
The Simulink Real-Time software currently uses a string description contained in
message structures for the conventional RS-232, GPIB, CAN (initialization), and the
general counter drivers (AMD9513).
What is a message structure? — A message structure is a MATLAB array with each
cell containing one complete message (command). A message consists of one or more
statements.
First Message
Second Message
Third Message
Message(1).field
Message(2).field
Message(3).field
Message(1).field
Message(2).field
Message(3).field
Message(1).field
Message(2).field
Message(3).field
Syntax of a message statement — Each statement in a message has the following
format:
Structure_name(index).field_name = <field string or value>
The field names are defined by the driver, and need to be entered with upper- and
lowercase letters as defined. However, you can choose your own structure name and
enter that name into the driver parameter dialog box.
Creating a message structure — You could enter the message structure directly in
the edit field of the driver parameter dialog box. But because the message structure is an
array and very large, this becomes cumbersome very easily.
A better way is to define the message structure as a variable in the MATLAB workspace
and pass the variable name to the driver. For example, to initialize an external A/D
module and acquire a value during each sample interval, create a script file with the
following statements:
Message(1).senddata='InitADConv, Channel %d'
Message(1).inputports=[1]
Message(1).recdata=''
Message(1).outputports=[]
Message(2).senddata='Wait and Read converted Value'
Message(2).inputports=[]
Message(2).recdata='%f'
1-6
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
I/O Driver Blocks
Message(2).outputports=[1]
This approach is different from other Simulink Real-Time driver blocks:
• The script containing the definition of the message structure has to be executed before
the model is opened.
After creating your Simulink model and message script, set the preload function of
the Simulink model to load the script file the next time you open the model. In the
MATLAB window, type
set_param(gcs, 'PreLoadFcn', 'script_name')
• When you move or copy the model file to a new folder, you also need to move or copy
the script defining the message structure.
During each sample interval, the driver block locates the structure defined in the Block
Parameters dialog box, interprets the series of messages, and executes the command
defined by each message.
Specific drivers and structures — For detailed information on the fields in a message
structure, see the following topics:
• “RS-232/422/485 Simulink Block Reference”
• “Initialization and Termination CAN Messages”
Simulink Real-Time Support and SimState
You can save complete model simulation states while simulating, on a development
computer, a Simulink model that contains some Simulink Real-Time blocks. The
software does not support this behavior when executing such a model on the target
computer.
For this operation, set the Save complete SimState in final state check box in the
Data Import/Export pane of the Configuration Parameters dialog box. If your model
contains the following blocks, you cannot save complete model simulation states while
simulating on the development computer.
• ASCII Encode
• ASCII Decode
• Async Buffer Read
• Async Buffer Write
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
1-7
1
Simulink Real-Time I/O Library
• Baseboard Serial
• Baseboard Serial F
• Bit Packing (Utilities library)
• Bit Unpacking (Utilities library)
• Byte Packing (Utilities library)
• Byte Unpacking (Utilities library)
• Commtech Fastcom® 422/2–PCI
• Commtech Fastcom 422/2–PCI F
• Commtech Fastcom 422/2–PCI-335
• Commtech Fastcom 422/2–PCI-335 F
• Commtech Fastcom 422/4–PCI-335
• Commtech Fastcom 422/4–PCI-335 F
• Condor® 1553 BC List
• Create Ethernet Packet (Ethernet library)
• Diamond Systems Emerald-MM Serial
• Diamond Systems Emerald-MM Serial F
• Diamond Systems Emerald-MM8 Serial
• Diamond Systems Emerald-MM8 Serial F
• FIFO bin read
• FIFO ASCII read
• FIFO write
• Quatech® DSCP-200/300
• Quatech DSCP-200/300 F
• Quatech ESC-100
• Quatech ESC-100 F
• Quatech QSC-100
• Quatech QSC-100 F
• Quatech QSC-200/300
• Quatech QSC-200/300 F
• UDP Receive
1-8
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
I/O Driver Blocks
• UDP Send
To prevent these messages, clear the Save complete SimState in final state check box
in the Data Import/Export node of the Configuration Parameters dialog box.
PWM and FM Driver Block Notes
In PWM and FM driver blocks, your control over the output frequency and duty cycle is
not precise. In particular, these values are affected by the way that the base frequency is
selected, as described in this section. The base frequency value is exact.
At the beginning of each sample time, two unsigned 16-bit integers, n and m, are
computed based on the block parameters and the current values of the input signals.
During the current sample period, the output signal is held high for m cycles of the base
frequency, low for the next n-m cycles, high for the next m cycles, and so forth.
For a base frequency b, this results in a rectangular output signal of frequency b/n
and duty cycle m/n. Because m and n must be integers, it is not possible to provide a
continuous range of output frequencies and duty cycles with perfect exactness.
For example, assume that you want to configure an FM block with a duty cycle (m/n)
of 1/2. The input signal f to this block is a relative frequency. It specifies an output
frequency of b x f. Because m and n must be integers, it is not always possible to find
values of m and n such that f will equal b/n exactly and n will equal 2 x m (duty cycle
m/n = 1/2) exactly. Such an exact match is only possible when the input signal f equals
1/4, 1/6, 1/8, and so forth. The output frequencies for the intervening input signal
f values are approximate. The errors are smaller as f approaches 0 and larger as f
approaches 1.
Hint, to achieve the smallest margin of error, select the largest possible base frequency.
The fact that n and m must be 16-bit integers imposes a lower limit of
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
1-9
1
Simulink Real-Time I/O Library
b / (216 – 1)
on the frequencies that can be generated using a given base frequency.
Driver Block Documentation
The typical Simulink Real-Time block documentation briefly describes the supported
board, then describes the parameters for each of the blocks that support the board.
Included in the documentation for each board is a board characteristics table. Board
characteristics tables can include the following information:
1-10
Characteristic
Specifies...
Board name
Name of the board supported by the blocks. For example,
National Instruments® PCI-6221.
Manufacturer
Manufacturer of the board. For example, National Instruments.
Bus type
Bus that is used by the board. For example, PCI or ISA.
Access method
Whether the board is memory mapped or I/O mapped.
Multiple block
instance support
If you can use multiple blocks for the same function on the same
board. For example, different blocks for different channels of an
A/D device.
Multiple board
support
If you can use multiple boards of the same type in one real-time
application.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Add I/O Blocks to Simulink Model
Add I/O Blocks to Simulink Model
Starting with a Simulink model, you can transform it to a Simulink Real-Time model
that accesses I/O drivers using the Simulink Real-Time block library. The highest
hierarchical level in the library is grouped by I/O function. The second level is grouped
by board manufacturer. The manufacturer groups contain the driver blocks for specific
boards.
This example uses the Simulink model xpc_osc as an example of how to replace
Simulink blocks with Simulink Real-Time I/O blocks.
1
In the MATLAB window, type
slrtlib
The Library: slrtlib window opens.
Alternatively, you can access the I/O driver library with the Simulink Library
Browser.
2
Open a function group. For example, to open the A/D group, double-click the A/D
block.
The manufacturer level opens. Within each manufacturer group are the blocks for a
single function.
3
Open a manufacturer group. For example, to open the A/D driver blocks from
Measurement Computing, double-click the group marked Measurement Computing.
The window with the A/D driver blocks for Measurement Computing opens.
4
In the Simulink window, type
xpc_osc
The Simulink block diagram opens for the model xpc_osc.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
1-11
1
Simulink Real-Time I/O Library
5
From the block library, click and drag the name of an Analog Input block to the
Simulink block diagram. Likewise, click and drag the name of an Analog Output
block to your model.
The Simulink software adds the new I/O blocks to your model.
6
Remove the Signal Generator block and add the Analog Input block in its place.
Remove the Scope block and add the Analog Output block in its place.
The example model xpc_osc looks like this:
You cannot run this model unless the required I/O board is installed in your target
computer. However, you can substitute driver blocks for another I/O board that is
installed in the target computer.
Your next task is to define the I/O block parameters. See “Defining I/O Block
Parameters” on page 1-13.
1-12
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Defining I/O Block Parameters
Defining I/O Block Parameters
The I/O block parameters define values for your physical I/O boards. For example, I/O
block parameters include channel numbers for multichannel boards, input and output
voltage ranges, and sample time.
This procedure uses the Simulink model xpc_osc as an example, and assumes you have
added an analog input and an analog output block to your model. To add an I/O block, see
“Add I/O Blocks to Simulink Model” on page 1-11.
1
In the Simulink window, double-click the input block labeled Analog Input.
The dialog box for the A/D converter opens.
2
Fill in the dialog box. For example, for a single channel enter 1 in the Number
of Channels box, select ±10 V for the input range, and select Single-ended
(16 channels) for the MUX switch position. Enter the same sample time you
entered for the fixed step size in the Solver pane of the Simulation > Model
Configuration Parameters dialog box. Enter the PCI slot for this PCI-bus board.
The Block Parameters dialog box looks like this:
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
1-13
1
Simulink Real-Time I/O Library
3
In the Simulink window, double-click the output block labeled Analog Output.
The dialog box for the D/A converter opens.
4
Fill in the dialog box. For example, for one channel enter [1] in the Channel Vector
box; for an output level of ±10 V enter the code [-10] in the Range Vector box.
Enter the same sample time you entered for the fixed step size in the Solver pane
of the Simulation > Model Configuration Parameters dialog box. Enter the PCI
slot for this PCI-bus board.
The Block Parameters dialog box looks like this:
1-14
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Defining I/O Block Parameters
If you change the sample time by changing the target object property SampleTime, the
sample times you entered in both of the I/O blocks are set to the new value. The step size
you entered in the Configuration Parameters dialog box remains unchanged.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
1-15
1
Simulink Real-Time I/O Library
Your next task is to execute the real-time application in real time. Start with “Start
Target Hardware”.
1-16
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
2
Serial Communications Support
• “RS-232 I/O Drivers” on page 2-2
• “RS-232/422/485 Drivers (Composite)” on page 2-5
• “Boards and Blocks — Alphabetical List” on page 2-17
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
2
Serial Communications Support
RS-232 I/O Drivers
The Simulink Real-Time software interfaces the target computer to serial devices using
either the COM1 or COM2 port of the main board, through Quatech drivers, through
Diamond Systems drivers, or through Commtech drivers.
The Simulink Real-Time software supports RS-232 I/O communication with the
following:
• Serial ports on the target computer
• Third-party Quatech PCI boards manufactured by B&B Electronics (http://www.bbelec.com)
• Third-party Commtech PCI boards (http://www.commtech-fastcom.com)
• Third-party Diamond Systems PC/104 boards (http://www.diamondsystems.com)
For the target computer serial ports, the software can use these ports as the RS-232 I/O
devices. You can initiate RS-232 communications with these ports and the accompanying
Simulink Real-Time drivers.
The software also supports the following:
• RS-232 — QSC-100 and ESC-100 PCI boards from Quatech
• RS-422, RS-485 — QSC-200/300 PCI boards and DSCP-200/300 dual channel PXI®
boards from Quatech, Fastcom: 422/2-PCI adapter, Fastcom: 422/2-PCI-335 from
Commtech (http://www.commtech-fastcom.com)
• RS-232, RS-422, RS-485 — Emerald-MM and Emerald-MM-8 PC/104 boards from
Diamond Systems. These boards provide 4 and 8 serial ports, respectively. These
boards are jumper-configurable for the following models:
• EMM-XT, which can support two ports each for RS-232 and RS-232.
• EMM-4485–XT, which supports four ports for RS-422 and RS-485.
• EMM-4M-XT, which supports four ports for RS-232, RS-422, and RS-485.
See the manufacturer documentation for details on how to configure your jumpers.
Note: When you configure the board for the RS-485 protocol, configure your model
to manually control the RTS bit to turn the transmitter on and off. You must use a
convention, such as counting sample time steps, to decide when the model should turn
off the transmitter after sending data.
2-2
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
RS-232 I/O Drivers
The Simulink Real-Time block library provides a set of functionally similar drivers for
these boards. See “RS-232/422/485 Simulink Block Reference” on page 2-11 for a
description of the driver blocks that support the different protocols.
The Simulink Real-Time block library supplies composite drivers to support RS-232 I/O
communication. The composite drivers support RS-232 I/O for the target computer serial
ports, the Quatech RS-232, RS-422, and RS-485 I/O devices, and the Diamond Systems
RS-232 I/O devices. These drivers support communication in asynchronous binary mode.
The Simulink Real-Time block library uses Simulink blocks for the I/O drivers. The
composite drivers provide a simple ASCII encode/decode for the send and receive RS-232,
RS-422, and RS-485 blocks. This set of drivers has the descriptive name “composite”
because the driver represents each functional piece of the driver as a Simulink block. For
more precise behavior, you can customize the RS-232 driver with these blocks.
The composite drivers also include internal drivers, which you might need to access if you
need to modify the composite subsystems for your use. Note that you normally should not
use the internal drivers, described in “RS-232/422/485 Internal Blocks”.
Hardware Connections for RS-232
The Simulink Real-Time software supports serial communication with the COM1 and
COM2 ports on the target computer.
Your real-time applications can use these RS-232 ports as I/O devices. With the typical
DTE/DCE configuration of the RS-232 device, the target computer is connected to the
device with a null modem cable.
Links Between Development and Target Computers
Note: RS-232 communication type will be removed in a future release. Use TCP/IP
instead.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
2-3
2
Serial Communications Support
If the development and target computers are connected using a serial link, one COM port
on the target computer is dedicated to this link. You cannot use this COM port in your
block diagram as an I/O device.
For example, if the target computer uses COM1 for the communication with the
development computer, COM1 cannot be used by your model. If you try to use COM1 as
an I/O device in your model, an error message is displayed. The error message appears
when you attempt to build and download the real-time application. In this example, you
must use COM2 as an I/O device in your model.
In addition, when you use composite driver blocks, COM1 and COM3 often share
interrupt line 4. Similarly, COM2 and COM4 often share interrupt line 3. If you use
COM1 for a serial link, you cannot also use COM1 or COM3 in a model. This is because
the shared interrupt is caught in the Simulink Real-Time operating system. However,
if COM3 uses an interrupt different from that for COM1, you can use COM3 in a model
while using COM1 for a serial link. If COM1 and COM3 share an interrupt line, you can
use COM2 or COM4 as your RS-232 I/O port.
If you are using TCP/IP as your link between the development and target computers,
then you can freely use the COM ports for RS-232 I/O.
2-4
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
RS-232/422/485 Drivers (Composite)
RS-232/422/485 Drivers (Composite)
This topic describes the components that make up the RS-232 and RS-422/485 composite
drivers, and how you can create a model using these drivers. These drivers perform
RS-232 or RS-422/485 asynchronous communications.
The Simulink Real-Time software supports the target computer serial ports (main
board), Quatech RS-232/422/485 devices, Diamond Systems RS-232 devices, and
Commtech Fastcom: 422/2-PCI adapters with composite drivers. These drivers
distribute the functionality of the device across several subsystems and blocks. For
most RS-232/422/485 requirements, you can use these RS-232/422/485 drivers as
they are implemented. However, if you need to customize the Simulink Real-Time
RS-232/422/485 drivers, the composite nature of the target computer serial port, Quatech
RS-232/422/485, Diamond Systems RS-232, and Commtech Fastcom drivers enables you
to do so. See “RS-232/422/485 Internal Blocks” for details.
Note the following characteristics of the Commtech Fastcom: 422/2-PCI adapter boards
(http://www.commtech-fastcom.com):
• The Fastcom 422/2-PCI board has two independent RS-422 channels.
• The Fastcom 422/2-PCI board can handle baud rates up to 1.5 megabits/second.
• The Fastcom 422/2-PCI board hardware FIFO is fixed at 128 bytes for receive and
transmit.
Note the following characteristics of the Commtech Fastcom: 422/2-PCI-335 and
Fastcom: 422/4-PCI-335 adapter boards (http://www.commtech-fastcom.com):
• The Fastcom 422/2-PCI-335 board has two independent RS-422/485 channels, the
Fastcom 422/4-PCI-335 board has four independent RS-422/485 channels.
• The Fastcom 422/2-PCI-335 and Fastcom 422/4-PCI-335 board can handle baud rates
up to 6.25 megabits/second.
Note: Many of the blocks that support the RS-232 and RS-422/485 composite drivers are
common across the main board, Quatech, and Diamond Systems boards. The descriptions
for these blocks are applicable across drivers, with additional information for specific
boards.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
2-5
2
Serial Communications Support
In this section...
“Adding RS-232 Blocks” on page 2-6
“Building and Running the Real-Time Application (Composite)” on page 2-10
“RS-232/422/485 Simulink Block Reference” on page 2-11
Adding RS-232 Blocks
You add RS-232 subsystem blocks to your Simulink model when you want to use the
serial ports on the target computer, Quatech QSC-100 or ESC-100, or Diamond Systems
Emerald-MM or Emerald-MM-8 serial device connected to the target computer, for I/O.
After you create a Simulink model, you can add Simulink Real-Time driver blocks and
configure those blocks. The following procedure describes how to use the serial ports on
the target computer for I/O with the composite drivers.
Before you start, decide what COM port combinations you want to use. The example
has you configure the Baseboard Send/Receive block. To configure this block, you need
to select serial port pairs. This parameter specifies the ports for which you are defining
transmit and receive. You have a choice of the following:
• Com1/none
• Com2/none
• Com1/Com3
• Com2/Com4
• none/Com3
• none/Com4
• Custom
If you choose either the Com1/Com3 or Com2/Com4 pair, check that the port pair shares
an interrupt. If the port pair does not share an interrupt, you cannot use the two ports as
a pair.
Alternatively, you can define a Custom port pair. A Custom port pair is one that does not
match the existing combinations of port pairs. When you select Custom, the dialog allows
you to configure your own port pair. For example, you can set the IRQ and two addresses
for the port pair. If one of the ports is not used, set that address to 0.
Normally, the ports are set to the following:
2-6
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
RS-232/422/485 Drivers (Composite)
COM1 — 0x3F8, IRQ 4
COM2 — 0x2F8, IRQ 3
COM3 — 0x3E8 (if present), IRQ 4
COM4 — 0x2E8 (if present), IRQ 3
A Custom port pair is one where one or both ports of the pair are set to addresses other
than these conventions, or one for which you want to assign a different IRQ value. Some
hardware allows you to set the IRQ numbers independently.
If you choose the port pairs Com1/Com3 or Com2/Com4, you need to include one Send/
Receive subsystem block in the model. If you choose to use COM1 and COM2, or COM1
and a custom port pair, you need to include two Send/Receive blocks in the model.
The following example shows two models, one that uses a standard Com1/Com3 port pair,
and one that uses custom port pairs:
1
In the MATLAB Command Window, type
slrtlib
The Simulink Real-Time driver block library opens.
2
Double-click the RS-232 group block.
A window with blocks for RS-232 composite drivers opens.
Alternatively, you can access the Simulink Real-Time block library from the
Simulink Library Browser. In the Simulink window, and from the View menu, click
Show Library Browser. In the left pane, double-click Simulink Real-Time, and
then click RS232.
3
Drag and drop an ASCII Encode block to your Simulink model. This block encodes
input for the RS-232 Send Receive block.
4
Configure this block.
5
Drag and drop an ASCII Decode block to your Simulink model. This block decodes
output from the RS-232 Send Receive block.
6
Configure this block.
7
Double-click the Mainboard group block.
8
Depending on your port pair configuration, drag and drop one or two Baseboard
RS-232 Send/Receive blocks to your Simulink model.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
2-7
2
Serial Communications Support
9
Double-click the Baseboard RS-232 Send/Receive block.
10 Configure this block. Note the following:
• Pay particular attention to the Parameter group Board Setup entry.
• When you select the Receive Setup entry, for each channel, set the value of
the Receive Sample Time parameter to a sample time value faster than the
data being sent. Do not leave this value at -1. You must set this parameter for all
channels, including channels that you are not using; otherwise, you will receive
an error when generating code for the real-time application.
11 Add a Pulse Generator and Target Scope block.
12 Configure the Pulse Generator block so that its Pulse type is Sample based.
The dialog changes to display a Sample time parameter. Enter a Sample time that
is slower than the one you set for Receive Setup.
13 From the Simulink Library Browser, select Sinks. Depending on your configuration,
drag and drop one or more Terminator blocks. Connect this block to the unused
RCV1 port to suppress unused port messages.
14 From the Simulink Library Browser, select Sources. Depending on your
configuration, drag and drop the Ground block. Connect this block to the unused
XMT3 port to suppress unused port messages.
Your model might use one block or two.
The single-block model uses the Com1/Com3 port pair:
The two-block model uses two sets of Custom port pairs:
2-8
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
RS-232/422/485 Drivers (Composite)
15 Double-click a Baseboard RS232 Send Receive block. Enter values to configure the
port(s) on the target computer for this board.
Note: This is a dynamic dialog box that changes depending on the Parameter
group selection.
For example, if the Parameter group is Board Setup and the target computer
port is connected to COM1/COM3, your Send Receive block dialog box looks like this:
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
2-9
2
Serial Communications Support
For more information on entering the block parameters, see RS-232/RS-422/RS-485
Send/Receive (Composite).
16 Click OK. The Send Receive block dialog box dialog box closes.
Your next task is to build and run the real-time application.
Building and Running the Real-Time Application (Composite)
The Simulink Real-Time software and Simulink Coder™ create C code from your
Simulink model. You can then use a C compiler to create executable code that runs on
the target computer. This topic assumes that you know how to configure your model
to create a Simulink Real-Time application. (See “Build and Download Real-Time
Application”.)
After you have added the RS-232 blocks for the main board to your Simulink model and
configured your model, you can build your real-time application.
Note: In this example, you cannot use a serial port to link the development and
target computers. You can only use COM1 if it is not already in use for a serial link.
2-10
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
RS-232/422/485 Drivers (Composite)
Additionally, if COM1 and COM3 share an interrupt, you cannot use COM3 if COM1 is
already in use for a serial link.
1
In the Simulink window, and from the Code menu, click C/C++ Code > Build
Model.
2
In the MATLAB Command Window, type
start(tg)
RS-232/422/485 Simulink Block Reference
The Simulink Real-Time software supports RS-232/422/485 communication with driver
blocks in your Simulink model.
This section includes the following topics:
• “Signal Data Types” on page 2-11 — Describes signal data types that composite
drivers support.
• ASCII Encode/Decode (Composite) — (Generic) Describes encoder and decoder blocks.
Encoders convert input signals for the send/receive subsystem to ASCII strings.
ASCII decoders parse the string from the Send/Receive subsystem.
• FIFO Read/Write (Composite) — (Generic) Describes FIFO read and write blocks.
• RS232 State (Composite) — (Generic) Monitors the hardware error state information
that is present in the output vector from the blocks.
• RS-232/RS-422/RS-485 Send/Receive (Composite) — Provides blocks for sending and
receiving.
• Modem Control (Composite) — Controls the state of either or both of the RTS and
DTR output lines.
• Modem Status (Composite) — Reads the states of the four input modem control lines.
Signal Data Types
Signals between blocks in composite drivers can be one of several basic data types, 8-bit
and 16- or 32-bit. These types are structures.
8-bit data types are NULL-terminated strings that are represented as Simulink
vectors. The width is the maximum number of characters that can be stored. In the
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
2-11
2
Serial Communications Support
following figure, M is the actual set of stored characters and N is the maximum number of
characters that can be stored. This figure illustrates 8-bit int NULL-terminated and 8–
bit uint NULL-terminated data types.
This string has 11 characters terminated with a NULL byte (0). This data type cannot
contain a NULL byte as part of the real data.
16- and 32-bit data types use the first element of the vector as a count of the valid data.
In the following figure of a 16-bit data type, C is the count of the valid data, N is the width
of the vector. This figure illustrates count + 16-bit int and count + 16-bit uint data types.
It also applies to count + 32-bit int and count + 32-bit uint data types
These serial blocks interpret each entry in the vector as a single character. The low-level
hardware Send block writes the low-order byte of each entry to the UART. The 16- and
32-bit data types allow the embedding of 8-bit data values, including 0. The 8-bit data
type is most useful with the ASCII Encode and Decode blocks. The 16- and 32-bit data
types are most useful for binary data streams.
Handling Zero Length Messages
As a general rule, configure a FIFO read block of your model serial I/O to execute
faster than the model receives data. Doing so prevents the receive FIFO buffer from
overflowing. This implies that you must configure your model to deal with the possibility
that a FIFO read block may not have a message on its output.
2-12
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
RS-232/422/485 Drivers (Composite)
Receive FIFOs might not have enough characters to satisfy a FIFO read operation. A
model that receives serial I/O might have a FIFO read block that will execute in this
situation. This will cause a FIFO read block to perform one of the following, depending on
how you configure the behavior:
• Return the last message it received
• Return a zero length message
The Simulink Real-Time library of composite serial drivers has three FIFO read blocks,
FIFO Read HDRs, FIFO Read Binary, and FIFO Read (described in FIFO Read/Write.
For the FIFO Read HDRs or FIFO Read Binary blocks, you configure this behavior with
the Output behavior parameter. The FIFO Read block returns either a new message or
a zero length message.
If you need to execute model code only if a new message arrives, check the first element
of the returned vector, depending on the string data type, as described in the following.
If the message has nonzero length, enable a subsystem to process the new string;
otherwise, do not process it.
• In the 8-bit data type, the returned string is NULL-terminated. Therefore, if the
first element is 0, the string has zero length and the FIFO read did not detect a new
message.
• In the 16- and 32-bit data types, the first element is the number of characters in the
string. This value is 0 if the FIFO read did not detect a new message.
Controlling When You Send a Message
You can use the structure of both serial data types (“Signal Data Types” on page 2-11)
to control when a message is sent. In both cases, a 0 in the first position indicates an
empty string.
• 8-bit data types — A value of 0 value in the first position is the NULL terminator for
the string.
• 16- and 32-bit data types — The first position is the number of characters that follow.
If you connect an empty string to the XMT port on one of the send/receive subsystems, no
characters are pushed onto the transmit FIFO. You can get this empty string using one
of the following:
• If you have a single string that you want to send occasionally, use the Product block
to multiply the entire string by either 0 or 1. In this case, the 0 or 1 value becomes a
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
2-13
2
Serial Communications Support
transmit enable. To optionally optimize this operation, you can use a Demux block to
extract the first element and multiply just that element by 0 or 1, then use the Mux
block to combine it again.
• Use a Manual Switch, Multiport Switch, or Switch block (configured for two ports to
choose between different messages, with one of the choices being a vector of 0 values).
The Switch block only selects between vectors of the same width. However, because
the string length does not need to use the whole vector, you just need to fill them to
the same width with 0 values following your data.
Defining the Commtech Fastcom Baud Rate for Commtech Fastcom 422/2-PCI Boards
The Commtech Fastcom 422/2-PCI board can handle baud rates up to 1.5 megabaud.
To configure a baud rate for the board, you need to set the following parameters. Note,
this section applies to only Commtech Fastcom 422/2-PCI boards, not Commtech 422/2PCI-335 and 422/4-PCI-335 boards.
• Clock Bits in the Fastcom 422/2-PCI Send Receive block with the Parameter group
parameter set to Board Setup
• Baud Divisor in the Fastcom 422/2-PCI Send Receive block with the Parameter
group parameter set to Basic Setup
The Fastcom 422/2-PCI board has two serial channels, each of which has an independent
counter (baud clock). A master clock generator, which has a phase locked loop, controls
the master clock for both serial channels. The master clock generates a maximum
baud rate for both channels. The block determines the actual baud rate of a channel by
dividing the maximum baud rate from the master clock by the baud rate divisor (n).
2-14
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
RS-232/422/485 Drivers (Composite)
To set the block parameters for this board, choose a maximum baud rate, as follows. This
procedure assumes that both channels require different baud rates. Determine a common
base clock that can be divided to produce the required baud rates for both channels, as
follows:
1
In the MATLAB Command Window, type a command like the following.
With a desired frequency (for example, 1.5e6) as the desired input, the
fc422mexcalcbits utility calculates parameter values that you can use to
configure the board rate for your board.
[a b df ] = fc422mexcalcbits(1.5e6)
This command returns three values.
a = 12199144
b = 24
df = 1500000
2
Examine the df value. The df value is the actual frequency the board will be able
to attain compared to your desired frequency. If the actual attainable frequency
does not meet your requirements, you might want to try another frequency. In this
example, the board can match the desired frequency of 1500000 (1.5e6).
3
Enter the first two values in the Clock Bits parameter of the Fastcom 422/2-PCI
Send Receive block with the Parameter group parameter set to Board Setup.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
2-15
2
Serial Communications Support
After you define a maximum baud rate, you can set a unique baud rate for each channel
by choosing a different baud rate divisor for each channel. For example, you can have
Channel 1 have a baud rate of 750000 (1500000/2) and Channel 2 have a baud rate of
1500000 (1500000/1). To set Channel 1 to have a baud rate of 750000, with the Fastcom
422/2-PCI Send Receive block with the Parameter group parameter set to Basic
Setup, set
• Port to modify to 1
• Baud Divisor to 2
Note: For very slow baud rates (less than 30000), you must use the Baud Divisor
parameter to achieve the desired baud rate.
2-16
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Boards and Blocks — Alphabetical List
Boards and Blocks — Alphabetical List
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
2-17
2
Serial Communications Support
ASCII Encode/Decode (Composite)
ASCII Encode/Decode
Library
Simulink Real-Time Library for RS-232
Description
The ASCII Encode block generates a UINT8 output vector that contains a NULLterminated string based on a printf like format string and data on the input ports.
The ASCII Decode block parses an input vector according to a format specifier similar to
scanf, and makes converted values available to a Simulink program. The input vector to
the ASCII Decode block can be either 8-bit or 16-bit and signed or unsigned. If the data
format is 16-bit, the ASCII Decode block ignores the upper eight bits of each entry.
Encode Block Parameters
Format string
Enter a printf like format string. Each format specifier such as %d is replaced by
the converted value that is present on the corresponding input variable. Acceptable
format specifiers are %c, %d, %i, %o, %u, %x, %e, %f, and %g. These follow the normal
description for printf.
Number of variables
Enter the number of input ports to this block. The value on each port is inserted into
the output string with the format specified in Format string.
Max output string length
Enter the maximum allowed length of the converted string, in bytes. The block
allocates enough memory to support this length for the output port. When selecting
this length, take into account the NULL termination on the string.
If the converted string exceeds this length, the block returns an error and does not
write that string to the output port.
2-18
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
ASCII Encode/Decode (Composite)
Variable types
Enter one of the following: {'double'}, {'int8'}, {'uint8'}, {'int16},
{'uint16'}, {'int32'}, and {'uint32'}. The default is {'double'}. This
parameter specifies the Simulink data types allowed for the input ports. A cell vector
with the same number of elements as specified in Number of variables can specify
a different data type for each input port. A single element is replicated. For example,
nvars=3
{ } — The three inputs are doubles.
{'uint8'} — The three inputs are uint8.
{'uint16', 'double', 'uint8'} — The first input is a uint16, the second
input is a double, and the third input is a uint8.
Decode Block Parameters
Format string
Enter a scanf like format string. Each format specifier such as %d needs to match
a corresponding part of the input vector. Literal strings in the format need to match
the first character plus the number of characters. Acceptable format specifiers are
%c, %d, %i, %o, %u, %x, %e, %f, and %g. These follow the normal description for scanf.
Number of variables
Enter the number of output ports for this block. For example,
If Format string has the value of %xmore text%x and the input vector for the
block has cdmabcdefgh90, you must specify the value of the Number of variables
parameter as 2.
The first variable is assigned the value 0xcd. Next, the string mabcdefgh is
considered a match to more text because
• The first character for both strings is m.
• Both strings have the same number of characters.
The second variable is then assigned the value 0x90. Note that the string
mabcdefgh does not have to match exactly the value of Format string. This
behavior is different from that for scanf, which requires an exact match.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
2-19
2
Serial Communications Support
Variable types
Enter one of the following: {'double'}, {'int8'}, {'uint8'}, {'int16},
{'uint16'}, {'int32'}, and {'uint32'}. The default is {'double'}. This
parameter specifies the Simulink data types allowed for the output ports. A cell
vector with the same number of elements as specified in Number of variables can
specify a different data type for each output port. A single element is replicated. For
example,
nvars=3
{ } — The three outputs are doubles.
{'uint8'} — The three outputs are uint8.
{'uint16', 'double', 'uint8'} — The first output is a uint16, the second
output is a double, and the third output is a uint8.
2-20
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
ASCII Decode V2
ASCII Decode V2
ASCII Decode V2
Library
Simulink Real-Time Library for RS-232
Description
The ASCII Decode block parses an input vector according to a format specifier similar to
scanf, and makes converted values available to a Simulink program. The input vector to
the ASCII Decode block can be either 8-bit or 16-bit and signed or unsigned. If the data
format is 16-bit, the ASCII Decode block ignores the upper eight bits of each entry.
Block Parameters
Format
Enter a scanf like format string. Each format specifier such as %d must match a
corresponding part of the input vector. Literal strings in the format must match the
first character plus the number of characters. Acceptable format specifiers are the
following, enclosed in single quotes. Failure to include these quotes causes simulation
failures: %c, %d, %i, %o, %u, %x, %e, %f, and %g. These follow the normal description
for scanf. The number of format specifiers actually satisfied by the input string is
known as the count output.
An example format string is:
'foo %d bar %f\n'
In this example, assume that the data from the FIFO read is 'foo 5'. In this case,
the count output is 1 and the second output will be unchanged from the last time
both were found in a string. If the block expects two values, and the returned count
output value is less than two, there is an error in the data.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
2-21
2
Serial Communications Support
FIFO Read/Write (Composite)
FIFO Read/Write
Library
Simulink Real-Time Library for RS-232
Description
This section describes the FIFO Read and Write blocks. Of particular note are the FIFO
Read blocks, of which there are three. Use the following guidelines when using these
blocks:
• Simple data streams — Use the FIFO Read block to read simple data streams. An
example of a simple data stream is one that has numbers, separated by spaces, and
that is terminated by a newline. The FIFO Read block is a simple block that can
easily extract these numbers.
• More complicated data streams — Use the FIFO Read HDRS and FIFO Binary
blocks for more complicated data streams. A more complicated data stream can be
one that contains headers, messages of varying lengths, or messages without specific
terminators. A message header consists of one or more character identifiers at the
beginning of a message that specify what data follows. ASCII messages normally have
a variable length and a terminator. Typically, the messages of a particular device
use the same predefined terminator. Binary messages are normally of fixed length
without a specific terminator.
The FIFO Read HDRS or FIFO Binary blocks are also useful to work with devices
that can send different messages at different times.
The three FIFO read block types need their input to be of type serialfifoptr, which is
output from F type Send Receive subsystems.
The following are examples of when you can use the FIFO read block.
• For an instrument that sends a string like the form
<number> <number> ... <CR><LF>
2-22
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
FIFO Read/Write (Composite)
use the simple FIFO Read block to read the message. Configure the FIFO Read block
Delimiter parameter for a line feed (value of 10). You should then connect the output
to an ASCII Decode block with a format that separates the numbers and feeds them to
the output ports.
• For an instrument that can send one of a number of different messages, and each
message begins with a different fixed string, use the FIFO Read HDRS block. For
example, a digital multimeter connected through an RS-232 port, might send a
voltage reading and an amp reading with messages of the following format:
volts <number> <CR><LF>
amps <number> <CR><LF>
Configure the FIFO Read HDRs block Header parameter for the volts and amps
headers, in a cell array: {'volts', 'amps'}. Also configure the Terminating
string parameter for carriage return (13) and line feed (10): [13 10].
You should then connect the output to multiple ASCII Decode blocks, one for each
header and message. See the xpcserialasciitest and xpcserialasciisplit
models in xpcdemos for examples of how to use this block in a model.
• For an instrument that sends a binary message, you typically know the length of
each full message, including the header. Configure the FIFO Read Binary block
Header parameter for the headers of the message, in a cell array, and the Message
Lengths parameter for the message lengths. See the xpcserialbinarytest and
xpcserialbinarysplit models in xpcdemos for further examples of how to use
this block in a model.
The FIFO Read block is the read side of a FIFO read/write pair. The block functions in
two modes, set using the Read to delimiter check box.
• If you select the Read to delimiter check box, the block only reads elements if the
specified delimiter has been written to the write side of the FIFO (the FIFO Write
block). If the delimiter is found, the block returns elements up to and including the
delimiter in the output vector. If the delimiter is not found, the block returns a zero
length vector, as determined by the data type. (If you have a zero length vector, you
might want to have your application perform a particular operation, or ignore the
case.)
• If you clear the Read to delimiter check box, the block returns a number of elements
between Minimum read size and the smaller of the number of elements currently in
the FIFO and Maximum read size.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
2-23
2
Serial Communications Support
Tip You usually select the Read to delimiter check box when performing ASCII reads
and clear it when performing binary reads.
FIFO Read Block Parameters
Maximum read size
Specify the maximum number of characters that you will ever expect to be returned
by this block. The resulting vector size will be one more than this maximum number
of characters. This block indicates the number of characters being returned using the
extra element as:
• A null terminator for the 8-bit data types
• The character count for the 16- and 32-bit data types
Be sure to enter a large enough number. If this number is too small, the block might
not be able to return anything. For example, if you enter a value 10, but on execution
the FIFO contains 11 characters plus the null terminator, the block will not return
any characters. On the other hand, if it contains 5, the block returns 5 characters
plus the null terminator.
If you select the parameter Max and Min read size ports, the block interprets
the value input on this port to be the maximum number of characters to return. The
actual maximum number of characters to return is the smaller of the value on the
max input port or the maximum read size in the block parameters. This is mainly
useful in binary mode when the Read to delimiter check box is not selected.
Minimum read size
Enter the smallest desired read size in bytes. The FIFO must contain at least this
number of elements before elements will be returned. If you select the Max and Min
read size ports check box, this value is superseded by the external signals.
Read to delimiter
Select this check box to enable the return of element sets that terminate with the
Delimiter value. Use this parameter when working with character-based elements.
Delimiter
Enter the decimal value for an 8-bit input terminator. This parameter specifies the
value on which a FIFO read operation should terminate. It works with the Read
to delimiter parameter. By default, this block looks for a carriage return. It only
2-24
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
FIFO Read/Write (Composite)
returns characters when one is found. For reference, the decimal value of a carriage
return is 13, a line feed is 10.
Output vector type
From the list, select count+32 bit int, count+32 bit uint, count+16 bit
int, count+16 bit uint, 8 bit int null terminated, or 8 bit uint null
terminated. This parameter specifies the output vector type. The 8-bit data types
produce a null terminated string in the output vector. For 16- and 32-bit data types,
the first element contains the number of elements to expect in the rest of the output
vector.
Max and Min read size ports
Select this check box to enable the maximum and minimum input ports. When this
check box is selected:
• The value from the maximum input port is the maximum number of characters
to be removed from the FIFO. If this number exceeds the value of Maximum
read size, the block disregards the value from the maximum input port and takes
the value of Maximum read size as the maximum number of characters to be
removed from the FIFO.
• The value from the minimum input is the minimum number of characters the
FIFO must contain before elements can be returned. This value supersedes the
value set with the Minimum read size parameter.
Enable passthrough
Select this check box to pass the maximum read input through to the passthrough
output.
SampleTime
Base sample time or a multiple of the base sample time.
FIFO Write Block Parameters
Size
Enter the number of elements that can be held in the FIFO at one time. If a write
operation to the FIFO causes the number of elements to exceed Size, an error occurs.
Input vector type
From the list, select count+32 bit int, count+32 bit uint, count+16 bit
int, count+16 bit uint, 8 bit int null terminated, or 8 bit uint null
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
2-25
2
Serial Communications Support
terminated. This parameter specifies the input vector type. The 8-bit data types
need a null terminated string in the output vector. For 16- and 32-bit data types,
the first element contains the number of elements to expect in the rest of the input
vector.
Data present output
Select this check box to create a Boolean output that is true if data is present in
the FIFO. The transmit side of the send/receive subsystem uses this output. This
output is given to the Enable TX block, which enables the transmitter buffer empty
interrupt.
SampleTime
Base sample time or a multiple of the base sample time.
ID
Enter a user-defined identifier for overflow messages.
Example
The following are some examples of how you can set up the FIFO Read block:
• In the transmit side of the interrupt service routine, the maximum input port receives
a value of 0 if the interrupt reason is not an empty hardware FIFO, and the hardware
FIFO size if the hardware FIFO is empty. The minimum input port receives the
constant value of 1.
On the receive side, the typical case with ASCII data has the minimum and maximum
input ports disabled. The Read to delimiter parameter check box is selected and
the Delimiter parameter has the value of carriage return or line feed. The value of
the Maximum read size parameter is large (along the order of the FIFO size) and
the value of Minimum read size parameter is 1. In this form, the driver acts like a
nonblocking read line.
• An alternate receive-side configuration for fixed-length binary blocks of data has the
value of the Maximum read size and Minimum read size parameters set to the
fixed length of the block. The Read to delimiter parameter is not selected.
2-26
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
FIFO Read HDRS (Composite)
FIFO Read HDRS (Composite)
FIFO Read HDRS block
Library
Simulink Real-Time Library for RS-232
Description
The FIFO Read HDRS block identifies and separates ASCII data streams that have
embedded identifiers. The data following a particular header might have varying lengths,
but has a common termination marker such as <CR><LF>. While you can attain this
same functionality with the sample FIFO Read block, doing so requires a complicated
state machine.
Note: If the same header has arrived in the FIFO more than once since the block was
last executed, the block will discard the older data and only return the latest instance of
the header. In this way, the block catches up with data that arrives faster than the block
executes.
The xpcdemos folder contains the following examples that illustrate how to use the FIFO
Read HDRS block: xpcserialasciitest and xpcserialasciisplit.
Block Parameters
Header
Enter the headers that you want the block to look for in a block of data from the
FIFO. Enter each header as an element in a cell array.
Terminating string
Enter the terminating string for the data. Enter the characters defining the end of
string, typically one or two characters.
Output behavior
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
2-27
2
Serial Communications Support
From the list, select the behavior of the block if the FIFO has not received new data.
Select Zero output if no new data if you want the block to have no output if the
FIFO has no new data. Select Hold last output if no new data if you want the
block to keep the output from the last FIFO message.
Enable input
Select this check box to turn on a new input that takes Boolean signals that enable or
disable the read.
Maximum read size
Enter the largest desired read size in bytes. This parameter specifies the width of the
output vector and the maximum number of elements to return. See Output vector
type for more information about data formats.
Output vector type
From the list, select count+32 bit int, count+32 bit uint, count+16 bit
int, count+16 bit uint, 8 bit int null terminated, or 8 bit uint null
terminated. This parameter specifies the output vector type. The 8-bit data types
produce a null terminated string in the output vector. For 16- and 32-bit data types,
the first element contains the number of elements to expect in the rest of the output
vector.
SampleTime
Base sample time or a multiple of the base sample time.
2-28
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
FIFO Read Binary (Composite)
FIFO Read Binary (Composite)
FIFO Read Binary
Library
Simulink Real-Time Library for RS-232
Description
The FIFO Read Binary block reads multiple binary headers from a FIFO. This block
identifies and separates data by finding unique byte sequences (headers) that mark the
data. Each header indicates the start of a fixed length binary message.
Note: If the same header has arrived in the FIFO more than once since the block was
last executed, the block will discard the older data and only return the latest instance of
the header. In this way, the block catches up with data that arrives faster than the block
executes.
The xpcdemos folder contains the following examples that illustrate how to use the FIFO
Read HDRS block: xpcserialbinarytest and xpcserialbinarysplit.
Block Parameters
Header
Enter the headers that you want the block to look for in a block of data from the
FIFO. Enter each header as an element in a cell array either as a quoted string or a
concatenation with char(val) for non-printable byte patterns.
Message Lengths
Enter the message length of each byte of data as bytes of data. Include the header in
the length.
Output behavior
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
2-29
2
Serial Communications Support
From the list, select the behavior of the block if the FIFO does not have new data.
Select Zero output if no new data if you want the block to have no output if the
FIFO has no new data. Select Hold last output if no new data if you want the
block to keep the output from the last FIFO message.
Enable input
This check box enables or disables a FIFO read. Select this check box to turn on a
new input that takes Boolean signals that enable or disable the read.
Maximum read size
Enter the largest desired read size in bytes. This parameter specifies the width of the
output vector and the maximum number of elements to return. See Output vector
type for more information about data formats.
Output vector type
From the list, select count+32 bit int, count+32 bit uint, count+16 bit
int, count+16 bit uint, 8 bit int null terminated, or 8 bit uint null
terminated. This parameter specifies the output vector type. The 8-bit data types
produce a null terminated string in the output vector. For 16- and 32-bit data types,
the first element contains the number of elements to expect in the rest of the output
vector.
SampleTime
Base sample time or a multiple of the base sample time.
2-30
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Modem Control (Composite)
Modem Control (Composite)
Modem Control block
Library
Simulink Real-Time Library for RS-232
Description
The Modem Control block controls the state of either or both of the RTS and DTR output
lines on the specified port.
This block requires an input of type double. If the input value is greater than 0.5, the
block asserts the RTS or DTR control bit to true and the output goes to a positive voltage.
If the value is less than or equal to 0.5, the block asserts the RTS or DTR control bit
to false and the output goes to a negative voltage. If RTS or DTR is not selected, the
corresponding output is not changed.
Port (Quatech, Commtech)
From the list, choose a port. The Port parameter defines the port to configure for this
driver block.
RTS
Select this check box to control the RTS line for this board.
DTS
Select this check box to control the DTR line for this port.
Port (Diamond)
From the list, choose a port. The Port parameter defines the port to configure for this
driver block.
First port address (Diamond)
For Emerald-MM, this value should be the same as the First port address
parameter value you select in the Parameter Group: Board Setup dialog of the Send/
Receive block. See the Diamond product documentation for information on jumper
settings.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
2-31
2
Serial Communications Support
For Emerald-MM-8, this parameter contains a value based on the Base address
value of the configuration register in the Parameter Group: Board Setup dialog of the
Send/Receive block. See the Diamond product documentation.
Configuration (Mainboard)
From the list, choose a port. This parameter specifies the port whose input modem
control line states you want to read.
Normally, the ports are set to the following:
COM1 — 0x3F8
COM2 — 0x2F8
COM3 — 0x3E8
COM4 — 0x2E8
A Custom port is one that is set to an address other than these.
Slot (PCI boards)
If only one board of this type is in the target computer, enter -1 to automatically
locate the board.
If two or more boards of this type are in the target computer, enter the bus number
and the PCI slot number of the board associated with this driver block. Use the
format [BusNumber, SlotNumber]. To determine the bus number and the PCI slot
number, type:
tg = slrt;
getPCIInfo(tg, 'installed')
2-32
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Modem Status (Composite)
Modem Status (Composite)
Modem Status block
Library
Simulink Real-Time Library for RS-232
Description
The Modem Status block reads the state of the four input modem control lines.
This block has an output of type Boolean. If the input voltage is positive, the output is
true. If the input voltage is negative, the output is false.
Port (Quatech, Commtech)
From the list, choose a port. The Port parameter defines the port to configure for this
driver block.
CTS
Select this check box to monitor the CTS line.
DSR
Select this check box to monitor the DSR line.
RI
Select this check box to monitor the RI line.
DCD
Select this check box to monitor the DCD line.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
Port (Diamond)
From the list, choose a port. The Port parameter defines the port to configure for this
driver block.
First port address (Diamond)
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
2-33
2
Serial Communications Support
This parameter specifies the first port whose input modem control line states you
want to read. Do not change this value.
For Emerald-MM, this value should be the same as the First port address
parameter value you select in the Parameter Group: Board Setup dialog.
For Emerald-MM-8, this parameter contains a value based on the Base address
value in the Parameter Group: Board Setup dialog.
Configuration (Mainboard)
From the list, choose a port. This parameter specifies the port whose input modem
control line states you want to read.
Normally, the ports are set to the following:
COM1 — 0x3F8
COM2 — 0x2F8
COM3 — 0x3E8
COM4 — 0x2E8
A Custom port is one that is set to an address other than these.
Slot (PCI boards)
If only one board of this type is in the target computer, enter -1 to automatically
locate the board.
If two or more boards of this type are in the target computer, enter the bus number
and the PCI slot number of the board associated with this driver block. Use the
format [BusNumber, SlotNumber]. To determine the bus number and the PCI slot
number, type:
tg = slrt;
getPCIInfo(tg, 'installed')
2-34
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
RS-232/RS-422/RS-485 Send/Receive (Composite)
RS-232/RS-422/RS-485 Send/Receive (Composite)
RS-232/RS-422/RS-485 Send/Receive block
Library
Simulink Real-Time Library for RS-232
Description
The dynamic dialog for these subsystem blocks allows you to perform basic board setup
and setup of send/receive data. You control parameter visibility with the Parameter
Group parameter and the port number.
There are two versions of this block, non-F and F (FIFO). Both serial boards and the
main board have these two versions. The primary difference is that the F blocks bring the
FIFO signal out of the subsystem:
• The non-F blocks have RCV outputs. These blocks have basic FIFO read blocks inside
the subsystem. They are most useful for simple character streams. These subsystem
blocks generate output as an array of packed integers (settable at 8, 16, or 32 bits)
with characters in the lower byte and received status information in the upper byte.
• The F blocks have FIFO outputs. These blocks give you greater flexibility and allow
you to use the FIFO read blocks.
• FIFO Read block — A model that contains an F block in combination with the
FIFO Read block provides the same capability as the non-F block.
• FIFO Read HDRS and FIFO Read Binary — A model that contains an F block in
combination with a FIFO Read HDRS or FIFO Read Binary block provides greater
capability than the FIFO Read block. (See FIFO Read HDRS (Composite) and
FIFO Read Binary (Composite) for details.)
Only one Send/Receive block can exist for each interrupt. All ports that use that
interrupt must be associated with that block.
For example, if you have four ports configured on the main board, COM1 and COM3
typically share an interrupt. In this case, COM1 and COM3 must then share the
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
2-35
2
Serial Communications Support
same Send/Receive block. COM1 is also of note because you can use it for linking the
development and target computers. If COM1 is used for the serial link, neither COM1
nor COM3 can be used with this block as long as they share an interrupt. The same is
true for COM2 and COM4.
The Board Setup and Basic Setup configuration parameter options for F-SendReceive blocks are the same as for their non-F Send Receive block counterparts. To
provide direct access to the board, these blocks also have a FIFO Setup parameter
option. The following descriptions merge the common elements and call out the
differences among the different blocks.
Block Parameters
Parameter Group
This parameter allows you to choose which subset of configuration parameters you want
to modify. Possible values are:
• Board Setup
• Basic Setup
• Transmit Setup
• Receive Setup
• FIFO Setup
The configuration parameter subsets are:
Board Setup
The Parameter Group Board Setup option is supported by both F and non-F Send
Receive blocks.
Configuration (Mainboard)
From the list, choose combinations of port pairs (Com1/none, Com2/none, Com1/
Com3, Com2/Com4, none/Com3, none/Com4, or Custom). This parameter specifies
the ports for which you are defining transmit and receive. A Custom port is one that
does not match the existing combinations of port pairs. For example, you can set the
IRQ and two addresses or, if one of the ports is not used, set that to 0.
2-36
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
RS-232/RS-422/RS-485 Send/Receive (Composite)
IRQ number (Quatech, Commtech)
Enter the number of the interrupt request line for this board. If you do not know the
interrupt request line number for this board, at the MATLAB Command Window,
enter:
tg = slrt;
getPCIInfo(tg, 'installed')
This command displays the PCI interfaces currently attached to the target computer.
From that display, find the instance of the board controlled by this block. Each board
uses a unique interrupt request line number.
For Emerald-MM, set this to the IRQ chosen by jumpers on the board. Set the four
ports to the same IRQ.
For Emerald-MM-8, this block setting programs the board IRQ.
(Diamond) Not all IRQ values work in all target computer machines. You should
experiment to find a working combination.
Clock Bits (Commtech)
Enter the number of click bits to control a clock generator common to both channels.
This parameter adjusts the master clock of both channels.
Master Clock Frequency (Commtech Fastcom 422/2-PCI-335, 422/4-PCI-335)
Enter the clock generator frequency for the master clock. Enter a value between 64
MHz and 50 MHz, inclusive.
Use standard reference and rates (Commtech Fastcom 422/2-PCI-335, 422/4PCI-335)
This check box enables you to use default values for the block. Select this check box
to use the default values for the Master Clock Frequency parameter. If you clear
this check box, you can enter a custom value for the Master Clock Frequency
parameter. This same check box also appears on the Basic Setup option page for
all ports. Selecting this box applies to all channels.
Slot (PCI boards)
If only one board of this type is in the target computer, enter -1 to automatically
locate the board.
If two or more boards of this type are in the target computer, enter the bus number
and the PCI slot number of the board associated with this driver block. Use the
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
2-37
2
Serial Communications Support
format [BusNumber, SlotNumber]. To determine the bus number and the PCI slot
number, type:
tg = slrt;
getPCIInfo(tg, 'installed')
Base address (Diamond Emerald-MM-8)
Enter the base address of the board that you are setting up. This is the address of
the configuration register on the board. The first port address referenced in Modem
Control and Modem Status blocks is offset 0x10 from the configuration register
address, and each subsequent port address is offset 0x8 from that.
You must set the configuration register address on the board with a jumper. You
can set the configuration register address to one of the following addresses: 0x100,
0x140, 0x180, 0x1c0, 0x200, 0x240, 0x280, 0x2c0, 0x300, 0x340, 0x380, or
0x3c0. Note that the Simulink Real-Time software assigns successive 8 byte
addresses to the eight UARTs even though the hardware allows random placement.
Be sure that these addresses do not conflict with the COM port addresses listed in
“Adding RS-232 Blocks” on page 2-6. If you set the configuration register address
to 0x2c0, it conflicts with COM2. If you set the configuration address to 0x3c0, it
conflicts with COM1.
First port address (Diamond Emerald-MM)
From the list, select the first port address for the board. This address is the first of
four port addresses for the Emerald-MM board. You must initially set this address
on the board with a jumper. The remaining three addresses follow consecutively in
increments of 0x8. Be sure that these addresses do not conflict with the COM port
addresses listed in “Adding RS-232 Blocks” on page 2-6.
Basic Setup
The Parameter Group Basic Setup option is supported by both F and non-F Send
Receive blocks.
Port to modify
From the list, choose a port. The Port to modify parameter specifies the port for
which you want to view or modify the parameters.
For Baseboard drivers, the port is the Simulink block port, where the upper port
is 1 and the lower port is 2. For other drivers, the port number corresponds to the
channel number.
2-38
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
RS-232/RS-422/RS-485 Send/Receive (Composite)
Use standard reference and rates (Commtech Fastcom 422/2-PCI-335, 422/4PCI-335)
This check box enables you to use default values for the block. Select this check box
to use the default values for the Baud divisor and Sampling rate parameters.
Selecting this check box allows you to enter a value for the Baud rate parameter
and also selects the Prescale parameter. If you clear this check box, you can enter
custom values for the Baud divisor and Sampling rate parameters, but must use
the default value for the Baud rate parameter. Clearing this check box also clears
the Prescale check box.
If selected:
• Reference is set to 14.7456 MHz.
• Prescale is disabled.
• Sampling rate is 16X (standard).
• Select the baud rate from Baud Rate.
If not selected, you must provide a custom baud rate that is not on the drop-down list
to get the desired reference. For example, if you have a desired baud rate of 1.0 MHz,
you can use the following equation to calculate the reference:
reference = baud rate x sampling rate x divisor x prescale
The following values give an acceptable reference that is less than or equal to 50
MHz.
reference = 1.10e6 x 16 x 1 x 1 = 16 MHz
Baud Divisor (Commtech)
Enter a divisor integer. The block determines the actual baud rate for a particular
channel by dividing the maximum baud rate by this divisor. This number can be
different for each channel.
Baud rate (Mainboard, Quatech, Diamond, (Commtech Fastcom 422/2-PCI-335, 422/4PCI-335)
From the list, choose a baud rate.
(Diamond Emerald-MM) The Emerald-MM block lists the baud rates with an HS
label to indicate the rate if the board contains the high speed crystal option.
Sampling rate (Commtech Fastcom 422/2-PCI-335, 422/4-PCI-335)
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
2-39
2
Serial Communications Support
From the list, select 8x or 16x (standard) per port. This parameter is enabled if
you clear the Use standard reference and rates parameter.
Prescale (Commtech Fastcom 422/2-PCI-335, 422/4-PCI-335)
For very slow baud rates, you might need to enable this divide by 4 prescaler to
achieve the desired rate. In most cases, you do not need to enable this.
Parity
From the list, choose None, Even, Odd, Mark, or Space. This parameter defines the
parity.
Data bits
From the list, choose either 5, 6, 7, or 8 to select the number of bits per character.
Stop bits
From the list, choose either 1 or 2 to define the number of stop bits for the port. Most
modern hardware works fine with a character stream that uses single (1) stop bits.
Hardware FIFO size (Quatech, Diamond)
From the list, choose either 64 deep, 16 deep, or 1 deep. This parameter specifies the
size of the FIFO in the UART. The Hardware FIFO size parameter affects both
the receive and transmit FIFOs. For example, specifying a FIFO size of 64 bytes
results in fewer interrupts. Fewer interrupts can allow more processing to occur in
the model.
The types of UARTs include
16450 — Maximum 1 byte depth
16550 — Maximum 16 byte FIFO depth
16750 — Maximum 64 byte FIFO depth
Receive FIFO interrupt level
From the list, choose 1, quarter full, half full, or almost full. This
parameter specifies the number of characters in the Receive FIFO before an interrupt
occurs. Receive interrupts occur at least as often as this parameter specifies.
If a gap of at least 4 character times, the span of four characters, occurs in a data
stream, the UART requests an interrupt for the receiver. The UART requests an
interrupt regardless of the value of Receive FIFO interrupt level. If the hardware
FIFO contains at least one character, an interrupt is signaled.
2-40
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
RS-232/RS-422/RS-485 Send/Receive (Composite)
(Commtech) The Fastcom 422/2–PCI and Fastcom 422/2–PCI F blocks do not have
this parameter as a drop-down list. Instead, these blocks allow you to enter an
arbitrary number of bytes up to the hardware FIFO size, with 64 as the default.
Typically, 8 to 16 bytes is large enough, but the size you choose depends on the speed
of the incoming characters. Be careful that you do not enter a size that causes too
many interrupts.
Auto RTS/CTS (RS-232 boards)
Select this check box to enable the hardware-based handshake for flow control. This
RTS/CTS handshake feature of the UART is used to prevent loss due to hardware
FIFO overflow.
Because of the large 64 byte FIFO in the hardware, flow control that is based on
software control in the interrupt service routine can have problems. In most cases,
the interrupt service routine executes quickly enough to empty the hardware FIFO.
However, if you get hardware FIFO overruns, select this check box.
Assert on transmit (RS-422/485 boards)
From the list, select None, RTS, or DTR to specify the state of the RTS or DTR line.
The driver asserts the selected line upon transmission.
Hardware handshake (Commtech Fastcom 422/2-PCI-335, 422/4-PCI-335)
Enable the hardware-based handshake for flow control. This feature of the UART is
used to prevent loss due to hardware FIFO overflow. From the list, select RTS/CTS to
enable this behavior; otherwise, select none.
Software handshake (Commtech Fastcom 422/2-PCI-335, 422/4-PCI-335)
Allows the UART to send the XOFF character if the receive hardware FIFO gets
too full. It then sends the XON character when the receive FIFO empties. Because
the UART handles this, the XON/XOFF characters are sent immediately, even if
the transmitter is empty. From the list, select XON/XOFF to enable this behavior;
otherwise, select none.
XON character (Commtech Fastcom 422/2-PCI-335, 422/4-PCI-335)
Normally, enter 17 (Control Q). This is the default.
XOFF character (Commtech Fastcom 422/2-PCI-335, 422/4-PCI-335)
Normally, enter 19 (Control S). This is the default.
RS485 auto turnaround (Commtech Fastcom 422/2-PCI-335, 422/4-PCI-335)
Select this check box to enable RS-485 automatic turnaround. In RS-485 mode,
where the transmitters and receivers use the same differential pair of wires, you can
enable only one transmitter at a time. Select this check box to turn on the automatic
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
2-41
2
Serial Communications Support
transmitter control in the UART. The RTS output is routed to the enable input of the
RS-485 transmitter.
RS485 turnaround delay (Commtech Fastcom 422/2-PCI-335, 422/4-PCI-335)
Enter the desired RS-485 turnaround delay. The UART automatically asserts
RTS when there are characters in the transmit FIFO. It de-asserts RTS when the
transmit FIFO empties and the RS-485 turnaround default delay of 0 to 15 bit times
elapses. The transmitter output goes tristate (high impedance) when disabled, which
allows another device to transmit.
Transmit Setup
The Parameter Group Transmit Setup option is supported by only non-F Send
Receive blocks.
Port to modify
From the list, choose a port. The Port to modify parameter specifies the port for
which you want to view or modify the parameters.
Use standard reference and rates (Commtech Fastcom 422/2-PCI-335, 422/4PCI-335)
This check box enables you to use default values for the block.
Transmit software FIFO size
Enter the transmit software FIFO size, in bytes. This parameter specifies the size of
the software FIFO used to buffer transmitted characters.
Transmit FIFO data type
From the list, choose count+32 bit int, count+32 bit uint, count+16 bit
int, count+16 bit uint, 8 bit int null terminated, or 8 bit uint null
terminated. This parameter specifies the data type of the transmitter. The 8-bit
data types require a NULL-terminated string in the input vector.
The 16- and 32-bit data types reserve the first full element to contain the number
of elements to expect in the rest of the input vector. Only the low-order byte of each
data element is sent. Setting this data type allows a wider data type to hold the
bytes.
If the data stream needs to include a NULL byte, you must select one of the 16- or 32bit data types. Because the 8-bit data types are NULL terminated strings, the NULL
byte would terminate the string.
2-42
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
RS-232/RS-422/RS-485 Send/Receive (Composite)
Receive Setup
The Parameter Group Receive Setup option is supported by only non-F Send
Receive blocks.
Port to modify
From the list, choose a port. The Port to modify parameter specifies the port for
which you want to view or modify the parameters.
Use standard reference and rates (Commtech Fastcom 422/2-PCI-335, 422/4PCI-335)
This check box enables you to use default values for the block. Select this check box
to use the default values for the Baud divisor and Sampling rate parameters.
Selecting this check box allows you to enter a value for the Baud rate parameter
and also selects the Prescale parameter. If you clear this check box, you can enter
custom values for the Baud divisor and Sampling rate parameters, but must use
the default value for the Baud rate parameter. Clearing this check box also clears
the Prescale check box.
If selected:
• Reference is set to 14.7456 MHz.
• Prescale is disabled.
• Sampling rate is 16X (standard).
• Select the baud rate from Baud Rate.
If not selected, you must provide a custom baud rate that is not on the drop-down list
to get the desired reference. For example, if you have a desired baud rate of 1.0 MHz,
you can use the following equation to calculate the reference:
reference = baud rate x sampling rate x divisor x prescale
The following values give an acceptable reference that is less than or equal to 50
MHz.
reference = 1.10e6 x 16 x 1 x 1 = 16 MHz
Receive software FIFO size
Enter the size of the receive software FIFO, in bytes. This parameter specifies the
size of the software FIFO to buffer characters between interrupt service and periodic
execution.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
2-43
2
Serial Communications Support
Receive maximum read
Enter the maximum number of elements that you want returned by a single call to
this block. This parameter is also used to set the output vector width. If the Read to
delimiter check box is selected, the maximum number of characters read is limited
by this parameter even if the delimiter is not found.
Receive minimum read
Enter the minimum number of characters to read. If the FIFO does not contain at
least this number of characters, the output vector is empty.
Read to delimiter
Select this check box to have this block return all characters in the FIFO, up to and
including the specified delimiter. If the block does not find the delimiter in the FIFO,
it returns nothing.
If the buffer has hardware observed errors, such as framing errors, characters are
returned regardless of the presence of the delimiter. This special case helps diagnose
errors such as mismatched baud rates.
Delimiter
Enter the numeric value of the character that is the message delimiter. Any value
from 0 to 255 is valid. The common case looks for 10 (line feed) or 13 (carriage
return).
Receive data type
From the list, select count+32 bit int, count+32 bit uint, count+16 bit
int, count+16 bit uint, 8 bit int null terminated, or 8 bit uint null
terminated. This parameter specifies the data type of the receiver. The 8-bit data
types produce a null terminated string in the output vector. For 16- and 32-bit data
types, the first element contains the number of valid elements in the rest of the
output vector.
For 8-bit data types, only the character data is in the output vector, and a NULL
terminator is appended. The 16- or 32-bit wide data types cause the error status from
the UART to be placed in the second byte of each data element. (The error status
contains the parity, overrun, framing, and break bits.) The character data is in the
bottom eight bits of each element; the first element of the vector contains the number
of data elements that follow.
Receive SampleTime
Base sample time or a multiple of the base sample time.
2-44
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
RS-232/RS-422/RS-485 Send/Receive (Composite)
FIFO Setup
The Parameter Group FIFO Setup option is supported by only F Send Receive blocks.
Port to modify
From the list, choose port 1 or 2. The Port to modify parameter specifies the port
for which you want to view or modify the parameters.
Transmit software FIFO size
Enter the transmit software FIFO size, in bytes. This parameter specifies the size of
the software FIFO used to buffer transmitted characters.
Transmit FIFO data type
From the list, choose count+32 bit int, count+32 bit uint, count+16 bit
int, count+16 bit uint, 8 bit int null terminated, or 8 bit uint null
terminated. This parameter specifies the data type of the transmitter. The 8-bit
data types require a NULL-terminated string in the input vector.
The 16- and 32-bit data types reserve the first full element to contain the number
of elements to expect in the rest of the input vector. Only the low-order byte of each
data element is sent. Setting this data type allows a wider data type to hold the
bytes. If the data stream needs to include a NULL byte, you must select one of the
16- or 32-bit data types.
Receive software FIFO size
Enter the size of the receive software FIFO, in bytes. This parameter specifies the
size of the software FIFO to buffer characters between interrupt service and periodic
execution.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
2-45
2
Serial Communications Support
RS232 State (Composite)
RS232 State block
Library
Simulink Real-Time Library for RS-232
Description
The RS232 State block monitors the board state information that is present in the vector
coming out of a receive port on a send/receive block.
The input data vector can be one of Int8, UInt8, Int16, or UInt16. If the input vector
is Int8 or UInt8, no error status is available and the Boolean outputs are false. If the
input vector is Int16 or UInt16, the upper byte should contain the error status bits from
the UART.
This block accumulates errors over the whole input vector. An output error state is true if
it is true for any byte in the input vector.
The FIFO Hardware FIFO block puts the UART status in 16+32 bit data streams. The
RS232 State block looks at this status. Note that only the FIFO Read block passes this
status information to its output port.
Block Parameters
Overrun error output
Select this check box to retrieve overrun error output. This output is true if the
hardware FIFO in the UART was filled while a character in the input vector was
being received.
Parity error output
Select this check box to retrieve parity error output. This output is true if any byte in
the input vector fails the parity check.
Framing error output
2-46
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
RS232 State (Composite)
Select this check box to retrieve framing error output. This output is true if a framing
error occurs on any character in this vector. For example, a framing error might occur
if the baud rates between the transmitter and receiver do not match.
Break interrupt output
Select this check box to retrieve break interrupt output. A break interrupt output
is not an error, but the UART treats it like an error state. The break condition is
detected if the serial line remains at logic 0 (negative voltage) for more than one
character time.
Note: Disconnecting the serial cable does not cause a break with some serial port
hardware.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
2-47
‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ | ‪www.MatlabSite.com‬‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
‫‪CAN, Ethernet, EtherCAT‬‬
‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ | ‪www.MatlabSite.com‬‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ | ‪www.MatlabSite.com‬‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
3
CAN I/O Support
• “CAN Basics” on page 3-2
• “Supported Softing Boards” on page 3-6
• “Model Execution Driven by CAN Messages” on page 3-56
• “Initialization and Termination CAN Messages” on page 3-60
• “CAN Data Frames” on page 3-62
• “Timeouts When Receiving CAN Messages” on page 3-63
• “Blocks — Alphabetical List” on page 3-65
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
3
CAN I/O Support
CAN Basics
In this section...
“Simulink Real-Time CAN Library” on page 3-2
“Data Types” on page 3-3
“Sending and Receiving Remote Frames” on page 3-4
Simulink Real-Time CAN Library
The Simulink Real-Time block library offers support to connect a target computer to
a CAN network using the CAN driver blocks provided by the Simulink Real-Time I/
O CAN block library. This support is for I/O device drivers for the CAN-AC2-ISA and
CAN-AC2-PCI boards from Softing GmbH (Germany). The CAN driver library allows
Simulink Real-Time applications to connect to an arbitrary CAN field bus network for I/
O communication or real-time target-to-target communication.
These drivers support CAN specifications 2.0A and 2.0B and use the dynamic object
mode of the CAN-AC2 firmware to achieve real-time performance.
The Simulink Real-Time CAN library intentionally restricts its support to Softing boards
with two CAN ports. To test the PCI and PC/104 boards, see the xpcdemos folder for
simple loopback test models. Type the following commands to open the corresponding
models., which use CAN_MESSAGE data types.
CAN-AC2-PCI Example
Description
CAN I/O - Simple Use Case —
CAN_MESSAGE data type
Shows simple CAN I/O communication.
CAN I/O - Message-Based Interrupts —
CAN_MESSAGE data type
Shows asynchronous message-based event
support using interrupt driven CAN I/O
communication.
The size of the driver code of the CAN boards supported by the Simulink Real-Time block
library is significant. Because not all Simulink Real-Time applications will use CAN, the
CAN library code is not linked by default when building a real-time application. This
non-linking makes real-time applications smaller if CAN communication functionality
3-2
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
CAN Basics
is not required. If the model to be built contains CAN driver blocks, Simulink Real-Time
links in the CAN library code required to run the model.
For each CAN board three driver blocks are provided:
• A setup block, which defines the type of physical connection (baud rate and so forth).
Exactly one instance of the setup block must be defined in a model for each physically
installed CAN board.
• A send block, which transmits (sends) the data entering the block's input ports to the
connected CAN network. One or more instances of the Send block can be used in a
model.
• A receive block, which retrieves (reads) CAN messages received by the board and
outputs the data at the corresponding output ports. One or more instances of the
Receive block can be used in a model.
Drivers for the supported CAN boards program the boards for the so-called dynamic
object mode. This is one of three modes the CAN board firmware from Softing can operate
in. For a more detailed discussion of the three modes see the board's user manual.
Dynamic object mode is best suited for real-time environments where each component of
the application must have deterministic time behavior. This is the case for the Simulink
Real-Time product, and that is the main reason why this mode has been chosen over
the other two modes, which are FIFO and static object mode. In this mode, you use a
separate port for each ID that you are sending or receiving. The blocks for these boards
send messages in priority order, from the lowest ID to the highest.
Data Types
The Simulink Real-Time CAN blocks support the following message data types. If you
have Softing ISA CAN boards, you can use only the double data type for messages. If you
have Softing PCI and PC/104 CAN boards, you can use either CAN_MESSAGE or double
data types data types for new messages.
• CAN_MESSAGE — Structure that contains an array of eight unsigned 8-bit
integers that contains the data. This array also contains the ID, and the standard
and extended ID range. CAN blocks can pass data of this type without having to
manipulate it, enabling you to create simpler models. Use messages of this data type
for new CAN application models. Consider updating existing CAN application models
to use CAN_MESSAGE data types.
Use CAN Pack blocks to pack individual signals into a CAN message for sending. Use
CAN Unpack blocks to unpack individual signals from CAN messages,
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
3-3
3
CAN I/O Support
You can construct a CAN_MESSAGE by using the CAN Pack. You can use this block
to pass raw data packed elsewhere, by packing a data pattern manually. You can also
use a CANDB file and select a predefined data pattern.
• Double — Double that represents 8 bytes of message in a signal. CAN blocks
manipulate data of this type before passing it. Do not use this data type to create new
CAN application models. The maximum size of the data frame of a CAN message is 8
bytes. This size is the same as the C data type double uses on PC-compatible systems.
At the same time, the double data type is the default data type for Simulink signals.
Represent the CAN data frame within a Simulink model with a scalar Simulink
signal. You can represent the data frame even if the data frame has nothing in
common with a double floating-point value. The Simulink Real-Time CAN library
provides a Utility sublibrary that offers bit-packing and bit-unpacking blocks. Use
these blocks to pack data types other than doubles into 64 bits (8 bytes or a double)
as well as for the opposite operation. Simulink signals of data type double represent
CAN data frames.
Updating Existing Models to Use CAN_MESSAGE Data Types
If you have Softing PCI and PC/104 CAN boards, you can update existing models to use
CAN_MESSAGE data types. As a rule:
• If your existing models contain CAN Bit-Packing and CAN Bit-Unpacking blocks,
replace them with the CAN Pack and CAN Unpack blocks.
• Open and reconfigure the CAN Send and Receive blocks to use CAN_MESSAGE data
types.
• Remove Object Mode CAN Message and CANDBC Translator blocks. Updated models
do not require the conversions that these blocks perform.
Sending and Receiving Remote Frames
Ordinarily, a subsystem sends its value over the CAN bus according to its own schedule,
and another subsystem stores that value for use whenever downstream processing
requires it. Under some circumstances, a subsystem explicitly requests the current value
from another subsystem. This process is called sending a remote frame.
• To prepare a remote frame, use the CAN Pack block with the Remote frame check
box selected. To request the current value, send the remote frame to the responding
subsystem.
3-4
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
CAN Basics
• To process a remote frame, use the CAN Unpack block with the Output remote
check box selected to enable the Remote port. When the Remote port becomes true,
send the current value to the requesting subsystem.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
3-5
3
CAN I/O Support
Supported Softing Boards
The library supports the following CAN boards from Softing GmbH, Germany.
Board Name
Form Factor
Identifier Range
Multiple Board
Support
CAN-AC2
ISA
Standard & Extended with
piggyback module
No
CAN-AC2-PCI
PCI
Standard & Extended
Yes (up to 16)
CAN-AC2-104
PC/104
Standard & Extended
Yes (up to 3)
For more information on the board specifications, visit http://www.softing.com.
• CAN-AC2 (no longer in use)
CAN board for the ISA bus offering two high-speed CAN ports. In its standard
hardware configuration, it uses the Philips PCA 82C200 CAN controller, which
supports standard identifiers only. Piggyback modules are available (one for each
port) that replace the Philips CAN controllers with Intel® 82527 CAN controllers.
The Intel controllers support both standard and extended identifiers. The board is a
memory-mapped device and uses a 16 KB address range between 640 KB and 1 MB.
Do not use this board for new projects; use the CAN-AC2-PCI instead. Softing does
not plan new firmware versions for this board.
• CAN-AC2-PCI
CAN board for the PCI bus offering two CAN ports. The CAN controllers on the board
are the SJA1000 from Philips. In its standard hardware configuration, the board is
designed for both standard and extended identifiers for high-speed CAN. Piggyback
modules are available (one for each port) that add low-speed CAN support to switch
between high-speed and low-speed CAN. The board is a memory-mapped PCI device
that uses 64 KB of address space. The address space is assigned automatically by
the PCI BIOS of the target computer and lies usually in the range between 2 GB and
4 GB. New projects using a desktop computer as the target system should use this
board and not the ISA board.
• CAN-AC2-104
CAN board for the PC/104 bus offering two CAN ports. The CAN controllers on the
board are the SJA1000 from Philips. The board offers both standard and extended
3-6
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Supported Softing Boards
identifiers for high-speed CAN. A low-speed CAN hardware extension is not available.
The board is both I/O mapped and memory mapped. The I/O-mapped area uses a 4
byte I/O address range. The memory-mapped area uses a 4 KB address range between
640 KB and 1 MB.
CAN-AC2-PCI with SJA1000 Controller
The CAN-AC2-PCI driver blocks support the Softing CAN-AC2-PCI. The Philips
SJA1000 chip is used as the CAN controller in this configuration and supports both
standard and extended identifier ranges in parallel. The driver block set for this board is
found in the Simulink Real-Time I/O block library in the group CAN/Softing.
The CAN-AC2-PCI SJA 1000 block group contains the three available CAN blocks:
• Softing CAN-AC2-PCI with SJA1000 Setup
• Softing CAN-AC2-PCI with SJA1000 Send
• Softing CAN-AC2-PCI with SJA1000 Receive
It also includes a FIFO Mode group, which is discussed in “FIFO Mode”.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
3-7
3
CAN I/O Support
Softing CAN-AC2-PCI with SJA1000 Setup
Softing CAN-AC2-PCI with SJA1000 Setup block
Library
Simulink Real-Time Library for CAN
Description
The Setup block defines general settings of the installed CAN boards. The CAN driver
blocks for this board support up to 16 boards for each target system, making up to 32
CAN ports available. For each board in the target system, you must use exactly one
Setup driver block.
Block Parameters
Board
Defines the board being accessed by this driver block instance. If multiple boards are
present in the target computer, you can use the board number (1...16) to differentiate
the boards. The physical board referenced by the board number depends on the
PCI Slot parameter. If just one board is present in the target system, select board
number 1.
CAN 1 - physical bus
Defines the physical CAN bus type of CAN port 1. In the board's standard hardware
configuration, only high-speed CAN is supported. By extending the board with lowspeed CAN piggyback modules, you can also select low-speed CAN as the physical
bus. Do not change this value to low-speed if the module is not present for the
corresponding CAN port. If the module is present (see the Softing user manual on
how to install the modules), you can select between high-speed and low-speed CAN
here.
CAN 1- baud rate
Defines the most common baud rates for CAN port 1. If your model requires a special
baud rate, select the value User defined. In this case, you use the CAN 1 - user
3-8
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Softing CAN-AC2-PCI with SJA1000 Setup
defined baud rate parameter to provide the four values for the timing information.
The vector elements have the following meanings:
[ Prescaler, Synchronization-Jump-Width, Time-Segment-1,
Time-Segment-2 ]
For more information about these values, see the Softing user manual for this board.
CAN 1 - user defined baud rate
See CAN 1- baud rate.
CAN 2 - physical bus
Defines the physical CAN bus type of CAN port 2. In the board's standard hardware
configuration, only high-speed CAN is supported. By extending the board with lowspeed CAN piggyback modules, you can also select low-speed CAN as the physical
bus. Do not set this value should to low-speed if the module is not present for the
corresponding CAN port. If the module is present (see the Softing user manual on
how to install the modules), you can select between high-speed and low-speed CAN
here.
CAN 2 - baud rate
Defines the most common baud rates for CAN port 2. If your model requires a special
baud rate, select the value User defined. In this case, you can use the CAN 2
- user defined baud rate parameter to provide the four values for the timing
information. The vector elements have the following meanings:
[ Prescaler, Synchronization-Jump-Width, Time-Segment-1,
Time-Segment-2 ]
For more information about these values, see the Softing user manual for this board.
CAN 2 - user defined baud rate
See CAN 2 - baud rate.
Initialization command structure and Termination
Defines CAN messages sent during initialization and termination of the Setup block.
Termination
Defines CAN messages sent during termination of the Setup block.
Show bus-off status output
Select this check box to enable the bus-off status output port. The output signal
can be 1 (bus-off state); otherwise, it is 0. If the bus-off status persists, the block
optionally initiates recovery, depending on the setting of Bus-off recovery.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
3-9
3
CAN I/O Support
Clear this check box to disable the output port.
Bus-off recovery
Use this parameter to specify how the model is to perform bus-off recovery for the
CAN network.
From the list, select:
• Off
Does not perform bus-off recovery.
• Auto
Upon detection, the model waits 1 second to see if the bus-off state persists. After
1 second, bus-off recovery occurs.
• Manual Trigger Input
Enables you to input a signal when you want bus-off recovery to occur. Selecting
this option creates an input port for the Setup block.
PCI slot (-1:autosearch)
If only one board of this type is in the target computer, enter -1 to locate the board.
If two or more boards of this type are in the target computer, enter the bus number
and the PCI slot number of the board associated with this driver block. Use the
format [BusNumber,SlotNumber].
To determine the bus number and the PCI slot number, type:
tg = slrt;
getPCIInfo(tg, 'installed')
The board allows you to terminate each of the two CAN ports separately by means of
DIP switches at the rear panel. Refer to the Softing user manual on how to set the DIP
switches. Both CAN ports must be terminated when you use the loopback model provided
to test the board and drivers.
3-10
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Softing CAN-AC2-PCI with SJA1000 Send
Softing CAN-AC2-PCI with SJA1000 Send
Softing CAN-AC2-PCI with SJA1000 Send block
Library
Simulink Real-Time Library for CAN
Description
The Send driver block transmits data to a CAN network from within a block model.
To use CAN_MESSAGE data types to transmit messages, first use the CAN Pack block
to create CAN messages for transmission.
• Do not mix message data types with each send block. Either transmit only
CAN_MESSAGE data types, or transmit only 8 bytes in double data types.
• To prepare a remote frame, use the CAN Pack block with the Remote frame check
box selected. To request the current value, send the remote frame to the responding
subsystem.
Block Parameters
Board
Defines the board used to send out the CAN messages defined by this block instance.
For more information about the meaning of the board number see the Setup driver
block described above. If just one board is present in the target system, select board
number 1.
CAN port
Selects the CAN port to which the CAN message is sent.
CAN identifier range
Selects the identifier range of the CAN messages sent by this block instance. If an
application makes use of mixed standard and extended identifier ranges, you must
use at least two instances of this block, each defining the corresponding identifier
range.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
3-11
3
CAN I/O Support
If the CAN message data type is a CAN_MESSAGE data type, this range must match
the range packed in the message parameter (for example, the message from the CAN
Pack block).
Identifiers
Defines the identifiers of the CAN messages sent by this block. It must be a row
vector in which the elements define a set of either standard or extended identifiers.
Each element must be in the range between 0 and 2047 for standard identifiers or
0 and 229 − 1 for extended identifiers. The number of identifiers for each CAN port
in a model per physical CAN board cannot exceed 200 (limitation of the firmware's
dynamic object mode). The number of elements defined here also defines the number
of input ports of the block. The block icon displays the selected identifier at each
input port.
• If the CAN message data type is CAN_MESSAGE, connect each input port to
one CAN Pack block. Verify that the Identifier parameter for each CAN Pack
block matches the send block input port. Do not connect a vector of messages to
an input port. Each input port number also indicates sending priority, with the
lowest number having the highest priority.
If the CAN message data type is a CAN_MESSAGE data type, these identifiers
must match those packed in the message parameter (for example, the message
from the CAN Pack block).
• If the CAN message data type is not CAN_MESSAGE data type, each input
port accepts the data frame to be sent along with the CAN message. The signal
entering each input port must be a scalar of type double representing the
maximum size of 8 bytes of a CAN message data frame.
Data frame sizes
Defines the data frame size, in bytes, for each CAN message represented by an
identifier in the Identifiers list. It must be a row vector in which the elements
define a set of data frame sizes. Each element must be in the range between 1 and 8.
If the data frame sizes for the identifiers must be the same, you can provide the size
as a scalar, and scalar expansion applies. If the sizes are different for at least two
identifiers, you must provide one element for each identifier. Therefore the length of
the two vectors must be the same.
If the CAN message data type is a CAN_MESSAGE data type, these identifiers must
match those packed in the message parameter (for example, the message from the
CAN Pack block).
3-12
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Softing CAN-AC2-PCI with SJA1000 Send
Show status output ports
Enables status output ports for each CAN message represented by an identifier in
the Identifiers list. If the check box is selected, the block shows as many output
ports as input ports. The data type of each output port is a double, given in the table.
Refer to the Softing manual for more information. The function return codes are:
Code
Description
0
Function executed without detecting an error.
-1
Request overrun.
-2
CAN_MESSAGE data type only. Input port message from CAN Pack block
has incorrect Identifiers or CAN identifier range value.
This is not a Softing standard.
-3
CAN_MESSAGE data type only. Input port message from CAN Pack block
has incorrect Data frame sizes value.
This is not a Softing standard.
-4
Timed out firmware communication.
-99
Board not initialized.
Sample time
Defines the sample time at which the Send block is executed during a real-time
application run.
You can use as many instances of the Send block in the model as required. For example,
by using two instances of the block, you can send CAN messages at different sample
times. Or you can use multiple instances to structure your model more efficiently.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
3-13
3
CAN I/O Support
Softing CAN-AC2-PCI with SJA1000 Receive
Softing CAN-AC2-PCI with SJA1000 Receive block
Library
Simulink Real-Time Library for CAN
Description
The Receive driver block retrieves data from a CAN network to be used within a block
model. You can use as many instances of the Receive block in the model as required.
To use CAN_MESSAGE data types to transmit messages, use the CAN Unpack block to
unpack individual signals from the received CAN messages.
• Do not mix message data types in a block. Each block can receive only
CAN_MESSAGE data types, or receive only 8 bytes in double data types.
• To process a remote frame, use the CAN Unpack block with the Output remote
check box selected to enable the Remote port. When the Remote port becomes true,
send the current value to the requesting subsystem.
Block Parameters
Board
Defines the board the CAN messages defined by this block instance are retrieved
from. For more information about the meaning of the board number, see the Setup
driver block described above. If just one board is present in the target system, select
board number 1.
CAN port
Selects the CAN port from which the CAN messages are retrieved.
CAN identifier range
Selects the identifier range of the CAN messages retrieved by this block instance.
If an application makes use of mixed standard and extended identifier ranges,
3-14
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Softing CAN-AC2-PCI with SJA1000 Receive
you must use at least two instances of this block, each defining the corresponding
identifier range.
If the CAN message data type is a CAN_MESSAGE data type, this range must match
the Identifier type parameter of the connected CAN Unpack block.
Identifiers
Defines the identifiers of the CAN messages retrieved by this block. It must be a row
vector in which the elements define a set of either standard or extended identifiers.
Each element must be in the range between 0 and 2047 for standard identifiers or
0 and 229 - 1 for extended identifiers. The number of identifiers for each CAN port
in a model per physical CAN board cannot exceed 200 (limitation of the firmware's
dynamic object mode). The number of elements defined here also defines the number
of output ports of the block. The block icon displays the selected identifier at each
output port.
Message lengths
Defines the message length, in bytes, for each CAN message represented by an
identifier in the Identifiers list. It must be a row vector in which the elements
define a set of message lengths. Each element must be in the range between 0 and 8.
If the message length for the identifiers must be the same, you can provide the length
as a scalar, and scalar expansion applies. If the lengths are different for at least two
identifiers, you must provide one length element for each identifier. Therefore the
dimensions of the two vectors must be the same.
Output port options
If the CAN message data type is CAN_MESSAGE, connect each output port to one
CAN Unpack block. Verify that the Identifier parameter for each CAN Unpack
block matches the receive block output port.
If the CAN message data type is not CAN_MESSAGE data type, each output port
outputs the data frame being retrieved along with the CAN message. The signal
leaving each output port is a scalar of type double representing the maximum size of
8 bytes of a CAN message data frame.
From the list, select:
Data
Output vector of one double with just data.
Data - Status
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
3-15
3
CAN I/O Support
Output vector of two doubles. First element of the vector contains the data, the
second element contains the status.
Data - Timestamp
Output vector of two doubles. First element of the vector contains the data, the
second element contains the timestamp.
Data - Status - Timestamp
Output vector of three doubles. First element of the vector contains the data, the
second element contains the status, the third element contains the timestamp.
CAN_MESSAGE data type
One CAN_MESSAGE. You can extract the data, status, and timestamp from this
message using a CAN Unpack block.
Refer to the Softing manual for more information. The function return codes are:
Code
Description
0
No new data received.
1
Data frame received.
2
Remote frame received.
-1
Receive data frame overrun.
-2
Receive remote frame overrun.
-3
Object not active.
-7
Timed out firmware communication
-99
Board not initialized.
Generate interrupts
Defines whether the CAN messages defined in this instance of the block will initiate
an interrupt from the CAN board each time they are received. If selected, you can use
CAN messages to control real-time application execution.
Sample time
Defines the sample time at which the Send block is executed during a real-time
application run.
You can use as many instances of the Receive block in the model as required. For
example, by using two instances of the block, you can check for CAN messages at
3-16
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Softing CAN-AC2-PCI with SJA1000 Receive
different sample times. Or you can use multiple instances to structure your model more
efficiently.
CAN-AC2-104 with SJA1000 Controller
The CAN-AC2-104 driver blocks support the Softing CAN-AC2-104 (PC/104) board. The
Philips SJA1000 chip is used as the CAN controller in this configuration and supports
both standard and extended identifier ranges in parallel. The driver block set for this
board is found in the Simulink Real-Time I/O block library in the group CAN/Softing.
The CAN-AC2-104 SJA 1000 block group contains the CAN blocks:
• Softing CAN-AC2-104 with SJA1000 Setup
• Softing CAN-AC2-104 with SJA1000 Send
• Softing CAN-AC2-104 with SJA1000 Receive
It also includes a FIFO Mode group, which is discussed in “FIFO Mode”.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
3-17
3
CAN I/O Support
Softing CAN-AC2-104 with SJA1000 Setup
Softing CAN-AC2-104 with SJA1000 Setup block
Library
Simulink Real-Time Library for CAN
Description
The Setup block defines general settings of the stacked CAN boards. The CAN driver
blocks for this board support up to three boards for each target system, making up to
six CAN ports available. For each board in the target system, you must use exactly one
Setup driver block.
Block Parameters
Board
Defines the board being accessed by this driver block instance. If multiple boards are
present in the target computer, you can use the board number (1...3) to differentiate
the boards. The physical board referenced by the board number depends on the
PCI Slot parameter. If just one board is present in the target system, select board
number 1. The physical board referenced by the board number depends on the I/O
base address parameter.
CAN 1 - baud rate
Defines the most common baud rates for CAN port 1. If your model requires a special
baud rate, select the value User defined. In this case, use the CAN 1 - user
defined baud rate parameter to provide the four values for the timing information.
The vector elements have the following meanings:
[ Prescaler, Synchronization-Jump-Width, Time-Segment-1,
Time-Segment-2 ]
For more information about these values, see the Softing user manual for this board.
CAN 1 - user defined baud rate
3-18
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Softing CAN-AC2-104 with SJA1000 Setup
See CAN 1- baud rate.
CAN 2 - baud rate
Defines the most common baud rates for CAN port 2. If your model requires a special
baud rate, select the value User defined. In this case, use the CAN 2 - user
defined baud rate parameter to provide the four values for the timing information.
The vector elements have the following meanings:
[ Prescaler, Synchronization-Jump-Width, Time-Segment-1,
Time-Segment-2 ]
For more information about these values, see the Softing user manual for this board.
CAN 2 - user defined baud rate
See CAN 2 - baud rate.
Initialization command structure and Termination
Define CAN messages sent during initialization and termination of the Setup block.
Show bus-off status output
Select this check box to enable the bus-off status output port. The output signal
can be 1 (bus-off state); otherwise, it is 0. If the bus-off status persists, the block
optionally initiates recovery, depending on the setting of Bus-off recovery.
Clear this check box to disable the output port.
Bus-off recovery
Use this parameter to specify how the model is to perform bus-off recovery for the
CAN network.
From the list, select:
• Off
Does not perform bus-off recovery.
• Auto
Upon detection, the model waits 1 second to see if the bus-off state persists. After
1 second, bus-off recovery occurs.
• Manual Trigger Input
Enables you to input a signal when you want bus-off recovery to occur. Selecting
this option creates an input port for the Setup block.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
3-19
3
CAN I/O Support
Termination
Define CAN messages sent during termination of the Setup block.
I/O base address
Defines the I/O base address of the board to be accessed by this block instance. The I/
O base address is given by the DIP switch setting on the board itself. The I/O address
range is 4 bytes of I/O address space. It is mainly used to transfer the memory base
address the board should use. See the Softing user manual for this board to set the
I/O base address. The I/O base address entered in this control must correspond with
the DIP switch setting on the board. If more than one board is present in the target
system, a different I/O base address must be entered for each board. In this case the
I/O base address itself defines which board is referenced by which board number.
Memory base address
Defines the memory base address of the board to be accessed by this block instance.
The memory base address is a software setting only (the board does not have a
corresponding DIP switch). The memory address range is 4 KB.
If more than one board is present in the target system, a different memory base
address must be entered for each board. You must make sure that the defined
address ranges do not overlap.
The Softing CAN-AC2-104 driver can address a memory map in the memory range
C8000 - F7FFF. However, the Simulink Real-Time software only reserves memorymapped space in the address range C0000 - DBFFF. Therefore, you must address
the Softing CAN-AC2-104 in the range
C8000 - DBFFF
The board allows you to terminate each of the two CAN ports separately by means
of jumpers found on the board. Refer to the board user manual for how the DIP
switches must be set. Both CAN ports must be terminated when you use the loopback
model provided to test the board and drivers.
Interrupt line
Selects an interrupt line from the list.
3-20
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Softing CAN-AC2-104 with SJA1000 Send
Softing CAN-AC2-104 with SJA1000 Send
Softing CAN-AC2-104 with SJA1000 Send block
Library
Simulink Real-Time Library for CAN
Description
The Send driver block transmits data to a CAN network from within a block model. You
can define up to 200 send objects for standard and extended identifiers for each CAN
channel.
To use CAN_MESSAGE data types to transmit messages, first use the CAN Pack block
to create CAN messages for transmission.
• Do not mix message data types with each send block. Either transmit only
CAN_MESSAGE data types, or transmit only 8 bytes in double data types.
• To prepare a remote frame, use the CAN Pack block with the Remote frame check
box selected. To request the current value, send the remote frame to the responding
subsystem.
Block Parameters
Board
Defines the board to use to send the CAN messages defined by this block instance.
For more information about the meaning of the board number, see the Setup driver
block described above. If just one board is present in the target system, select board
number 1.
CAN Port
Selects the CAN port to send the CAN message.
CAN identifier range
Selects the identifier range of the CAN messages sent by this block instance. If an
application makes use of mixed standard and extended identifier ranges, you must
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
3-21
3
CAN I/O Support
use at least two instances of this block, each defining the corresponding identifier
range.
If the CAN message data type is a CAN_MESSAGE data type, this range must match
the range packed in the message parameter (for example, the message from the CAN
Pack block).
Identifiers
Defines the identifiers of the CAN messages sent by this block. It must be a row
vector in which the elements define a set of either standard or extended identifiers.
Each element must be in the range between 0 and 2047 for standard identifiers or
0 and 2 29 - 1 for extended identifiers. The number of identifiers for each CAN port
in a model per physical CAN board cannot exceed 200 (limitation of the firmware's
dynamic object mode). The number of elements defined here also define the number
of input ports of the block. The block icon displays the selected identifier at each
input port.
• If the CAN message data type is CAN_MESSAGE, connect each input port to
one CAN Pack block. Verify that the Identifier parameter for each CAN Pack
block matches the send block input port. Do not connect a vector of messages to
an input port. Each input port number also indicates sending priority, with the
lowest number having the highest priority.
If the CAN message data type is a CAN_MESSAGE data type, these identifiers
must match those packed in the message parameter (for example, the message
from the CAN Pack block).
• If the CAN message data type is not CAN_MESSAGE data type, each input
port accepts the data frame to be sent along with the CAN message. The signal
entering each input port must be a scalar of type double representing the
maximum size of 8 bytes of a CAN message data frame.
Data frame sizes
Defines the data frame size, in bytes, for each CAN message represented by an
identifier in the Identifiers list. It must be a row vector in which the elements
define a set of data frame sizes. Each element must be in the range between 1 and 8.
If the data frame sizes for the identifiers must be the same, you can provide the size
as a scalar, and scalar expansion applies. If the sizes are different for at least two
identifiers, you must provide one element for each identifier. Therefore the length of
the two vectors must be the same.
3-22
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Softing CAN-AC2-104 with SJA1000 Send
If the CAN message data type is a CAN_MESSAGE data type, these identifiers must
match those packed in the message parameter (for example, the message from the
CAN Pack block).
Show status output ports
Enables status output ports for each CAN message represented by an identifier in
the Identifiers list. If the check box is selected, the block shows as many output
ports as input ports. The data type of each output port is a double, given in the table.
Refer to the Softing manual for more information. The function return codes are:
Code
Description
0
Function executed without detecting an error.
-3
CAN_MESSAGE data type only. Input port message from CAN Pack block
has incorrect Data frame sizes value.
-1
Request overrun.
-2
CAN_MESSAGE data type only. Input port message from CAN Pack block
has incorrect Identifiers or CAN identifier range value.
This is not a Softing standard.
-3
CAN_MESSAGE data type only. Input port message from CAN Pack block
has incorrect Data frame sizes value.
This is not a Softing standard.
-4
Timed out firmware communication.
-99
Board not initialized.
Sample time
Defines the sample time at which the Send block is executed during a real-time
application run.
You can use as many instances of the Send block in the model as required. For example,
by using two instances of the block, you can define different sample times at which CAN
messages are sent out. Or you can use multiple instances to structure your model more
efficiently.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
3-23
3
CAN I/O Support
Softing CAN-AC2-104 with SJA1000 Receive
Softing CAN-AC2-104 with SJA1000 Receive block
Library
Simulink Real-Time Library for CAN
Description
The Receive driver block retrieves data from a CAN network to be used within a block
model. You can use as many instances of the Receive block in the model as required.
To use CAN_MESSAGE data types to transmit messages, use the CAN Unpack block to
unpack individual signals from the received CAN messages.
• Do not mix message data types in a block. Each block can receive only
CAN_MESSAGE data types, or receive only 8 bytes in double data types.
• To process a remote frame, use the CAN Unpack block with the Output remote
check box selected to enable the Remote port. When the Remote port becomes true,
send the current value to the requesting subsystem.
Block Parameters
Board
Defines the board from which the CAN messages defined by this block instance are
to be retrieved. For more information about the meaning of the board number, see
the Setup driver block. If just one board is present in the target system, select board
number 1.
CAN Port
Selects the CAN port from which to retrieve the CAN message.
CAN identifier range
Selects the identifier range of the CAN messages retrieved by this block instance. If
an application makes use of mixed standard and extended identifier ranges, at least
3-24
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Softing CAN-AC2-104 with SJA1000 Receive
two instances of this block must be used, each defining the corresponding identifier
range.
If the CAN message data type is a CAN_MESSAGE data type, this range must match
the Identifier type parameter of the connected CAN Unpack block.
Identifiers
Specifies the identifiers of the CAN messages retrieved by this block. It must be a
row vector where the elements define a set of either standard or extended identifiers.
Each element must be in the range between 0 and 2047 for standard identifiers, or 0
and 229 - 1 for extended identifiers. The number of identifiers for each CAN port in a
model per physical CAN board cannot exceed 200. The number of elements defined
here defines the number of output ports of the block. The block icon displays the
selected identifier at each output port.
Message lengths
Defines the message length, in bytes, for each CAN message represented by an
identifier in the Identifiers list. It must be a row vector in which the elements
define a set of message lengths. Each element must be in the range between 0 and
8. If the message length for identifiers must be the same, you can provide the length
as a scalar, and scalar expansion applies. If the lengths are different for at least two
identifiers, you must provide one length element for each identifier. Therefore the
dimensions of the two vectors must be the same.
Output port options
If the CAN message data type is CAN_MESSAGE, connect each output port to one
CAN Unpack block. Verify that the Identifier parameter for each CAN Unpack
block matches the receive block output port.
If the CAN message data type is not CAN_MESSAGE data type, each output port
outputs the data frame being retrieved along with the CAN message. The signal
leaving each output port is a scalar of type double representing the maximum size of
8 bytes of a CAN message data frame.
From the list, select:
Data
Output vector of one double with just data.
Data - Status
Output vector of two doubles. First element of the vector contains the data, the
second element contains the status.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
3-25
3
CAN I/O Support
Data - Timestamp
Output vector of two doubles. First element of the vector contains the data, the
second element contains the timestamp.
Data - Status - Timestamp
Output vector of three doubles. First element of the vector contains the data, the
second element contains the status, the third element contains the timestamp.
CAN_MESSAGE data type
One CAN_MESSAGE. You can extract the data, status, and timestamp from this
message using a CAN Unpack block.
Refer to the Softing manual for more information. The function return codes are:
Code
Description
0
No new data received.
1
Data frame received.
2
Remote frame received.
-1
Receive data frame overrun.
-2
Receive remote frame overrun.
-3
Object not active.
-7
Timed out firmware communication
-99
Board not initialized.
Generate interrupts
Defines whether the CAN messages defined in this instance of the block initiate an
interrupt from the CAN board each time they are received. If selected, you can use
CAN messages to control real-time application execution.
Sample time
Defines the sample time at which the Send block is executed during a real-time
application run.
You can use as many instances of the Receive block in the model as required. For
example, by using two instances of the block, you can check for different sample times
at which CAN messages are retrieved. Or you can use multiple instances to structure
your model more efficiently. You can define up to 200 receive objects for standard and
extended identifiers for each CAN channel.
3-26
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
CAN Bit-Packing
CAN Bit-Packing
CAN Bit-Packing block
Library
Simulink Real-Time Library for CAN
Description
This block is for message data of type double. This block constructs CAN data frames,
and its output port is ordinarily connected to an input port of a CAN Send driver block.
The block has one output port of data type double (a scalar), which represents the data
frame entity constructed by the signals entering the block at its input ports. The number
of input ports depends on the setting in the block's dialog box.
Do not use this block to construct CAN_MESSAGE data types or to prepare a remote
frame. Use the CAN Pack block.
Block Parameters
Bit Patterns
Specify bit patterns. The data type entered in the control must be a MATLAB cell
array vector. The number of elements in the cell array define the number of input
ports shown by this block instance. The cell array elements must be of type double
array and define the position of each bit of the incoming value (data typed input port)
in the outgoing double value (data frame).
From a data type perspective (input ports), the block behaves like a Simulink Sink
block, and therefore the data types of the input ports are inherited from the driving
blocks.
The sample time of the block is also inherited from the driving blocks. Therefore you do
not need an explicit sample time in the block's dialog box.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
3-27
3
CAN I/O Support
Example
The example in this topic describes the use of the Softing CAN blocks with standard
double data types for message storage. For an alternative and easier way to pack
CAN_MESSAGE data types, use the CAN Pack block.
The functionality of the block is best explained by means of an example.
Assume that a node on the CAN network needs to receive a CAN message with identifier
156 having the following data frame content. The data frame must be 6 bytes long.
Byte 0
Function class of type uint8
Byte 1
Function subclass of type uint8 with
reversed bit order
Byte 2
Reserved, all bits must be 1
Byte 3
Bit 0 must be 0, Bit 1 must be a boolean
(flag), bits 2 to 7 must be bit 2 to 7 of an
incoming int8 value (control)
Byte 4 and 5
Value of type int16
The bit pattern cell array, which bit-packs the data frame according to the above
specification, can look as follows:
{ [0:7] , [15:-1:8] , [16:23] , [25] , [-1,-1,26:31] , [32:47] }
And the Simulink model simulating the required behavior would be as shown.
3-28
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
CAN Bit-Packing
• The function class is of type uint8, which has an example value of 112. This value
becomes byte 0 (bits 0 to 7) of the data frame. Therefore the first bit (element 1 of
double array [0:7]) gets bit 0 of the data frame, the second bit 1, and so on. It is easiest
to define this mapping by the MATLAB colon operator (:).
• The function subclass is of type uint8, which has an example value of 23. This value
becomes byte 1 (bits 8:15) of the data frame but in reversed bit order. Therefore the
first bit (element 1 of double array [15:-1:8]) gets bit 15, the second bit 14, and so
on. It is easiest to define this mapping by the MATLAB colon operator (:) and an
increment of -1.
• The reserved byte 2 must have all bits set to 1. If a bit position in the outgoing data
frame is not referenced by a bit pattern array element, the bit is 0 by default, but you
cannot set them to 1 as the default. Therefore a uint8 constant with value 255 must
be brought in externally. The constant 255 must get to bit position 16 to 23 (byte 2) of
the outgoing data frame.
Because bit 0 of data frame byte 3 (bit 24) must be 0, and 0 is the default bit value
if not referenced by a bit pattern array element, you do not need to take an explicit
action here.
• The flag is of type boolean, which has an example value of 1. This value must become
bit 1 of byte 3 (bit 25) of the data frame. Therefore the single bit (element 1 of double
array [25]) must get bit 25 of the data frame.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
3-29
3
CAN I/O Support
• The control is of type int8, which has an example value of 121. But only bits 2 to 7
must be mapped into the outgoing data frame or, in other words, bits 0 and 1 must be
thrown away. Because indexing of incoming values starts with the first bit (bit 0), a
special indexing value (-1) must be used to skip bit 0 and 1 of the incoming int8 value.
Bits 2 to 7 are directly mapped to bits 2 to 7 of byte 3 (bits 26 to 31) of the outgoing
data frame. This leads to the following bit pattern: [-1,-1,26:31].
• The value is of type int16, which has an example value of -12270. This value must
become byte 4 and 5 (bits 32 to 47) of the outgoing data frame. Therefore the first bit
(element 1 of double array [32:47]) must get bit 32 of the data frame, the second bit
33, and so on. It is easiest to define this mapping by the MATLAB colon operator (:).
• The output of the CAN bit-packing block consists of a double value representing the
packed data types within the first six bytes. The last two bytes are zero. This means
that even in the case where less than eight bytes are significant, the CAN data frame
is represented by a double value (eight bytes). The value of the constructed floatingpoint double does not have a particular meaning but you still see it with a numerical
display.
• The data frame is then propagated to the CAN Send driver block and is sent as part of
a CAN message having identifier 156. In the Send block's dialog box, the data frame
size is 6 bytes, meaning that only the first six bytes of the incoming double value are
transmitted as part of the CAN message.
3-30
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
CAN Bit-Unpacking
CAN Bit-Unpacking
CAN Bit-Unpacking block
Library
Simulink Real-Time Library for CAN
Description
This block is for message data of type double. This block extracts CAN data frames, and
its input port is normally connected to an output port of a CAN Receive driver block. The
block has one input port of data type double (a scalar), which represents the data frame
entity from which the signals are extracted and leaving the block at its output ports. The
number of output ports and the data type of each output port depend on the settings in
the block's dialog box.
Do not use this block to unpack CAN_MESSAGE data types or to process a remote frame.
Use the CAN Unpack block.
Block Parameters
Bit Patterns
Lets you define the bit patterns in a flexible way. The data type entered in the control
must be a MATLAB cell array vector. The number of elements in the cell array define
the number of output ports shown by this block instance. The cell array elements
must be of type double array and define the position of each bit of the incoming value
(data typed output port) in the incoming double value (data frame).
Data Types
From a data type perspective (output ports), the block behaves like a Simulink
Source block, and therefore the data types of the output ports must be defined in the
second control (edit field). The data type entered in that control must be a MATLAB
cell array vector of the same length as the bit pattern cell array. The cell array
elements must be of type char and define the data type of the corresponding output
port. The following values are supported:
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
3-31
3
CAN I/O Support
boolean, int8, uint8, int16, uint16, int32, uint32
The sample time of the block is inherited from the driving block. Therefore you do not
need to provide an explicit sample time in the block's dialog box.
If you unpack the data frame into a signed type (int8, int 16, or int 32), the block
performs sign extension. For example, if the bit pattern is [0:4], and the data type is
int8, you are extracting 5 bits into an 8 bit wide signed type. In this case, bits 5, 6, and 7
are the same as bit 4, resulting in sign extension. This functionality enables you to pack
and unpack negative numbers without losing precision. In the preceding example, you
can pack and unpack numbers in the range [-16 : 15] (a fictitious int5 type).
Example
The example in this topic describes the use of the Softing CAN blocks with standard
double data types for message storage. For an alternative and easier way to unpack
CAN_MESSAGE data types, use the CAN Unpack block.
The functionality of the block is easiest explained by means of an example. The same
example as used above shows the functionality of the bit-packing block. But in this
case, the data frame is sent by an external CAN node and is received by the real-time
application running on a Simulink Real-Time system. Therefore the bit-unpacking block
is used to extract the various data fields from the entire data frame. Because the bit
pattern definitions of the packing and unpacking block are symmetric, the bit pattern
definition could look exactly the same. You do not need to extract byte 2 (reserved area),
because its content is known. The bit pattern edit field can therefore look as follows:
{ [0:7] , [15:-1:8] , [25] , [-1,-1,26:31] , [32:47] }
and the data type edit field as
{ 'uint8' , 'uint8' , 'boolean' , 'int8' , 'int16' }
3-32
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
CAN Bit-Unpacking
This leads to the following Simulink model.
In many cases it makes sense to test the bit-packing and unpacking operations in a
Simulink model (simulation) before building the real-time application. Both blocks work
the same way either in the Simulink system or the generated code. By combining the two
models shown so far, a third model emerges that can be used to simulate the behavior.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
3-33
3
CAN I/O Support
CAN Timeout Detection
CAN Timeout Detection block
Library
Simulink Real-Time Library for CAN
Description
This block uses the timestamp information to calculate the timeout condition. To use this
block, select the Output timestamp check box of a CAN Unpack block. Then connect the
Timestamp output port to the input port of the CAN Timeout Detection block.
For an example of this usage, add this block to xpccanpcis, a loopback example for the
CAN-AC2-PCI board using CAN_MESSAGE data types for message storage.
Block Parameters
Timeout
Specify the timeout value, in seconds. The output of the block is:
• 0, if a timeout has not been detected
• 1, if a timeout has been detected
3-34
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
CAN Pack
CAN Pack
Pack individual signals into CAN message
Library
CAN Communication
Embedded Coder®/ Embedded Targets/ Host Communication
Description
The CAN Pack block loads signal data into a message at specified intervals during the
simulation.
Note: To use this block, you also need a license for Simulink software.
CAN Pack block has one input port by default. The number of block inputs is dynamic
and depends on the number of signals you specify for the block. For example, if your
block has four signals, it has four block inputs.
This block has one output port, CAN Msg. The CAN Pack block takes the specified input
parameters and packs the signals into a message.
Other Supported Features
The CAN Pack block supports:
• The use of Simulink Accelerator™ Rapid Accelerator mode. Using this feature, you
can speed up the execution of Simulink models.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
3-35
3
CAN I/O Support
• The use of model referencing. Using this feature, your model can include other
Simulink models as modular components.
• Code generation using Simulink Coder to deploy models to targets.
Note: Code generation is not supported if your signal information consists of signed or
unsigned integers greater than 32-bits long.
For more information on these features, see the Simulink documentation.
Dialog Box
Use the Function Block Parameters dialog box to select your CAN Pack block
parameters.
Parameters
Data is input as
3-36
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
CAN Pack
Select your data signal:
• raw data: Input data as a uint8 vector array. If you select this option, you only
specify the message fields. all other signal parameter fields are unavailable. This
option opens only one input port on your block.
• manually specified signals: Allows you to specify data signal definitions. If you
select this option, use the Signals table to create your signals. The number of
block inputs depends on the number of signals you specify.
• CANdb specified signals: Allows you to specify a CAN database file that
contains message and signal definitions. If you select this option, select a CANdb
file. The number of block inputs depends on the number of signals specified in the
CANdb file for the selected message.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
3-37
3
CAN I/O Support
CANdb file
This option is available if you specify that your data is input via a CANdb file in the
Data is input as list. Click Browse to find the CANdb file on your system. The
message list specified in the CANdb file populates the Message section of the dialog
box. The CANdb file also populates the Signals table for the selected message.
Note: File names that contain non-alphanumeric characters such as equal signs,
ampersands, and so forth are not valid CAN database file names. You can use
periods in your database name. Rename CAN database files with non-alphanumeric
characters before you use them.
Message list
3-38
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
CAN Pack
This option is available if you specify that your data is input via a CANdb file in the
Data is input as field and you select a CANdb file in the CANdb file field. Select
the message to display signal details in the Signals table.
Message
Name
Specify a name for your CAN message. The default is CAN Msg. This option is
available if you choose to input raw data or manually specify signals. This option in
unavailable if you choose to use signals from a CANdb file.
Identifier type
Specify whether your CAN message identifier is a Standard or an Extended
type. The default is Standard. A standard identifier is an 11-bit identifier and an
extended identifier is a 29-bit identifier. This option is available if you choose to
input raw data or manually specify signals. For CANdb specified signals, the
Identifier type inherits the type from the database.
Identifier
Specify your CAN message ID. This number must be a positive integer from 0
through 2047 for a standard identifier and from 0 through 536870911 for an
extended identifier. You can also specify hexadecimal values using the hex2dec
function. This option is available if you choose to input raw data or manually specify
signals.
Length (bytes)
Specify the length of your CAN message from 0 to 8 bytes. If you are using CANdb
specified signals for your data input, the CANdb file defines the length of your
message. If not, this field defaults to 8. This option is available if you choose to input
raw data or manually specify signals.
Remote frame
Specify the CAN message as a remote frame.
Signals Table
This table appears if you choose to specify signals manually or define signals using a
CANdb file.
If you are using a CANdb file, the data in the file populates this table automatically
and you cannot edit the fields. To edit signal information, switch to manually specified
signals.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
3-39
3
CAN I/O Support
If you have selected to specify signals manually, create your signals manually in this
table. Each signal you create has the following values:
Name
Specify a descriptive name for your signal. The Simulink block in your model displays
this name. The default is Signal [row number].
Start bit
Specify the start bit of the data. The start bit is the least significant bit counted from
the start of the message data. The start bit must be an integer from 0 through 63.
Length (bits)
Specify the number of bits the signal occupies in the message. The length must be an
integer from 1 through 64.
Byte order
Select either of the following options:
• LE: Where the byte order is in little-endian format (Intel). In this format you
count bits from the start, which is the least significant bit, to the most significant
bit, which has the highest bit index. For example, if you pack one byte of data
in little-endian format, with the start bit at 20, the data bit table resembles this
figure.
3-40
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
CAN Pack
Little-Endian Byte Order Counted from the Least Significant Bit to the Highest Address
• BE: Where byte order is in big-endian format (Motorola®). In this format you count
bits from the start, which is the least significant bit, to the most significant bit.
For example, if you pack one byte of data in big-endian format, with the start bit
at 20, the data bit table resembles this figure.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
3-41
3
CAN I/O Support
Big-Endian Byte Order Counted from the Least Significant Bit to the Lowest Address
Data type
Specify how the signal interprets the data in the allocated bits. Choose from:
• signed (default)
• unsigned
• single
• double
Multiplex type
Specify how the block packs the signals into the CAN message at each timestep:
3-42
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
CAN Pack
• Standard: The signal is packed at each timestep.
• Multiplexor: The Multiplexor signal, or the mode signal is packed. You can
specify only one Multiplexor signal per message.
• Multiplexed: The signal is packed if the value of the Multiplexor signal (mode
signal) at run time matches the configured Multiplex value of this signal.
For example, a message has four signals with the following types and values.
Signal Name
Multiplex Type
Multiplex Value
Signal-A
Standard
N/A
Signal-B
Multiplexed
1
Signal-C
Multiplexed
0
Signal-D
Multiplexor
N/A
In this example:
• The block packs Signal-A (Standard signal) and Signal-D (Multiplexor signal) in
every timestep.
• If the value of Signal-D is 1 at a particular timestep, then the block packs SignalB along with Signal-A and Signal-D in that timestep.
• If the value of Signal-D is 0 at a particular timestep, then the block packs SignalC along with Signal-A and Signal-D in that timestep.
• If the value of Signal-D is not 1 or 0, the block does not pack either of the
Multiplexed signals in that timestep.
Multiplex value
This option is available only if you have selected the Multiplex type to be
Multiplexed. The value you provide here must match the Multiplexor signal
value at run time for the block to pack the Multiplexed signal. The Multiplex
value must be a positive integer or zero.
Factor
Specify the Factor value to apply to convert the physical value (signal value) to the
raw value packed in the message. See “Conversion Formula” on page 3-44 to
understand how physical values are converted to raw values packed into a message.
Offset
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
3-43
3
CAN I/O Support
Specify the Offset value to apply to convert the physical value (signal value) to the
raw value packed in the message. See “Conversion Formula” on page 3-44 to
understand how physical values are converted to raw values packed into a message.
Min
Specify the minimum physical value of the signal. The default value is -inf
(negative infinity). You can specify a number for the minimum value. See
“Conversion Formula” on page 3-44 to understand how physical values are
converted to raw values packed into a message.
Max
Specify the maximum physical value of the signal. The default value is inf. You
can specify a number for the maximum value. See “Conversion Formula” on page
3-44 to understand how physical values are converted to raw values packed into a
message.
Conversion Formula
The conversion formula is
raw_value = (physical_value - Offset) / Factor
where physical_value is the value of the signal after it is saturated using the specified
Min and Max values. raw_value is the packed signal value.
See Also
CAN Unpack
3-44
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
CAN Unpack
CAN Unpack
Unpack individual signals from CAN messages
Library
CAN Communication
Embedded Coder/ Embedded Targets/ Host Communication
Description
The CAN Unpack block unpacks a CAN message into signal data using the specified
output parameters at every timestep. Data is output as individual signals.
Note: To use this block, you also need a license for Simulink software.
The CAN Unpack block has one output port by default. The number of output ports is
dynamic and depends on the number of signals you specify for the block to output. For
example, if your block has four signals, it has four output ports.
Other Supported Features
The CAN Unpack block supports:
• The use of Simulink Accelerator Rapid Accelerator mode. Using this feature, you can
speed up the execution of Simulink models.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
3-45
3
CAN I/O Support
• The use of model referencing. Using this feature, your model can include other
Simulink models as modular components.
• Code generation using Simulink Coder to deploy models to targets.
Note: Code generation is not supported if your signal information consists of signed or
unsigned integers greater than 32-bits long.
For more information on these features, see the Simulink documentation.
Dialog Box
Use the Function Block Parameters dialog box to select your CAN message unpacking
parameters.
3-46
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
CAN Unpack
Parameters
Data to be output as
Select your data signal:
• raw data: Output data as a uint8 vector array. If you select this option, you only
specify the message fields. The other signal parameter fields are unavailable. This
option opens only one output port on your block.
• manually specified signals: Allows you to specify data signals. If you select this
option, use the Signals table to create your signals message manually.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
3-47
3
CAN I/O Support
The number of output ports on your block depends on the number of signals you
specify. For example, if you specify four signals, your block has four output ports.
• CANdb specified signals: Allows you to specify a CAN database file that
contains data signals. If you select this option, select a CANdb file.
The number of output ports on your block depends on the number of signals
specified in the CANdb file. For example, if the selected message in the CANdb
file has four signals, your block has four output ports.
CANdb file
3-48
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
CAN Unpack
This option is available if you specify that your data is input via a CANdb file in the
Data to be output as list. Click Browse to find the CANdb file on your system. The
messages and signal definitions specified in the CANdb file populate the Message
section of the dialog box. The signals specified in the CANdb file populate Signals
table.
Note: File names that contain non-alphanumeric characters such as equal signs,
ampersands, and so forth are not valid CAN database file names. You can use
periods in your database name. Rename CAN database files with non-alphanumeric
characters before you use them.
Message list
This option is available if you specify that your data is to be output as a CANdb file
in the Data to be output as list and you select a CANdb file in the CANdb file
field. You can select the message that you want to view. The Signals table then
displays the details of the selected message.
Message
Name
Specify a name for your CAN message. The default is CAN Msg. This option is
available if you choose to output raw data or manually specify signals.
Identifier type
Specify whether your CAN message identifier is a Standard or an Extended
type. The default is Standard. A standard identifier is an 11-bit identifier and
an extended identifier is a 29-bit identifier. This option is available if you choose
to output raw data or manually specify signals. For CANdb-specified signals, the
Identifier type inherits the type from the database.
Identifier
Specify your CAN message ID. This number must be a integer from 0 through 2047
for a standard identifier and from 0 through 536870911 for an extended identifier. If
you specify –1, the block unpacks the messages that match the length specified for
the message. You can also specify hexadecimal values using the hex2dec function.
This option is available if you choose to output raw data or manually specify signals.
Length (bytes)
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
3-49
3
CAN I/O Support
Specify the length of your CAN message from 0 to 8 bytes. If you are using CANdb
specified signals for your output data, the CANdb file defines the length of
your message. If not, this field defaults to 8. This option is available if you choose to
output raw data or manually specify signals.
Signals Table
This table appears if you choose to specify signals manually or define signals using a
CANdb file.
If you are using a CANdb file, the data in the file populates this table automatically
and you cannot edit the fields. To edit signal information, switch to manually specified
signals.
If you have selected to specify signals manually, create your signals manually in this
table. Each signal you create has the following values:
Name
Specify a descriptive name for your signal. The Simulink block in your model displays
this name. The default is Signal [row number].
Start bit
Specify the start bit of the data. The start bit is the least significant bit counted from
the start of the message. The start bit must be an integer from 0 through 63.
Length (bits)
Specify the number of bits the signal occupies in the message. The length must be an
integer from 1 through 64.
Byte order
Select either of the following options:
• LE: Where the byte order is in little-endian format (Intel). In this format you
count bits from the start, which is the least significant bit, to the most significant
bit, which has the highest bit index. For example, if you pack one byte of data
in little-endian format, with the start bit at 20, the data bit table resembles this
figure.
3-50
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
CAN Unpack
Little-Endian Byte Order Counted from the Least Significant Bit to the Highest Address
• BE: Where the byte order is in big-endian format (Motorola). In this format you
count bits from the start, which is the least significant bit, to the most significant
bit. For example, if you pack one byte of data in big-endian format, with the start
bit at 20, the data bit table resembles this figure.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
3-51
3
CAN I/O Support
Big-Endian Byte Order Counted from the Least Significant Bit to the Lowest Address
Data type
Specify how the signal interprets the data in the allocated bits. Choose from:
• signed (default)
• unsigned
• single
• double
Multiplex type
Specify how the block unpacks the signals from the CAN message at each timestep:
3-52
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
CAN Unpack
• Standard: The signal is unpacked at each timestep.
• Multiplexor: The Multiplexor signal, or the mode signal is unpacked. You can
specify only one Multiplexor signal per message.
• Multiplexed: The signal is unpacked if the value of the Multiplexor signal
(mode signal) at run time matches the configured Multiplex value of this signal.
For example, a message has four signals with the following values.
Signal Name
Multiplex Type
Multiplex Value
Signal-A
Standard
N/A
Signal-B
Multiplexed
1
Signal-C
Multiplexed
0
Signal-D
Multiplexor
N/A
In this example:
• The block unpacks Signal-A (Standard signal) and Signal-D (Multiplexor signal)
in every timestep.
• If the value of Signal-D is 1 at a particular timestep, then the block unpacks
Signal-B along with Signal-A and Signal-D in that timestep.
• If the value of Signal-D is 0 at a particular timestep, then the block unpacks
Signal-C along with Signal-A and Signal-D in that timestep.
• If the value of Signal-D is not 1 or 0, the block does not unpack either of the
Multiplexed signals in that timestep.
Multiplex value
This option is available only if you have selected the Multiplex type to be
Multiplexed. The value you provide here must match the Multiplexor signal
value at run time for the block to unpack the Multiplexed signal. The Multiplex
value must be a positive integer or zero.
Factor
Specify the Factor value applied to convert the unpacked raw value to the physical
value (signal value). See “Conversion Formula” on page 3-55 to understand how
unpacked raw values are converted to physical values.
Offset
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
3-53
3
CAN I/O Support
Specify the Offset value applied to convert the physical value (signal value) to the
unpacked raw value. See “Conversion Formula” on page 3-55 to understand how
unpacked raw values are converted to physical values.
Min
Specify the minimum raw value of the signal. The default value is -inf (negative
infinity). You can specify a number for the minimum value. See “Conversion
Formula” on page 3-55 to understand how unpacked raw values are converted to
physical values.
Max
Specify the maximum raw value of the signal. The default value is inf. You can
specify a number for the maximum value. See “Conversion Formula” on page 3-55
to understand how unpacked raw values are converted to physical values.
Output Ports
Selecting an Output ports option adds an output port to your block.
Output identifier
Select this option to output a CAN message identifier. The data type of this port is
uint32.
Output remote
Select this option to output the message remote frame status. This option adds a new
output port to the block. The data type of this port is uint8.
Output timestamp
Select this option to output the message time stamp. This option adds a new output
port to the block. The data type of this port is double.
Output length
Select this option to output the length of the message in bytes. This option adds a
new output port to the block. The data type of this port is uint8.
Output error
Select this option to output the message error status. This option adds a new output
port to the block. The data type of this port is uint8.
Output status
Select this option to output the message received status. The status is 1 if the block
receives new message and 0 if it does not. This option adds a new output port to the
block. The data type of this port is uint8.
3-54
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
CAN Unpack
If you do not select an Output ports option, the number of output ports on your block
depends on the number of signals you specify.
Conversion Formula
The conversion formula is
physical_value = raw_value *
Factor + Offset
where raw_value is the unpacked signal value. physical_value is the scaled signal
value which is saturated using the specified Min and Max values.
See Also
CAN Pack
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
3-55
3
CAN I/O Support
Model Execution Driven by CAN Messages
In certain applications, the real-time application execution can be paced by incoming
CAN messages. The standard behavior of the Simulink Real-Time kernel is to drive the
real-time application in time monotonic fashion (time interrupt). However, the driving
interrupt can be replaced by other hardware interrupts. Because the three supported
CAN boards support firing a hardware interrupt upon reception of a specific CAN
message, you can replace the timer interrupt line in the kernel by the interrupt line
assigned to a CAN board. You can then drive the real-time application by sending CAN
messages, interpreting them in the CAN Receive blocks, and firing a hardware interrupt
in response.
To set this up, do the following:
1
Replace the timer interrupt line in the kernel setup with the board's hardware
interrupt line.
2
Set up the CAN Setup and CAN Receive blocks.
Both steps are slightly different for each of the three supported CAN boards.
In this section...
“CAN-AC2 (ISA)” on page 3-56
“CAN-AC2-PCI” on page 3-57
“CAN-AC2-104 (PC/104)” on page 3-58
CAN-AC2 (ISA)
The CAN-AC2 is an ISA board, and the hardware interrupt line is set by means of
hardware jumpers on the board. Refer to the Softing user manual for the board on how
to set a certain interrupt line. Select an interrupt line that is not used by any other
hardware device in the Simulink Real-Time system (for example by the Ethernet card).
1
In the Simulink window, select Simulation > Model Configuration Parameters.
The Configuration Parameters dialog box is displayed.
3-56
2
Select node Code Generation.
3
In the Target selection section, set the System target file field to slrt.tlc.
4
Select the Simulink Real-Time Options node.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Model Execution Driven by CAN Messages
5
In the Real-time interrupt source field, select the interrupt line number that you
have set using the jumpers on the board.
6
Click OK and save the model.
7
Open the dialog box of the CAN Receive block in the model that defines the CAN
message (identifier) to be used to fire the interrupt. Select the Generate interrupts
check box. Selecting this box declares that the CAN messages defined through
their identifiers in this Receive block instance are messages that fire an interrupt.
In other words, it is not possible to define a single CAN message within the set of
defined identifiers to be the only one to fire an interrupt. In most cases only the
reception of one specific message is used to drive the application execution. Therefore
use at least two instances of the Receive block: one to receive the CAN message that
drives the execution (Generate Interrupts selected) and the other for the remaining
normal CAN messages to be received (Generate Interrupts cleared).
CAN-AC2-PCI
The CAN-AC2 is a PCI board, and the hardware interrupt line is automatically assigned
by the PCI BIOS during the initialization of the target system. At the model level, open
the Simulation > Model Configuration Parameters dialog box. At the Simulink
Real-Time Options node, set Real-time interrupt source Auto (PCI only). This
option enables the Simulink Real-Time software to automatically determine the IRQ that
the BIOS assigned to the board and use it. Alternatively, use the Simulink Real-Time
function SimulinkRealTime.target.getPCIInfo at the command prompt to query
the target system for installed PCI devices and the assigned resources. Write down the
interrupt line number assigned to the CAN-AC2-PCI board.
1
In the Simulink window, select Simulation > Model Configuration Parameters.
The Configuration Parameters dialog box is displayed.
2
Select node Code Generation.
3
In the Target selection section, set the System target file field to slrt.tlc.
4
Select the Simulink Real-Time Options node.
5
In the Real-time interrupt source field, select the interrupt line number that you
retrieved with the SimulinkRealTime.target.getPCIInfo command.
Alternatively, select Auto (PCI only) to enable the Simulink Real-Time software
to automatically determine the IRQ that the BIOS assigned to the board and use it.
6
In the I/O board generating the interrupt field, select Softing_CAN-AC2-PCI.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
3-57
3
CAN I/O Support
7
Click OK and save the model.
8
Open the dialog box of the CAN Receive block in the model that defines the CAN
message (identifier) to be used to fire the interrupt. Select the Generate interrupts
check box. Selecting this box declares that the CAN messages defined through
their identifiers in this Receive block instance are messages that fire an interrupt.
In other words, it is not possible to define a single CAN message within the set of
defined identifiers to be the only one to fire an interrupt. In most cases only the
reception of one specific message is used to drive the application execution. Therefore
use at least two instances of the Receive block: one to receive the CAN message that
drives the execution (Generate Interrupts selected) and the other for the remaining
normal CAN messages to be received (Generate Interrupts cleared).
CAN-AC2-104 (PC/104)
The CAN-AC2-104 is an ISA board (PC/104), and the hardware interrupt line is set by
means of a software setting within the CAN Setup driver block. Note a free interrupt
line that is not used by any other hardware device in the Simulink Real-Time system (for
example by the Ethernet card).
1
In the Simulink window, select Simulation > Model Configuration Parameters.
The Configuration Parameters dialog box is displayed.
3-58
2
Select node Code Generation.
3
In the Target selection section, set the System target file field to slrt.tlc.
4
Select the Simulink Real-Time Options node.
5
In the Real-time interrupt source field, select the free interrupt line number that
you chose.
6
In the I/O board generating the interrupt field, select Softing_CAN-AC2-104.
7
Click OK and save the model.
8
In the model open the dialog box of the CAN Setup block for the CAN-AC2-104
board. Select the chosen interrupt line in the Interrupt Line pop-up menu and
close the dialog box. Open the dialog box of the CAN Receive block in the model
that defines the CAN message (identifier) to be used to fire the interrupt. Select the
Generate interrupts check box. Selecting this box declares that the CAN messages
defined through their identifiers in this Receive block instance are messages that fire
an interrupt. In other words, it is not possible to define a single CAN message within
the set of defined identifiers to be the only one to fire an interrupt. In most cases
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Model Execution Driven by CAN Messages
only the reception of one specific message is used to drive the application execution.
Therefore use at least two instances of the Receive block. One to receive the CAN
message that drives the execution (Generate Interrupts selected) and the other for
the remaining normal CAN messages to be received (Generate Interrupts cleared).
After you complete these two steps, you are ready to build the model. After the
downloading has succeeded and the real-time application execution has been started, the
execution is now driven by the selected CAN messages. The execution time information
displayed on the target screen is now directly dependent on the reception of the
corresponding message. If no message is received, the time does not advance. The
corresponding CAN message on the other CAN node should only be generated if the
Simulink Real-Time application is running, otherwise unexpected interrupt messages
might be displayed on the target screen.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
3-59
3
CAN I/O Support
Initialization and Termination CAN Messages
The CAN Setup driver blocks for the supported CAN boards allow the definition of CAN
messages to be sent during initialization and termination of the real-time application
(once at the beginning of each application run and once before an application run is
stopped). The main purpose for sending these messages is to initialize or terminate other
CAN nodes on the network. This is the case, for example, for CANopen or DeviceNet
nodes. Even if those CAN application layers are not directly supported, communication
with those nodes can usually be done over standard CAN messages as long as the nodes
have been initialized. The initialization and termination fields of the Setup blocks are
intended for this purpose.
You define the initialization and termination CAN messages using MATLAB struct
arrays with CAN specific field names. This is the same concept as used for the RS-232,
GPIB, and general Counter driver blocks found in the Simulink Real-Time I/O library.
Refer to those driver blocks and their help for additional information about this basic
concept.
The CAN Setup block-specific field names are the following:
Port — Selects the CAN port over which the message is sent. Valid values are either 1 or
2 (double).
Type — Defines whether the message to be sent is of type standard or extended. Valid
values are either 'Standard' or 'Extended' (strings).
Identifier — Defines the identifier of the message. The value (scalar) itself must be in
the corresponding identifier range (standard or extended).
Data — Defines the data frame to be sent out along with the CAN message. The length
of the row vector defines the data frame size.
• If the CAN message data type is a CAN_MESSAGE data type, the value of the frame
size vector must match the Length parameter of the connected CAN Pack block.
• If the CAN message data type is a double, this field defines the data frame to be sent
out along with the CAN message. The value must be a row vector of type double with
a maximum length of 8. Each element of the vector defines 1 byte. In this case, the
first element defines the data for byte 0 and the eighth element the data for byte 7.
Each element can have a value between 0 and 255 (decimal).
Pause — Defines the amount of time in seconds the Setup block waits after this message
has been sent and before the next message defined in the struct array is parsed and sent.
3-60
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Initialization and Termination CAN Messages
Valid values are between 0 and 0.05 seconds. Some CAN nodes need some time to settle
before they can accept the next message, especially when the message just received puts
the node in a new operational mode. Use this field to specify those idle times.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
3-61
3
CAN I/O Support
CAN Data Frames
CAN data frames have a maximum size of 8 bytes (64 bits). The CAN driver blocks in the
Simulink Real-Time I/O block library use Simulink signals of data type CAN_MESSAGE
or double to propagate data frames as an entity. In most applications, the data frame
content does not consist of 64-bit floating point values; instead they are constructed from
one or more smaller data type entities such as signed and unsigned integers of various
sizes.
To simplify the construction and extraction of data frames for the user, the Simulink
Real-Time I/O library contains two utility blocks (found in subgroup CAN/Utilities) that
allow bit-packing (construction) and bit-unpacking (extraction) of data frames in a very
flexible way.
• The CAN Bit-Packing and CAN Bit-Unpacking blocks work with data frames using
double data types. They provide support for legacy models.
• To construct and extract CAN_MESSAGE data types, use the CAN Pack and CAN
Unpack blocks.
Tip
• To prepare a remote frame, use the CAN Pack block with the Remote frame check
box selected. To request the current value, send the remote frame to the responding
subsystem.
• To process a remote frame, use the CAN Unpack block with the Output remote
check box selected to enable the Remote port. When the Remote port becomes true,
send the current value to the requesting subsystem.
The main purpose of the two blocks is to be used in conjunction with CAN Send and
Receive driver blocks for double data type. You can use them for other types of double
type data manipulation. Their functionality is independent of the CAN driver blocks or
CAN library.
3-62
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Timeouts When Receiving CAN Messages
Timeouts When Receiving CAN Messages
The model in this topic supports the CAN_MESSAGE data type.
The Receive driver blocks for the supported CAN boards allow you to output the
timestamp at which the latest corresponding CAN message was received. This
information can be used to detect whether another CAN node is still active and therefore
is sending CAN messages or is not active and special action must be taken. Assume
that a CAN message is expected from another CAN node every 2 milliseconds. If a new
message is not received within 10 milliseconds, the other CAN node is considered faulty,
and the Simulink real-time application must proceed accordingly.
The CAN blockset in the Simulink Real-Time I/O block library provides a utility block
called CAN Timeout Detection. This is a graphical subsystem that uses the timestamp
information to calculate the timeout condition.
To use this block:
1
Select the Output timestamp check box of a CAN Unpack block.
2
Connect the Timestamp output port to the input port of a CAN Timeout Detection
block.
3
Connect the output port of the CAN Timeout Detection block to a sink, such as a
real-time Scope block.
4
Set the Timeout value to the required value, such as 0.01 s.
Applying these steps to the xpccanpcis results in the model shown in the figure.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
3-63
‫‪CAN I/O Support‬‬
‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ | ‪www.MatlabSite.com‬‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
‫‪3‬‬
‫‪3-64‬‬
Blocks — Alphabetical List
Blocks — Alphabetical List
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
3-65
‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ | ‪www.MatlabSite.com‬‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
4
CAN I/O Support for FIFO
• “CAN FIFO Basics” on page 4-2
• “Acceptance Filters” on page 4-43
• “CANdb DBC Format Databases” on page 4-45
• “CAN FIFO Loopback Tests” on page 4-46
• “Blocks — Alphabetical List” on page 4-49
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
4
CAN I/O Support for FIFO
CAN FIFO Basics
In this section...
“FIFO Mode” on page 4-2
“FIFO Mode Drivers for CAN Boards from Softing” on page 4-4
FIFO Mode
This topic describes the alternative First In First Out (FIFO) mode CAN drivers provided
with the Simulink Real-Time blocks. The standard CAN drivers for the CAN boards
from Softing GmbH (http://www.softing.com) program the CAN board firmware to run in
Dynamic Object Buffer (DOB) mode. This mode is best suited for real-time environments
where it is mandatory that the driver latency time is time deterministic. Running the
firmware in Dynamic Object Buffer mode is the best choice, except for the undesired side
effect of high driver latency times.
• Sending a CAN message — When sending a CAN message, the latency time is the
time interval between the time accessing the board to provide the information for the
CAN message being sent and the time the board returns the acknowledgment that the
information was received by the firmware. FIFO mode blocks send messages in the
order that they are input to the block. They do not take into account the priority of the
input.
Note: Each CAN channel has two FIFOs, DPRAM and SRAM. The Simulink RealTime FIFO block writes into the DPRAM FIFO. The Softing board transfers the
messages from the DPRAM FIFO to the SRAM FIFO, from which the messages are
transmitted onto the CAN bus. The DPRAM can buffer up to 31 messages; the SRAM
can buffer up to 127 messages. This implies that while 127 messages can be buffered
during congestion on the CAN bus, the 31 message limit of the DPRAM limits how
many messages a model can write at one time.
• Receiving a CAN message — When receiving a CAN message, the latency time is
the time interval between the time accessing the board to ask for current data (object
data) of a certain CAN identifier and the time the board returns the actual data and
other information about the CAN message.
Disadvantages of Dynamic Object Buffer mode — These latency times are mainly
defined by the reaction time of the board firmware. In the case of the Softing boards, the
4-2
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
CAN FIFO Basics
latency time is the same for sending and receiving messages, with a fixed value of about
40 υs. If your Simulink Real-Time application has to send and receive a large number
of CAN messages, the overall latency time can quickly become high and can make it
impossible to run the application at the desired base sample time.
For example, assuming that a specific Simulink Real-Time application gets data from 12
CAN identifiers and transmits data by using eight CAN messages, the total number of
CAN board read and write accesses adds up to 20. This results in a total CAN I/O latency
time of
20*40 υs = 800 υs
With such an application, base sample times below 800 υs are impossible even if the
dynamics of the corresponding Simulink model are simple and would only need 20 υs of
computation time.
Advantages of Dynamic Object Buffer mode — However, even if the CAN I/O
latency time in Dynamic Object Buffer mode is high, the benefit of this mode is that
the latency time stays constant almost independent of the traffic volume on the CAN
network. This means that the Dynamic Object Buffer mode is best suited for Simulink
Real-Time applications that deal with only a small subset of the CAN messages going
over the CAN network.
Data Types
The Simulink Real-Time CAN blocks support the following message data types. If you
have Softing ISA CAN boards, you can use only the double data type for messages. If you
have Softing PCI and PC/104 CAN boards, you can use either CAN_MESSAGE or double
data types for new messages.
• CAN_MESSAGE — Structure that contains an array of eight unsigned 8-bit integers
that contains the data. This structure also contains the ID, and the standard
and extended ID range. CAN blocks can pass data of this type without requiring
complicated bit packing and unpacking. This capability enables you to create simpler
models. Use messages of this data type for new CAN application models. Consider
updating existing CAN application models to use CAN_MESSAGE data types.
Use CAN Pack blocks to pack individual signals into a CAN message for sending. Use
CAN Unpack blocks to unpack individual signals from CAN messages,
You can construct a CAN_MESSAGE by using the CAN Pack. You can use this block
to pass raw data packed elsewhere, by packing a data pattern manually. You can
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
4-3
4
CAN I/O Support for FIFO
also use a CANDB file and select a predefined data pattern. If you have several
CAN_MESSAGE messages, use a Mux block to combine them into a vector that you
connect to a CAN FIFO send block.
• Double — Double that represents 8 bytes of message in a signal. CAN blocks
manipulate data of this type before passing it. Do not use this data type to create new
CAN application models. The maximum size of the data frame of a CAN message is 8
bytes. This size is the same as the C data type double uses on PC-compatible systems.
At the same time, the double data type is the default data type for Simulink signals.
Represent the CAN data frame within a Simulink model with a scalar Simulink
signal. You can represent the data frame even if the data frame has nothing in
common with a double floating-point value. The Simulink Real-Time CAN library
provides a Utility sublibrary that offers bit-packing and bit-unpacking blocks. Use
these blocks to pack data types other than doubles into 64 bits (8 bytes or a double)
as well as for the opposite operation. Simulink signals of data type double represent
CAN data frames.
Updating Existing Models to Use CAN_MESSAGE Data Types
If you have Softing PCI and PC/104 CAN boards, you can update existing models to use
CAN_MESSAGE data types. As a rule:
• If your existing model contains CAN Bit-Packing and CAN Bit-Unpacking blocks,
replace them with the CAN Pack and CAN Unpack blocks.
• Open and reconfigure the CAN Send and Receive blocks to use CAN_MESSAGE data
types.
• Remove FIFO Mode CAN Message and CANDBC Translator blocks. Updated models
do not require the conversions that these blocks perform.
FIFO Mode Drivers for CAN Boards from Softing
The CAN boards from Softing support another mode, called First In First Out (FIFO)
mode. In this mode the Dynamic Object Buffer mode abstraction layer in the firmware
is missing, and the firmware plays the role of a slim interface between the receive
and transmit FIFOs and the drivers in the application code. Because of this slimmer
interface, the I/O latency times are considerably smaller. Writing to the transmit
FIFO takes 4 υs per CAN message and reading one event (CAN message) from the
receive FIFO takes 17 υs. Both of these latency times are smaller than the 40 υs for
Dynamic Object Buffer mode. While writing to the transmit FIFO is efficient, this is
not the case for reading from the receive FIFO. Because the receive FIFO contains
4-4
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
CAN FIFO Basics
all of the CAN messages (identifiers) going over the CAN network, a lot of data (CAN
messages) has to be read out of the FIFO even if their data is not used in the real-time
application. Because of the FIFO structure, events (messages) have to be read until the
message is returned that is propagated to the real-time application. The driver code for
reading the receive FIFO is principally a while loop, and this can add the problem of
nondeterministic latency times.
You resolve the latency time issue in the Simulink Real-Time CAN FIFO drivers by
defining a receive FIFO read depth that is a constant number during application
execution. For example, if you assume a FIFO read depth of 5, each time the Read
Receive FIFO driver block is executed at the block sample time, the driver code reads
and returns five events (messages) from the receive FIFO. This is independent of how
many events the FIFO currently contains. There can be only two messages received in
the FIFO and the third to fifth read attempt might just return the "No new event" code.
Nevertheless, because the FIFO read latency does not exceed 17 υs regardless of the
event read out of the FIFO, the latency time becomes deterministic and is the Read FIFO
Depth multiplied by 17 υs. The driver block returns all new events and therefore all CAN
messages going over the network. If only a small subset of the CAN messages received
must be processed in the real-time application, the total latency can easily exceed the
latency encountered with the Dynamic Object Buffer mode for the same application.
There is another restriction specific to the FIFO mode concept. You should not use more
than one Read Receive FIFO block in a Simulink model, because a new event (message)
read by one block instance cannot be read again by another block instance (the event
was removed from the FIFO buffer). Therefore the entire CAN receive part has to be
concentrated in one Read Receive FIFO block in your model. For the write transmit FIFO
side, this restriction does not apply. Here you can use as many instances as you want.
The Setup block for the CAN FIFO mode controls the CAN acceptance filters of the CAN
controller. The acceptance filter defines a range of CAN messages not to be forwarded
to the receive FIFO. Filtering out unwanted CAN messages can drastically reduce the
read receive FIFO latency time because the unwanted messages do not reach the receive
FIFO. Unfortunately, the acceptance filter process uses binary evaluation, which does
not allow filtering messages below and above a certain decimal range. Therefore the
use of the acceptance filter only resolves the problem for a small subset of CAN network
applications. See “Acceptance Filters” on page 4-43 for more information on this.
Look again at the example of 12 messages to be received and eight messages to be
transmitted. If those 20 messages with their specific identifiers are the only messages
going over the CAN network (100% usage ratio), then the total latency time is
12*17 υs + 8*4 υs = 236 υs
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
4-5
4
CAN I/O Support for FIFO
This is considerably smaller than the 800 υs that results when you use Dynamic Object
Buffer mode drivers.
For the next case, assume that there are only 12 additional messages going regularly
over the network that do not need to be processed by the real-time application.
Additionally, assume that those messages cannot be filtered by the CAN controller
acceptance filter. Then the total latency time increases to
12*17 υs +20*4 υs = 284 υs
There is little impact on the final result. The FIFO mode drivers are best suited for either
CAN network monitoring applications or low-latency CAN applications where the ratio
between the number of messages to be processed and the number of total messages going
over the network is high.
FIFO mode drivers are especially suited for monitoring type applications, because FIFO
mode can return additional information such as the bus state or the reception of error
frames. Dynamic Object Buffer mode drivers do not allow querying such information.
This documentation only covers the differences between the Dynamic Object Buffer mode
drivers (standard drivers) and the FIFO mode drivers introduced here. It assumes that
you are familiar with the Dynamic Object Buffer mode drivers and have run without an
error one of the loopback tests provided with the Simulink Real-Time product.
If you use FIFO mode drivers in your model, you must replace the Dynamic Object Buffer
mode blocks (Setup, Send, Receive) with FIFO mode driver blocks. The CAN-AC2 boards
from Softing do not let you run the two CAN ports in different modes. Therefore the mode
has to be same for both ports, but you can use more than one CAN board and run the
boards in different modes just by selecting different I/O driver blocks.
As mentioned in the standard CAN topic, you should not use the CAN-AC2 (ISA) for new
projects. Instead use the CAN-AC2-PCI. Therefore, FIFO mode drivers are only provided
for the CAN-AC2-PCI and the CAN-AC2-104 boards.
CAN-AC2-PCI (FIFO) with SJA1000 Controller
The CAN-AC2-PCI driver blocks support the CAN-AC2-PCI board using FIFO mode. The
Philips SJA1000 chip is used as the CAN controller in this configuration and supports
both standard and extended identifier ranges in parallel. The driver block set for this
board is found in the Simulink Real-Time I/O block library in the group CAN/Softing.
The CAN-AC2-PCI SJA 1000 block group contains the FIFO mode CAN subgroup.
4-6
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Softing CAN-AC2-PCI with Philips SJA1000 FIFO Setup
Softing CAN-AC2-PCI with Philips SJA1000 FIFO
Setup
Softing CAN-AC2-PCI with Philips SJA1000 FIFO Setup block
Library
Simulink Real-Time Library for CAN
Description
The Setup block defines general settings of the installed CAN board(s). The CAN driver
blocks for this board support up to 16 boards for each target system, making up to 32
CAN ports available. For each board in the target system, you can use one Setup block in
a model.
Block Parameters
Board
Defines the board being accessed by this driver block instance. If multiple boards are
present in the target computer, you can use the board number (1...16) to differentiate
the boards. The physical board referenced by the board number depends on the
PCI Slot parameter. If just one board is present in the target system, select board
number 1.
CAN 1 - physical bus
Defines the physical CAN bus type of CAN port 1. In the board's standard hardware
configuration, only high-speed CAN is supported. By extending the board with
low-speed CAN piggyback modules, you can also select low-speed CAN as the
physical bus. Do not change this value to low-speed if a module is not present for the
corresponding CAN port. If the module is present (see the Softing user manual for
how to install the modules), you can select between high-speed and low-speed CAN
here.
CAN 1 - baud rate
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
4-7
4
CAN I/O Support for FIFO
Defines the most common baud rates for CAN port 1. If your model requires a special
baud rate, select the value User defined.
CAN 1 - user defined baud rate
If you select User defined from the CAN 1 Baud rate list, enter the four values for
the timing information. The vector elements have the following meanings:
[ Prescaler, Synchronization-Jump-Width, Time-Segment-1,
Time-Segment-2 ]
For more information about these values, see the Softing user manual for this board.
CAN 1 - acceptance
Defines the acceptance filters for the CAN 1 port. Because the receive FIFO is filled
with arbitrary CAN messages going over the bus, the use of the CAN controller
acceptance filters becomes important to filter out unwanted messages already at
the controller level. This acceptance filter information is provided by a row vector
with four elements in which the first two are used to define the acceptance mask and
acceptance code for standard identifiers and the latter two for extended identifiers.
The default value defined by the Setup block does not filter the messages. For
information on how to define the acceptance information to filter certain messages,
see “Acceptance Filters” on page 4-43.
CAN 2 - physical bus
Defines the physical CAN bus type of CAN port 2. In the board's standard hardware
configuration, only high-speed CAN is supported. By extending the board with lowspeed CAN piggyback modules, you can also select low-speed CAN as the physical
bus. Do not set this value should to low-speed if a module is not present for the
corresponding CAN port. If the module is present (see the Softing user manual on
how to install the modules), you can select between high-speed and low-speed CAN
here.
CAN 2- baud rate
Defines the most common baud rates for CAN port 2. If your model requires a special
baud rate, select the value User defined.
CAN 2 - user defined baud rate
If you select User defined from the CAN 2 baud rate list, enter the four values for
the timing information. The vector elements have the following meanings:
[ Prescaler, Synchronization-Jump-Width, Time-Segment-1,
Time-Segment-2 ]
4-8
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Softing CAN-AC2-PCI with Philips SJA1000 FIFO Setup
For more information about these values, see the Softing user manual for this board.
CAN 2 - acceptance
Defines the acceptance filters for the CAN 2 port. Because the receive FIFO is filled
with arbitrary CAN messages going over the bus, the use of the CAN controller
acceptance filters becomes important to filter out unwanted messages already
at the controller level. This acceptance filter information is provided by a row
vector with four elements in which the first two are used to define the acceptance
mask and acceptance code for standard identifiers and the latter two for extended
identifiers. The default value defined by the Setup block does not filter messages. For
information on how to define the acceptance information to filter certain messages,
see “Acceptance Filters” on page 4-43.
Enable error frame detection
If the CAN controller should detect error frames and forward these to the Receive
FIFO, select this box. Selecting this box makes sense for monitoring applications
where you want to be informed about all events going over the bus. For low-latency
time applications, selecting this box might increase the FIFO Read driver block
latency time because the receive FIFO gets filled with additional events.
Initialization command structure and Termination (struct)
Define the CAN messages sent during initialization and termination of the
Setup block. For more information, see the standard CAN driver documentation
in“Initialization and Termination CAN Messages”.
Termination
Define the CAN messages sent during termination of the Setup block. For more
information, see the standard CAN driver documentation in “Initialization and
Termination CAN Messages”.
Show bus-off status output
Select this check box to enable the bus-off status output port. The output signal
can be 1 (bus-off state); otherwise, it is 0. If the bus-off status persists, the block
optionally initiates recovery, depending on the setting of Bus-off recovery.
Clear this check box to disable the output port.
Bus-off recovery
Use this parameter to specify how the model is to perform bus-off recovery for the
CAN network.
From the list, select:
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
4-9
4
CAN I/O Support for FIFO
• Off
Does not perform bus-off recovery.
• Auto
Upon detection, the model waits 1 second to see if the bus-off state persists. After
1 second, bus-off recovery occurs.
• Manual Trigger Input
Enables you to input a signal when you want bus-off recovery to occur. Selecting
this option creates an input port for the Setup block.
PCI slot (-1:autosearch)
If only one board of this type is in the target computer, enter -1 to locate the board.
If two or more boards of this type are in the target computer, enter the bus number
and the PCI slot number of the board associated with this driver block. Use the
format [BusNumber,SlotNumber].
To determine the bus number and the PCI slot number, type:
tg = slrt;
getPCIInfo(tg, 'installed')
The board allows you to terminate each of the two CAN ports separately by means of DIP
switches at the rear panel. Both CAN ports must be terminated if you use the loopback
model provided to test the board and drivers. Refer to the Softing user manual on how to
set the DIP switches.
4-10
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Softing CAN-AC2-PCI with Philips SJA1000 FIFO Write
Softing CAN-AC2-PCI with Philips SJA1000 FIFO
Write
Softing CAN-AC2-PCI with Philips SJA1000 FIFO Write Driver block
Library
Simulink Real-Time Library for CAN
Description
The FIFO Write driver block writes CAN messages into the transmit FIFO. The
firmware running in FIFO mode processes the information in the transmit FIFO and
finally puts the constructed CAN messages onto the bus. This block dynamically detects
the data type and signal size of the signal you connect to the input port. If you use this
block inside an enabled subsystem, the block sends the message only when you enable
the subsystem.
If you use the CAN_MESSAGE data type:
If the block input is a CAN_MESSAGE data type, use CAN Pack blocks to pack
individual signals into a CAN message. If you use CAN Pack blocks to prepare each
message, the FIFO Write block reads the CAN_MESSAGE data. To combine several
messages into a vector of CAN_MESSAGE data that the FIFO Write block sends, use a
Mux block. Use the Port (if input is CAN_MESSAGE) parameter to select the port to
which to send the CAN_MESSAGE data.
Tip To prepare a remote frame, use the CAN Pack block with the Remote frame check
box selected. To request the current value, send the remote frame to the responding
subsystem.
If you use the double data type (legacy):
If the block input consists of double values in a matrix, the block has one input port
of type double. At this port, the required information must be provided to construct
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
4-11
4
CAN I/O Support for FIFO
valid CAN messages to be written into the transmit FIFO. For each CAN message, five
elements are passed:
Port
The value can be either 1 (port 1) or 2 (port 2) and defines the port the CAN message
is sent from.
Identifier
Identifier of the CAN message to be sent. If it is a standard CAN message the valid
range is 0 to 2047. If the CAN message is extended, the range is 0 to 229-1.
Identifier type
The value can be either 0 (standard identifier range) or 1 (extended identifier range)
and defines the identifier type of the outgoing CAN message.
Data frame size
The value can be in the range of 0 to 8 and defines the data frame size in bytes of the
outgoing CAN message.
Data
Data for the data frame itself. Use the CAN Bit-Packing block to construct the data
as double values in a matrix.
Because this information can be dynamically changed in FIFO mode during application
execution, the information is provided at the block input instead of you setting them
through block parameters. To be able to transmit more than one CAN message per block
instance, a matrix signal is used as a container.
The dimension of the matrix signal entering the block has to be n*5, where n is the
number of CAN messages to be sent by this block instance. Therefore each row of the
matrix signal defines one CAN message and each row combines the five elements of
information defined above (in this order).
For examples of constructing the matrix signal for the FIFO write block, see “CAN FIFO
Loopback Tests”.
For certain applications, you might make the writing of a CAN message into the transmit
FIFO dependent on the model dynamics. For this case, the matrix signal can also be
of dimension n*6 instead of n*5. In this case, the sixth column defines whether the
corresponding CAN message is written into the transmit FIFO (1) or not (0).
4-12
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Softing CAN-AC2-PCI with Philips SJA1000 FIFO Write
Block Parameters
Board
Define the board used to send the CAN messages defined by this block instance. For
more information about the meaning of the board number, see the Setup driver block
described above. If just one board is present in the target system, you should select 1.
Show input count port
Select this check box to track the number of inputs to the block and add a second
input port, N, to the block. If this port value exceeds the size of the input vector of
CAN_MESSAGE messages, the block limits the transfer to the size of the input
vector. If this port value is smaller than the CAN_MESSAGE input vector size,
the block transfers data up to the size of this port value. For example, assume an
input of 10*5 matrix. If you then input a 5 to input port N, the block sends only the
first five messages. In an n*6 matrix, the last entry in the row is still the individual
message enabled, but the block checks only messages up to n. If the input is a matrix
of doubles, the block ignores the value of the Port parameter. The block considers the
port as part of the data.
If this check box is cleared, the block sends all elements of the input vector.
Port (if input is CAN_MESSAGE)
If the message is a CAN_MESSAGE data type, from the list, select 1 or 2 for the
port to send the message through. The block sends a message to a single CAN port.
If you want to send messages to different ports in a model, use multiple FIFO Write
blocks. This input port is the first one on the block. Its input is a vector or single
CAN_MESSAGE message.
If the message consists of double values in a matrix, changing this parameter does
not change the block behavior. You specify the port number in the CAN message. A
single FIFO Write block can send messages through both ports.
Show status output port
Select this to enable the status output port. If the box is cleared, the block does not
have an output port. If enabled, a port is shown. The signal leaving the block is a
vector of type CAN_MESSAGE or double depending on which data type you are using
for your messages, in which the number of elements depends on the signal dimension
of the block input port. There is one element for each CAN message written into
the transmit FIFO and the value is identical to the return argument of function
CANPC_send_data, described in the Softing user manual. Refer to that manual for
more information. The function return codes are:
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
4-13
4
CAN I/O Support for FIFO
Code
Description
0
Function executed without detecting an error.
-1
Function encountered an error.
-4
Timeout firmware communication.
-99
Board not initialized.
Sample time
Defines the sample time at which the FIFO Write block is executed during a realtime application run.
You can use as many instances of the FIFO Write block in the model as required. For
example, by using two instances of the block, you can send CAN messages at different
sample times. Or you can use multiple instances to structure your model more efficiently.
4-14
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Softing CAN-AC2-PCI with Philips SJA1000 FIFO Read
Softing CAN-AC2-PCI with Philips SJA1000 FIFO
Read
Softing CAN-AC2-PCI with Philips SJA1000 FIFO Read block
Library
Simulink Real-Time Library for CAN
Description
The FIFO Read driver block reads CAN messages from the receive FIFO. The firmware
running in FIFO mode puts received events (CAN messages) into the receive FIFO from
which the FIFO Read driver reads it.
If you choose CAN_MESSAGE data type as the output, use CAN Unpack blocks to
unpack individual signals from a CAN message.
Tip To process a remote frame, use the CAN Unpack block with the Output remote
check box selected to enable the Remote port. When the Remote port becomes true, send
the current value to the requesting subsystem.
If you choose matrix as the output data type, the FIFO Read driver block has one output
port of type double. The signal of this port is a matrix of size m*6, where m is the FIFO
Read depth defined in the block dialog box (see below). For example, if the FIFO read
depth is 5, then the matrix signal of port 1 has size 5*6. Therefore, one row for each event
is read out of the receive FIFO (no new message is considered an event as well). For
examples showing how to extract data from the matrix signal, see “CAN FIFO Loopback
Tests”.
If you choose output as double values in a matrix, each row with its six elements contains
the information defining a CAN message:
Port
The value can be either 1 (port 1) or 2 (port 2) and reports the port at which the CAN
message was received.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
4-15
4
CAN I/O Support for FIFO
Identifier
Identifier of the CAN message being received. If it is a standard CAN message the
range is 0 to 2047. It is an extended CAN message, the range is 0 to 229-1.
Event type
This value defines the type of event read from the receive FIFO. The following values
are defined in the Softing user manual.
Events
Description
0
No new event.
1
Standard data frame received.
2
Standard remote frame received.
3
Transmission of a standard data frame is confirmed.
4
5
Change of bus state.
6
7
8
Transmission of a standard remote frame is confirmed.
9
Extended data frame received.
10
Transmission of an extended data frame is confirmed.
11
Transmission of an extended remote frame is confirmed.
12
Extended remote frame received.
13
14
15
Error frame detected.
Data frame size
If a data frame has been received, the length of the data in bytes is reported by this
element. Possible values are 0 to 8.
Timestamp
Time at which the event was received. The resolution of the timestamp counter is 1
υs.
4-16
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Softing CAN-AC2-PCI with Philips SJA1000 FIFO Read
Data
Data of the data frame itself returned as a CAN_MESSAGE or double value (8 bytes)
depending on which data type you are using for your messages. Use the CAN Unpack
block to extract the data from the CAN_MESSAGE data value. Use the CAN BitUnpacking block to extract the data from the double value.
Block Parameters
Board
Defines the board used to send the CAN messages defined by this block instance. For
more information about the meaning of the board number, see the Setup driver block
described above. If one board is present in the target system, select board number 1.
Output format
From the list, select:
• Matrix of doubles (legacy)
Formats messages as double values in a matrix. See “Description” on page
4-15 for details on this message format.
• Vector of CAN_MESSAGE plus count
Formats messages as vectors of CAN_MESSAGE structures.
Selecting this option enables the Port parameter. It also creates an N output port
that contains the number of valid entries in the CAN_MESSAGE data vector. The
block interprets the FIFO read depth value as the size of the vector. The block
outputs up to FIFO read depth number of messages. For example, if you enter
a read depth of 3, but the receive FIFO has only two messages, the output vector
has only two messages. The xpccanpcififo1s example illustrates the use of this
parameter.
• Function call for each CAN_MESSAGE
Formats messages as vectors of CAN_MESSAGE structures.
Selecting this option enables the Port parameter. It also creates a functioncall output (f()) output port. This port contains a function-call for a single
CAN_MESSAGE data element. The block repeats the function-call for each
message from the FIFO, up to the value of FIFO read depth. You input this
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
4-17
4
CAN I/O Support for FIFO
function-call output into a function-call subsystem. The xpccanpcififo1sf
example illustrates the use of this parameter.
Port
CAN_MESSAGE only. From the list, select 1 or 2 for the input port. The block
reads the message from that FIFO (1 or 2). Its output is a vector of CAN_MESSAGE
messages. If you want to read from both ports, use two Read blocks, one for each port.
Selecting Vector of CAN_MESSAGE plus count for Output format enables
this parameter.
Selecting Matrix of doubles (legacy) or Function call for each
CAN_MESSAGE for the Output format parameter disables this parameter. The block
ignores the port. In this case, the block reads from both ports and records the port for
each message in the output matrix.
FIFO read depth
Defines the number of receive FIFO read attempts. Each time the block is executed
it reads this fixed number of events (CAN messages), which leads to a deterministic
time behavior regardless of the number of events currently stored in the receive
FIFO. The Read depth (m) also defines the size of the matrix signal (m*6) leaving the
first output port. If an event is not currently stored in the receive FIFO, the FIFO is
read anyway, but the event type is reported as 0 (no new event).
Show status output port
Select this to enable the status output port (S). If the box is cleared (disabled), the
block has one output port for the events (D). If enabled, a second port is shown. The
signal leaving that port is a vector of doubles, with two elements:
[Number of lost messages (events), Bus state]
The first element returns the current value of the lost messages counter. The receive
FIFO can store up to 127 events. If the receive FIFO is not regularly accessed for
reading events, the FIFO is filled and the lost messages counter starts to count up.
This is an indicator that events (messages) will be unavoidably lost. The second
element returns the current bus state. Possible values are
4-18
Code
Description
0
Error active.
1
Error passive.
2
Bus off.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Softing CAN-AC2-PCI with Philips SJA1000 FIFO Read
Sample time
Defines the sample time at which the FIFO Read block is executed during a real-time
application run.
Note: Use only one instance of this block per physical CAN board in your model.
Otherwise, you might get the unwanted behavior that one instance would read events
that must be processed by blocks connected to the other, second instance.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
4-19
4
CAN I/O Support for FIFO
Softing CAN FIFO Read Filter
Softing CAN FIFO Read Filter block (architecture independent)
Library
Simulink Real-Time Library for CAN
Description
The FIFO Read Filter block is a utility block for the CAN FIFO driver block set, and is
used to filter events out of the signal leaving the FIFO Read driver block (also known as
the event matrix). It is usually connected to the first output port of the FIFO Read driver
block. Because the FIFO Read Filter block does not actually access the CAN board or
other hardware device, it is independent of the bus architecture of the board.
The block code walks through the rows of the incoming event matrix signal and looks
for events matching the criteria defined in the block dialog box. If an event matches, the
entire event information (row) is written to the block's first output port. If more than one
row matches the criteria, the later event overwrites the earlier event.
The block has one input port and two output ports, all of type double. The input port
accepts a matrix signal of size m*6. The first output port, a row vector of size 1*6,
outputs the filtered event. The second, a scalar, outputs the number of matching events
the filter block has processed.
Block Parameters
CAN port
Defines the filter criterion for the CAN port. From the list, select Any, 1, or 2.
Message type command
Defines the filter criterion for the event types. This entry consists of a concatenation
of space-delimited keywords:
4-20
Keyword
Description
SDF
Standard data frame.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Softing CAN FIFO Read Filter
Keyword
Description
SRF
Standard remote frame.
EDF
Extended data frame.
ERF
Extended remote frame.
EF
Error frame.
NE
No new event.
CBS
Change of bus state.
Message type selection mode
Defines how the event type (message type) listed in Message type command
parameter is treated. If you select Include, the event type criterion is the sum of the
concatenated keywords. If you select Exclude, the event type criterion is equal to all
event types minus the sum of the concatenated keywords.
Identifier(s)
Defines the filter criterion for the CAN message identifiers. A set of identifiers can be
provided as a row vector.
Identifier selection mode
Defines how the identifier criterion entered in the Identifier(s) parameter is
treated. If you select Include, the identifier criterion is the sum of all specified
identifiers. If you select Exclude, the identifier criterion is equal to all identifiers
minus the specified identifiers.
You can use as many instances of this block in your model as required. Usually, you
connect several instances in parallel to the output of the FIFO Read driver block to filter
out particular messages or events. For examples, see “CAN FIFO Loopback Tests”.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
4-21
4
CAN I/O Support for FIFO
Softing CAN-AC2-PCI with Philips SJA1000 FIFO
Read XMT Level
Softing CAN-AC2-PCI with Philips SJA1000 FIFO Read XMT Level block
Library
Simulink Real-Time Library for CAN
Description
The FIFO Read XMT Level driver block reads the current number of CAN messages
stored in the transmit FIFO to be processed by the firmware. The transmit FIFO can
store up to 31 messages. If it is full and a FIFO write driver block tries to add another
message to the transmit FIFO, the passed messages are lost. You can use this driver
block to check for this condition and take action. For example, you could stop the
execution or wait for a non-full transmit FIFO.
The block has a single output port of type double, returning a scalar value containing the
current transmit FIFO level (number of messages to be processed).
Block Parameters
Board
Defines the board accessed to read the current transmit FIFO level. For more
information about the meaning of the board number, see the Setup driver block
described above. If just one board is present in the target system, select board
number 1.
Sample time
Defines the sample time at which the FIFO Read XMT Level driver block is executed
during a real-time application run.
4-22
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Softing CAN-AC2-PCI with Philips SJA1000 FIFO Reset XMT
Softing CAN-AC2-PCI with Philips SJA1000 FIFO
Reset XMT
Softing CAN-AC2-PCI with Philips SJA1000 FIFO Reset XMT block
Library
Simulink Real-Time Library for CAN
Description
The FIFO Reset XMT driver block resets the transmit FIFOs. This deletes the messages
currently stored in the transmit FIFO and reset the level counter to 0. As an example,
you can use this driver block to reset the transmit FIFO after having detected a fault
condition.
The block has a single input port of type double. If a scalar value of 1 is passed, the
transmit FIFO is reset. If a scalar value of 0 is passed, nothing is done.
Block Parameters
Board
Defines the board accessed to reset the transmit FIFO. For more information about
the meaning of the board number, see the Setup driver block described above. If just
one board is present in the target system, select board number 1.
Sample time
Defines the sample time at which the FIFO Reset XMT driver block is executed
during a real-time application run.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
4-23
4
CAN I/O Support for FIFO
Softing CAN-AC2-PCI with Philips SJA1000 FIFO
Read RCV Level
Softing CAN-AC2-PCI with Philips SJA1000 FIFO Read RCV Level block
Library
Simulink Real-Time Library for CAN
Description
The FIFO Read RCV level driver block reads the current number of CAN messages
stored in the receive FIFO. The receive FIFO can store up to 127 events (messages). If
it is full and a FIFO read driver block does not attempt to read the stored events, new
incoming events are lost, as shown by increments to the lost message counter. You can
use this driver block to check for this condition and take action, such as stopping the
execution or resetting the receive FIFO.
The block has a single output port of type double, returning a scalar value containing the
current receive FIFO level (number of messages to be processed).
Block Parameters
Board
Defines the board accessed to read the current receive FIFO level. For more
information about the meaning of the board number, see the Setup driver block
described above. If just one board is present in the target system, select board
number 1.
Sample time
Defines the sample time at which the FIFO Read RCV Level driver block is executed
during a real-time application run.
4-24
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Softing CAN-AC2-PCI with Philips SJA1000 FIFO Reset RCV
Softing CAN-AC2-PCI with Philips SJA1000 FIFO
Reset RCV
Softing CAN-AC2-PCI with Philips SJA1000 FIFO Reset RCV block
Library
Simulink Real-Time Library for CAN
Description
The FIFO Reset RCV driver block resets the receive FIFO. This deletes the messages
currently stored in the receive FIFO and reset the level counter to 0. As an example, you
can use this driver block to reset the receive FIFO after having detected a fault condition.
The block has a single input port of type double. If a scalar value of 1 is passed, the
transmit FIFO is reset. If a scalar value of 0 is passed, nothing is done.
Block Parameters
Board
Defines the board accessed to reset the receive FIFO. For more information about the
meaning of the board number, see the Setup driver block described above. If just one
board is present in the target system, select board number 1.
Sample time
Defines the sample time at which the FIFO Reset RCV driver block is executed
during a real-time application run.
CAN-AC2-104 (FIFO) with SJA1000 Controller
The CAN-AC2-104 driver blocks support the CAN-AC2-104 (PC/104) board using FIFO
mode. The Philips SJA1000 chip is used as the CAN controller in this configuration and
supports both standard and extended identifier ranges in parallel. The driver block set
for this board is found in the Simulink Real-Time I/O block library in the group CAN/
Softing. The CAN-AC2-104 SJA 1000 block group contains the FIFO Mode subgroup.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
4-25
4
CAN I/O Support for FIFO
Softing CAN-AC2-104 with Philips SJA1000 FIFO
Setup
Softing CAN-AC2-104 with Philips SJA1000 FIFO Setup block
Library
Simulink Real-Time Library for CAN
Description
The FIFO Setup driver block defines general settings of the installed CAN boards. The
CAN driver blocks for this board support up to three boards for each target system,
making up to six CAN ports available. For each board in the target system, you must use
exactly one Setup driver block.
Block Parameters
Board
Defines the board accessed by this driver block instance. If multiple boards are
present in the target computer, you can use the board number (1...3) to differentiate
the boards. The physical board referenced by the board number depends on the PCI
Slot parameter.
CAN 1 - baud rate
Defines the most common baud rates for CAN port 1. If your model requires a special
baud rate, select the value User defined.
CAN 1 - user defined baud rate
If you selected User defined from the CAN 1 - baud rate list, enter four values for
the timing information. The vector elements have the following meanings:
[ Prescaler, Synchronization-Jump-Width, Time-Segment-1,
Time-Segment-2 ]
For more information about these values, see the Softing user manual for this board.
4-26
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Softing CAN-AC2-104 with Philips SJA1000 FIFO Setup
CAN 1 - acceptance
Defines the acceptance filters for CAN port 1. Because the receive FIFO is filled
with arbitrary CAN messages going over the bus, the use of the CAN controller
acceptance filters becomes important to filter out unwanted messages already
at the controller level. This acceptance filter information is provided by a row
vector with four elements in which the first two are used to define the acceptance
mask and acceptance code for standard identifiers and the latter two for extended
identifiers. The default value defined by the Setup block does not filter messages. For
information on how to define the acceptance information to filter certain messages,
see “Acceptance Filters” on page 4-43.
CAN 2 - baud rate
Defines the most common baud rates for CAN port 2. If your model requires a special
baud rate, select the value User defined.
CAN 2- user defined baud rate
If you selected User defined from the CAN 1 - baud rate list, enter four values for
the timing information. The vector elements have the following meanings:
[ Prescaler, Synchronization-Jump-Width, Time-Segment-1,
Time-Segment-2 ]
For more information about these values, see the Softing user manual for this board.
CAN 2 acceptance
Defines the acceptance filters for CAN port 2. Because the receive FIFO is filled
with arbitrary CAN messages going over the bus, the use of the CAN controller
acceptance filters becomes important to filter out unwanted messages already
at the controller level. This acceptance filter information is provided by a row
vector with four elements in which the first two are used to define the acceptance
mask and acceptance code for standard identifiers and the latter two for extended
identifiers. The default value defined by the Setup block does not filter messages. For
information on how to define the acceptance information to filter certain messages,
see “Acceptance Filters” on page 4-43.
Enable error frame detection
Defines whether the CAN controller should detect error frames and forward these to
the receive FIFO. Selecting this box makes sense for monitoring applications where
you want to be informed about all events going over the bus. For low-latency time
applications, selecting this box might increase the FIFO Read driver block latency,
because the receive FIFO is filled with additional events.
Initialization command structure and Termination
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
4-27
4
CAN I/O Support for FIFO
Defines CAN messages sent during initialization and termination of the Setup block.
For more information, see the standard CAN driver documentation in “Initialization
and Termination CAN Messages”.
Termination
Defines CAN messages sent during termination of the Setup block. For more
information, see the standard CAN driver documentation in “Initialization and
Termination CAN Messages”.
Show bus-off status output
Select this check box to enable the bus-off status output port. The output signal
can be 1 (bus-off state); otherwise, it is 0. If the bus-off status persists, the block
optionally initiates recovery, depending on the setting of Bus-off recovery.
Clear this check box to disable the output port.
Bus-off recovery
Use this parameter to specify how the model is to perform bus-off recovery for the
CAN network.
From the list, select:
• Off
Does not perform bus-off recovery.
• Auto
Upon detection, the model waits 1 second to see if the bus-off state persists. After
1 second, bus-off recovery occurs.
• Manual Trigger Input
Enables you to input a signal when you want bus-off recovery to occur. Selecting
this option creates an input port for the Setup block.
I/O base address
Defines the I/O base address of the board to be accessed by this block instance. The I/
O base address is given by the DIP switch setting on the board itself. The I/O address
range is 4 bytes of I/O address space. It is mainly used to identify the memory base
address the board should use. See the Softing user manual for this board on how
you can set the I/O base address. The I/O base address entered in this control must
correspond with the DIP switch setting on the board. If more than one board is
4-28
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Softing CAN-AC2-104 with Philips SJA1000 FIFO Setup
present in the target system, you must enter a different I/O base address for each
board. In this case, the I/O base address itself defines which board is referenced by
which board number.
Memory base address
Defines the memory base address of the board to be accessed by this block instance.
The memory base address is a software setting only (the board does not have a
corresponding DIP switch). The memory address range is 4 KB. If more than one
board is present in the target system, you must enter a different memory base
address for each board and verify that the defined address ranges do not overlap.
Because the Simulink Real-Time kernel only reserves a subset of the address range
between 640 KB and 1 MB for memory-mapped devices, the address ranges must be
within the following range:
C8000 - D8000
The board allows you to terminate each of the two CAN ports separately by means
of DIP switches at the back panel of the board. Both CAN ports must be terminated
before you can use the loopback model provided to test the board and drivers. Refer to
the Softing user manual on how to set the DIP switches.
Interrupt line
Select an interrupt line from the list.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
4-29
4
CAN I/O Support for FIFO
Softing CAN-AC2-104 with Philips SJA1000 FIFO
Write
Softing CAN-AC2-104 with Philips SJA1000 FIFO Write block
Library
Simulink Real-Time Library for CAN
Description
The FIFO Write driver block writes CAN messages into the transmit FIFO. The
firmware running in FIFO mode then processes the information in the transmit FIFO
and finally puts the constructed CAN messages onto the bus. This block dynamically
detects the data type and signal size of the signal that you connect to the input port.
If you use the CAN_MESSAGE data type:
If the block input is a CAN_MESSAGE data type, use CAN Pack blocks to pack
individual signals into a CAN message. If you use CAN Pack blocks to prepare each
message, the FIFO Write block reads the CAN_MESSAGE data. To combine several
messages into a vector of CAN_MESSAGE data that the FIFO Write block sends, use a
Mux block. Use the Port (if input is CAN_MESSAGE) parameter to select the port to
which to send the CAN_MESSAGE data.
Tip To prepare a remote frame, use the CAN Pack block with the Remote frame check
box selected. To request the current value, send the remote frame to the responding
subsystem.
If you use the double data type (legacy):
If the block input consists of double values in a matrix, the block has one input port of
type double. At this port, you must provide the elements required to construct valid CAN
messages to be written into the transmit FIFO. For each CAN message, five elements
have to be passed:
4-30
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Softing CAN-AC2-104 with Philips SJA1000 FIFO Write
Port
The value can be either 1 (port 1) or 2 (port 2) and defines at which port the CAN
message is sent from.
Identifier
Identifier of the CAN message to be sent. If it is a standard CAN message, the valid
range is 0 to 2047. If extended, the range is 0 to 229-1.
Identifier type
The value can be either 0 (standard identifier range) or 1 (extended identifier range)
and defines the identifier type of the outgoing CAN message.
Data frame size
The value can be in the range of 0 to 8 and defines the data frame size in bytes of the
outgoing CAN message
Data
Data for the data frame itself. Use the CAN Bit-Packing block to construct the data
as double values in a matrix.
Because this information can be dynamically changed in FIFO mode during application
execution, the information is provided at the block input instead of using the block
parameters. To transmit more than one CAN message per block instance, use a matrix
signal as a container.
The dimension of the matrix signal entering the block must be n*5, where n is the
number of CAN messages to be sent by this block instance. Therefore, each row of the
matrix signal defines one CAN message and each row combines the five elements of
information defined above (in this order).
For examples of constructing the matrix signal for the FIFO write block, see “CAN FIFO
Loopback Tests”.
For certain applications, you might make the writing of a CAN message into the
transmit FIFO dependent on the model dynamics. For this, the matrix signal can also
be of dimension n*6 instead of n*5. In this case, the sixth column defines whether the
corresponding CAN message is written into the transmit FIFO (value 1) or not (value 0).
Block Parameters
Board
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
4-31
4
CAN I/O Support for FIFO
Defines the board used to send the CAN messages defined by this block instance.
For more information about the meaning of the board number, see the Setup driver
block described above. If just one board is present in the target system, select board
number 1.
Show input count port
Select this check box to track the number of inputs to the block and add a second
input port, N, to the block. If this port value exceeds the size of the input vector of
CAN_MESSAGE messages, the block limits the transfer to the size of the input
vector. If this port value is smaller than the CAN_MESSAGE input vector size,
the block transfers data up to the size of this port value. For example, assume an
input of 10*5 matrix. If you then input a 5 to input port N, the block sends only the
first five messages. In an n*6 matrix, the last entry in the row is still the individual
message enabled, but the block checks only messages up to n. If the input is a matrix
of doubles, the block ignores the value of the Port parameter. The block considers the
port as part of the data.
If this check box is cleared, the block sends all elements of the input vector.
Port (if input is CAN_MESSAGE)
If the message is a CAN_MESSAGE data type, from the list, select 1 or 2 for the
port to send the message through. The block sends a message to a single CAN port.
If you want to send messages to different ports in a model, use multiple FIFO Write
blocks. This input port is the first one on the block. Its input is a vector or single
CAN_MESSAGE message.
If the message consists of double values in a matrix, changing this parameter does
not change block behavior. You specify the port number in the CAN message. A
single FIFO Write block can send messages through both ports.
Show status output port
Selecting this check box lets you enable the status output port. If the box is cleared
(disabled), the block does not have an output port. If enabled, a port is shown. The
signal leaving the block is a vector of type CAN_MESSAGE or double depending on
which data type you are using for your messages. The number of elements depends
on the signal dimension of the block input port. There is one element for each CAN
message written into the transmit FIFO and the value is identical to the return
argument of function CANPC_send_data, described in the Softing user manual.
Refer to that manual for more information. The function return codes are:
4-32
Code
Description
0
Function executed without detecting an error.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Softing CAN-AC2-104 with Philips SJA1000 FIFO Write
Code
Description
-1
Function encountered an error.
-4
Timeout firmware communication.
-99
Board not initialized.
Sample time
Defines the sample time at which the FIFO Write block is executed during a realtime application run.
You can use as many instances of the FIFO Write block in the model as required. For
example, by using two instances of the block with different sample times, you can send
CAN messages out at different rates. Or you can use multiple instances to structure your
model more efficiently.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
4-33
4
CAN I/O Support for FIFO
Softing CAN-AC2-104 with Philips SJA1000 FIFO
Read
Softing CAN-AC2-104 with Philips SJA1000 FIFO Read block
Library
Simulink Real-Time Library for CAN
Description
The FIFO Read driver block reads CAN messages from the receive FIFO. The firmware
running in FIFO mode puts received events (CAN messages) into the receive FIFO. From
here, the FIFO Read driver reads the events out. The receive FIFO can store up to 127
events (messages). If it is full and a FIFO Read driver block does not attempt to read the
stored events, new incoming events are lost. This is reflected by increments to the lost
message counter. You can use the FIFO Read RCV Level driver block to check for this
condition and take action (for example, by stopping the execution or resetting the receive
FIFO).
If you choose CAN_MESSAGE data type as the output, use CAN Unpack blocks to
unpack individual signals from a CAN message.
Tip To process a remote frame, use the CAN Unpack block with the Output remote
check box selected to enable the Remote port. When the Remote port becomes true, send
the current value to the requesting subsystem.
If you choose matrix as the output data type, the FIFO Read driver block has one output
port of type double. The signal of this port is a matrix of size m*6, where m is the FIFO
read depth defined in the block's dialog box (see below). For example, if the FIFO read
depth is 5, the matrix signal of port 1 has size 5*6. Therefore, there is one row for each
event read from the receive FIFO (no new message is considered as an event as well). For
examples of extracting data from the matrix signal, see “CAN FIFO Loopback Tests”.
If you choose output as double values in a matrix, each row with its six elements contains
the information defining a CAN message:
4-34
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Softing CAN-AC2-104 with Philips SJA1000 FIFO Read
Port
The value is either 1 (port 1) or 2 (port 2) and reports the port at which the CAN
message was received.
Identifier
Identifier of the CAN message being received. If it is a standard CAN message, the
range is 0 to 2047. If the CAN message is extended, the range is 0 to 229-1.
Event type
Defines the type of event read from the receive FIFO. The following values are
defined from the Softing user manual:
Events
Description
16
No new event.
17
Standard data frame received.
18
Standard remote frame received.
19
Transmission of a standard data frame is confirmed.
20
21
Change of bus state.
22
23
24
Transmission of a standard remote frame is confirmed.
25
Extended data frame received.
26
Transmission of an extended data frame is confirmed.
27
Transmission of an extended remote frame is confirmed.
28
Extended remote frame received.
29
30
31
Error frame detected.
Data frame size
If a data frame has been received, the length of the data in bytes is reported by this
element. Possible values are 0 to 8.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
4-35
4
CAN I/O Support for FIFO
Timestamp
Reports the time at which the event was received. The resolution of the timestamp
counter is 1μs.
Data
Data of the data frame itself. It is returned as a CAN_MESSAGE or double value (8
bytes) depending on which data type you are using for your messages. Use the CAN
Pack to extract data from the CAN_MESSAGE data. Use the CAN Bit-Unpacking
block to extract the data from the double value.
Block Parameters
Board
Defines the board to use to send the CAN messages defined by this block instance.
For more information about the meaning of the board number, see the Setup driver
block described above. If just one board is present in the target system, select board
number 1.
Output format
From the list, select:
• Matrix of doubles (legacy)
Formats messages as double values in a matrix. See “Description” on page 4-15 for
details on this message format.
• Vector of CAN_MESSAGE plus count
Formats messages as vectors of CAN_MESSAGE structures.
Selecting this option enables the Port parameter. It also creates an N output port
that contains the number of valid entries in the CAN_MESSAGE data vector. The
block interprets the FIFO read depth value as the size of the vector. The block
outputs up to FIFO read depth number of messages. For example, if you enter
a read depth of 3, but the receive FIFO has only two messages, the output vector
has only two messages. The xpccanpcififo1s example illustrates the use of this
parameter.
• Function call for each CAN_MESSAGE
Formats messages as vectors of CAN_MESSAGE structures.
4-36
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Softing CAN-AC2-104 with Philips SJA1000 FIFO Read
Selecting this option enables the Port parameter. It also creates a functioncall output (f()) output port. This port contains a function-call for a single
CAN_MESSAGE data element. The block repeats the function-call for each
message from the FIFO, up to the value of FIFO read depth. You input this
function-call output into a function-call subsystem. The xpccanpcififo1sf
example illustrates the use of this parameter.
Port
CAN_MESSAGE only. From the list, select 1 or 2 for the input port. The block
reads the message from that FIFO (1 or 2). Its output is a vector of CAN_MESSAGE
messages. If you want to read from both ports, use two Read blocks, one for each port.
Selecting Vector of CAN_MESSAGE plus count for Output format enables
this parameter.
Selecting Matrix of doubles (legacy) or Function call for each
CAN_MESSAGE for the Output format parameter disables this parameter. The block
ignores the port. In this case, the block reads from both ports and records the port for
each message in the output matrix.
FIFO read depth
Defines the number of receive FIFO read attempts. Each time the block is executed,
it reads this fixed number of events (CAN messages), which leads to a deterministic
time behavior independent of the number of events currently stored in the receive
FIFO. The read depth (m) also defines the size of the matrix signal (m*6) leaving the
first output port. If an event is not currently stored in the receive FIFO, the FIFO is
read anyway, but the event type is reported as 0 (no new event).
Show status output port
Lets you enable the status output port (S). If the box is cleared (disabled), the block
has one output port for events. If enabled, a second port is shown. The signal leaving
that port is a vector of doubles, with two elements:
[Number of lost messages (events), Bus state]
The first element returns the current value of the lost messages counter. The receive
FIFO can store up to 127 events. If the receive FIFO is not regularly accessed for
reading events, the FIFO is filled and the lost messages counter starts to increment.
This is an indicator that events (messages) will be unavoidably lost. The second
element returns the current bus state. Possible values are
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
4-37
4
CAN I/O Support for FIFO
Code
Description
3
Error active
4
Error passive
5
Bus off
Sample time
Defines the sample time at which the FIFO Read block is executed during a real-time
application run.
Only use one instance of this block per physical CAN board in your model. Otherwise you
may get unwanted behavior when one instance reads events while the events are being
processed by blocks connected to the other, second instance.
4-38
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Softing CAN-AC2-104 with Philips SJA1000 FIFO Read XMT Level
Softing CAN-AC2-104 with Philips SJA1000 FIFO
Read XMT Level
Softing CAN-AC2-104 with Philips SJA1000 FIFO Read XMT Level block
Library
Simulink Real-Time Library for CAN
Description
The FIFO Read XMT Level driver block reads the current number of CAN messages
stored in the transmit FIFO to be processed by the firmware. The transmit FIFO can
store up to 31 messages. If it is full and a FIFO write driver block tries to add another
message to the transmit FIFO, the passed messages are lost. You can use this driver
block to check for this condition and take action. For example, you can stop the execution
or wait for the transmit FIFO to empty.
The block has a single output port of type double, returning a scalar value containing the
current transmit FIFO level (number of messages to be processed).
Block Parameters
Board
Defines the board to access to read the current transmit FIFO level. For more
information about the meaning of the board number, see the Setup driver block
described above. If just one board is present in the target system, select board
number 1.
Sample time
Defines the sample time at which the FIFO Read XMT Level driver block is executed
during a real-time application run.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
4-39
4
CAN I/O Support for FIFO
Softing CAN-AC2-104 with Philips SJA1000 FIFO
Reset XMT
Softing CAN-AC2-104 with Philips SJA1000 FIFO Reset XMT block
Library
Simulink Real-Time Library for CAN
Description
The FIFO Reset XMT driver block resets the transmit FIFO. This deletes the messages
currently stored in the transmit FIFO and resets the level counter to 0. For example, you
can use this driver block to reset the transmit FIFO after detecting a fault condition.
The block has a single input port of type double. If a scalar value of 1 is passed, the
transmit FIFO is reset; if 0 is passed, nothing is done.
Block Parameters
Board
Defines the board to access to reset the transmit FIFO. For more information about
the meaning of the board number, see the Setup driver block described above. If just
one board is present in the target system, select board number 1.
Sample time
Defines the sample time at which the FIFO Reset XMT driver block is executed
during a real-time application run.
4-40
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Softing CAN-AC2-104 with Philips SJA1000 FIFO Read RCV Level
Softing CAN-AC2-104 with Philips SJA1000 FIFO
Read RCV Level
Softing CAN-AC2-104 with Philips SJA1000 FIFO Read RCV Level block
Library
Simulink Real-Time Library for CAN
Description
The FIFO Read RCV Level driver block reads the current number of CAN messages
stored in the receive FIFO. The receive FIFO can store up to 127 events (messages). If
it is full and a FIFO Read driver block does not attempt to read the stored events, new
incoming events are lost. This is reflected by increments to the lost message counter. You
can use this driver block to check for this condition and take action (for example, like
stopping the execution or resetting the receive FIFO).
The block has a single output port of type double, returning a scalar value containing the
current receive FIFO level (number of messages to be processed).
Block Parameters
Board
Defines the board to access to read the current receive FIFO level. For more
information about the meaning of the board number, see the Setup driver block
described above. If just one board is present in the target system, select board
number 1.
Sample time
Defines the sample time at which the FIFO Read RCV Level driver block is executed
during a real-time application run.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
4-41
4
CAN I/O Support for FIFO
Softing CAN-AC2-104 with Philips SJA1000 FIFO
Reset RCV
Softing CAN-AC2-104 with Philips SJA1000 FIFO Reset RCV block
Library
Simulink Real-Time Library for CAN
Description
The FIFO Reset RCV driver block resets the receive FIFO. This deletes the messages
currently stored in the receive FIFO and resets the level counter to 0. For example, you
can use this driver block to reset the receive FIFO after detecting a fault condition.
The block has a single input port of type double. If a scalar value of 1 is passed, the
transmit FIFO is reset; if 0 is passed nothing is done.
Block Parameters
Board
Defines the board to access to reset the receive FIFO. For more information about the
meaning of the board number, see the Setup driver block described above. If just one
board is present in the target system, select board number 1.
Sample time
Defines the sample time at which the FIFO Reset RCV driver block is executed
during a real-time application run.
4-42
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Acceptance Filters
Acceptance Filters
You can use the CAN controller acceptance filters to select received messages by
identifier for writing into the receive FIFO. Therefore, fewer read attempts are required
to get the messages of importance to the real-time application.
The behavior of the acceptance filter is described for standard and extended identifier
ranges individually (one for standard identifiers and one for extended identifiers). Each
acceptance filter is defined by a mask parameter and a code parameter.
The mask parameter defines, for each bit of the identifier, whether the filtering process
cares about this bit or not. A 0 means “don't care” and a 1 means “do care.”
The code parameter then defines, for each bit of the identifier, that the filtering process
cares about (defined by the mask parameter), what the bit value has to be (0 or 1).
For standard identifiers the mask parameter and code parameter must both be in the
range 0 to 2047. For extended identifiers the mask parameter and code parameter must
29
both be in the range 0 to 2 - 1.
The filtering process evaluates the following binary expression:
and( xor( mask, identifier ), code )
If all bits of the resulting value are 0, the message with this identifier is accepted. If a bit
is 1, the message is voided.
According to this description, acceptance filters work using binary evaluation, while most
applications differentiate messages (identifiers) in a decimal or hexadecimal manner.
As a consequence, it is possible to filter messages, whose identifiers are above a certain
decimal number. The opposite (identifiers below a certain decimal number) cannot be
achieved in a general way.
The default values for the mask parameter and the code parameter in the FIFO setup
driver block are both 0. Because the filtering expression evaluates to 0, all incoming
messages reach the receive FIFO (no filtering takes place). The parameter values are
defined using decimal numbers. You can use the MATLAB function hex2dec to define
hexadecimal numbers in the dialog box entry.
For example, assume a CAN application where messages with the following identifiers
(standard) are crossing the CAN network:
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
4-43
4
CAN I/O Support for FIFO
2-30, 48-122 (decimal)
Additionally, only incoming messages 4-29 must be processed by the real-time
application. Ideally, all messages not having identifiers 4-29 would be filtered out,
but the mask and code parameters do not allow this exact scheme. The closest you can
achieve is filtering out the messages with identifiers above 31 by using value 2047-31
= 2016 for the mask parameter and value 0 for the code parameter. The messages with
identifiers 0, 1, 2, and 3 cannot be filtered out and are returned by the FIFO read driver
block, even if they do not need to be processed by the real-time application.
4-44
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
CANdb DBC Format Databases
CANdb DBC Format Databases
You can use CANdb DBC files to specify the packing and unpacking of CANdb messages
in a real-time application. To access a CANdb DBC format file,
1
Drag a CAN Pack block into your model,
2
Configure the Data is input as parameter to CANdb specified signals
3
Configure the CANdb file parameter to reference your CANdb DBC format file
You use the CAN Unpack to unpack the signals from a CAN message.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
4-45
4
CAN I/O Support for FIFO
CAN FIFO Loopback Tests
The Simulink Real-Time product contains the following examples that illustrate the use
of the Softing CAN FIFO blocks. Some models use CAN_MESSAGE data types, some use
double data types. Models that use double data types are considered legacy examples.
Each example requires a loopback cable connected between the two ports on the board.
The examples send messages on port 1 and receive messages on port 2.
These models have the following naming conventions:
• Model names appended with s — Output is a vector of CAN_MESSAGE data with
length equal to the value of the FIFO read depth parameter. This length is also the
maximum number of messages that the block returns. The second output port returns
the number of messages that are present in the output.
• Model names appended with sf — Output contains one CAN_MESSAGE message
at a time. The block calls the function-call output between 0 and FIFO read depth
number of times, depending on how many messages are in the FIFO.
CAN-AC2-PCI Example
CAN-AC2-104 Example
Shows CAN I/O Communication Using
FIFO Mode of the...
CAN I/O FIFO Mode
CAN I/O FIFO Mode - Simple Softing CAN-AC2-PCI and CAN- Simple Use Case —
Use Case — CAN_MESSAGE AC2-104 boards and illustrates basic
CAN_MESSAGE data type data type
functionality of the boards.
CAN I/O FIFO Mode —
CAN I/O FIFO Mode - Simple
Simple Use Case — Double Use Case — Double data type
data type
CAN I/O FIFO Mode Simple Use Case (with
CAN_MESSAGE and
Function Call Output) —
CAN_MESSAGE data type
CAN I/O FIFO Mode Simple Use Case (with
CAN_MESSAGE and
Function-Call Output) —
CAN_MESSAGE data type
Softing CAN-AC2-PCI board and
illustrates CAN I/O communication
using the First In First Out (FIFO)
mode. The FIFO Read block uses a
function-call output format.
CAN I/O FIFO Mode - The
"No New Event" Message
— Double data type
CAN I/O FIFO Mode - The
"No New Event" Message —
Double data type
Softing CAN-AC2-PCI and CANAC2-104 boards and illustrates the
condition and detection of the No new
event message.
CAN I/O FIFO Mode
- Dynamic Message
CAN I/O FIFO Mode Softing CAN-AC2-PCI and CANDynamic Message Generation AC2-104 boards and illustrates how
— CAN_MESSAGE data type
4-46
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
CAN FIFO Loopback Tests
CAN-AC2-PCI Example
CAN-AC2-104 Example
Shows CAN I/O Communication Using
FIFO Mode of the...
Generation —
CAN I/O FIFO Mode CAN messages can be dynamically
CAN_MESSAGE data type Dynamic Message Generation constructed at run-time.
— Double data type
CAN I/O FIFO Mode
- Dynamic Message
Generation — Double data
type
CAN I/O FIFO Mode CAN I/O FIFO Mode Stopping on FIFO Overflow Stopping on FIFO Overflow
— CAN_MESSAGE data
— CAN_MESSAGE data type
type
CAN I/O FIFO Mode CAN I/O FIFO Mode Stopping on FIFO Overflow
Stopping on FIFO Overflow — Double data type
— Double data type
Softing CAN-AC2-PCI and CANAC2-104 boards. For the case where
data is being received faster than it
is being processed, these examples
illustrate how to stop execution of the
model after detecting a receive FIFO
overflow.
CAN I/O FIFO Mode
- Resetting before
FIFO Overflow —
CAN_MESSAGE data type
CAN I/O FIFO Mode Resetting before FIFO
Overflow — CAN_MESSAGE
data type
CAN I/O FIFO Mode Resetting before FIFO
Overflow — Double data
type
CAN I/O FIFO Mode Resetting before FIFO
Overflow — Double data type
Softing CAN-AC2-PCI and CANAC2-104 boards. For the case where
data is being received faster than it
is being processed, these examples
illustrate how to reset the receive
FIFO before it overflows.
CAN I/O FIFO Mode CAN I/O FIFO Mode Acceptance Filters —
Acceptance Filters —
CAN_MESSAGE data type CAN_MESSAGE data type
CAN I/O FIFO Mode Acceptance Filters —
Double data type
CAN I/O FIFO Mode Acceptance Filters — Double
data type
Softing CAN-AC2-PCI and CANAC2-104 boards and illustrates how
to use acceptance filters. The objective
is to filter CAN messages with an
identifier larger than 127.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
4-47
4
CAN I/O Support for FIFO
CAN-AC2-PCI Example
CAN-AC2-104 Example
Shows CAN I/O Communication Using
FIFO Mode of the...
CAN I/O FIFO Mode Loading Messages from
CANdb DBC Files —
CAN_MESSAGE data type
CAN I/O FIFO Mode Loading Messages from
CANdb DBC Files —
CAN_MESSAGE data type
Softing CAN-AC2-PCI and CANAC2-104 boards. The example loads
message and signal definitions from
a CANdb DBC database file. This
example assumes that the CANdb
file, demoData.dbc, resides in the
xpcdemos folder.
4-48
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Blocks — Alphabetical List
Blocks — Alphabetical List
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
4-49
‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ | ‪www.MatlabSite.com‬‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
5
Model-Based Ethernet
Communications Support
• “Model-Based Ethernet Communications” on page 5-2
• “Using Simulink Real-Time for Ethernet Communications” on page 5-5
• “Blocks — Alphabetical List” on page 5-6
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
5
Model-Based Ethernet Communications Support
Model-Based Ethernet Communications
In this section...
“What Is Model-Based Ethernet Communications?” on page 5-2
“PCI Bus and Slot Numbers” on page 5-2
“MAC Addresses” on page 5-3
“Network Buffer Pointers” on page 5-4
“Filter Type and Filter Address Blocks” on page 5-4
“Execution Priority” on page 5-4
“Simulink Real-Time Ethernet Block Library” on page 5-4
What Is Model-Based Ethernet Communications?
The Simulink Real-Time software supports communication from the target computer to
other systems or devices using raw Ethernet (Ethernet packets). Raw Ethernet is a direct
method to send and receive packets with the real-time application using the Ethernet
protocol. To transfer data using Ethernet packets, you must manually create Ethernet
frames. This topic assumes that you are knowledgeable about the Ethernet standard
802.3 standard.
Before you start, provide a dedicated Ethernet card on your target computer. A dedicated
Ethernet card is to be used only for model-based Ethernet communications and not
for communication between the development and target computers. This requirement
means that your target computer must have at least two Ethernet cards, one for the
link between the development and target computers, and one for model-based Ethernet
communication. The Simulink Real-Time model-based Ethernet communication blocks
support selected members of the following Intel (Vendor ID 0x8086) chip families:
• Intel 8255X
• Intel Gigabit
PCI Bus and Slot Numbers
To use the model-based Ethernet blocks, specify the PCI bus and slot number of the
dedicated Ethernet card in the Real-Time Ethernet Configuration block. To identify
which Ethernet card is available:
5-2
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Model-Based Ethernet Communications
1
Boot the target computer with which you want to perform model-based Ethernet
communications.
2
Examine the startup screen on the target computer. Note the PCI bus and slot
information on the bottom right of the status window. This represents the Ethernet
card installed on the target computer for dedicated communication between the
development and target computers.
3
In the MATLAB Command Window, type
tg = slrt;
getPCIInfo(tg, 'ethernet')
This command determines which Ethernet cards are installed in the target
computer.
4
In the list, find the Ethernet card with a bus and slot different from that displayed
on the target computer monitor.
5
Note the PCI bus and slot of the free Ethernet card. This is the card you can use for
model-based Ethernet communications.
MAC Addresses
A number of the Ethernet blocks require you to enter MAC addresses. The MAC address
must be vector-based. To obtain the vector-based version of a MAC address, use the
macaddr command. This command converts a string-based MAC address to a vectorbased one. For example:
macaddr('01:23:45:67:89:ab')
[1 35 69 103 137 171]
When an Ethernet block requires a MAC address, you can enter either of the following in
the address field:
• Command macaddr('MAC address string'), for example:
macaddr('01:23:45:67:89:ab')
• Vector-based output from the macaddr command, for example:
[1 35 69 103 137 171]
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
5-3
5
Model-Based Ethernet Communications Support
Network Buffer Pointers
The Simulink Real-Time Ethernet block library uses pointers to refer to network buffers.
Blocks can pass pointers to these buffers as single uint32pointers. They can also refer to
a chain of network buffer packets.
Filter Type and Filter Address Blocks
The Filter Type and Filter Address blocks accept a chain of network buffers as input.
Based on the criteria specified in the masks of these blocks, the drivers parse each buffer
on the chain and either pass the packets through the port or drop the packets. When
using these blocks, create your models with filter blocks to pass data only from expected
sources.
Execution Priority
The raw Ethernet blocks have the following execution priority, from first to last:
1
Real-Time Ethernet Configuration
2
The remaining raw Ethernet and network buffer library blocks
Simulink Real-Time Ethernet Block Library
To access the Simulink Real-Time Ethernet library blocks, in the Simulink RealTime block library, double-click Ethernet. The Simulink Real-Time Ethernet library is
displayed.
The Simulink Real-Time Ethernet library contains commonly used Ethernet blocks at
the top level of the library. Use these blocks to create your models.
The Ethernet library also has a sublibrary, Network Buffers, which contains blocks
specific to the management of Ethernet network buffers. The blocks in this sublibrary are
core blocks that you might want to use to create other subsystems. However, the top-level
Ethernet blocks provide enough functionality for model-based Ethernet communications.
5-4
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Using Simulink Real-Time for Ethernet Communications
Using Simulink Real-Time for Ethernet Communications
The Simulink Real-Time examples folder contains the following examples that illustrate
the use of model-based Ethernet communications.
Example
Description
Real-Time Transmit and Receive over
Ethernet
Shows how to perform real-time
communications over the Ethernet protocol.
Filtering on MAC Address
Shows how to filter Ethernet packets based on
MAC addresses.
Filtering on EtherType
Shows how to filter Ethernet packets based on
EtherTypes.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
5-5
5
Model-Based Ethernet Communications Support
Blocks — Alphabetical List
Real-Time Ethernet Configuration
Create Ethernet Packet
Ethernet Init
Ethernet Rx
Ethernet Tx
Extract Ethernet Packet
Filter Address
Filter Type
Header Extract
5-6
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Real-Time Ethernet Configuration
Real-Time Ethernet Configuration
Configure network interface for real-time raw Ethernet communication
Library
Simulink Real-Time Library for Ethernet
Description
Use the Real-Time Ethernet Configuration block to initialize the network and network
buffers.
Block Parameters
This block has three tabs, Device, Addressing, and Advanced.
Device
Device ID
From the list, select a unique integer to identify the Ethernet board. Use this ID to
associate the other Ethernet blocks with this board.
Driver
Identifies the driver for each chip family supported. Possible values are Intel
8255X and Intel Gigabit.
PCI Bus
Enter the PCI bus number for the Ethernet card.
PCI Slot
Enter the PCI slot number for the Ethernet card.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
5-7
5
Model-Based Ethernet Communications Support
Addressing
Address source
From the list, select:
• EEPROM
Allow the block to get the Ethernet card MAC address that is built into the
Ethernet card.
• Specify
Enable the MAC parameter so that you can manually enter a MAC address for
the Ethernet card.
MAC
Enter the MAC address for the Ethernet card.
Enable this parameter by selecting Specify for the Address source parameter.
Rx promiscuous
Select this check box to direct the model to receive all packets regardless of their
destination address.
Multicast address list
Enter a list of multicast address vectors as a cell array. By default, this parameter
contains an empty cell array. The Ethernet Rx block uses these addresses in addition
to the broadcast address and unicast address.
Advanced
You do not normally need to modify the values of the parameters in this tab. Changing
the values of these parameters can change the behavior of your system.
Rx bad frames
Select this check box to direct the model to receive all packets, including erroneous
ones (such as CRC error, alignment error, and so forth).
Rx short frames
Select this check box to direct the model to receive all packets, including frames that
are less than 64 bytes in length.
5-8
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Real-Time Ethernet Configuration
Note: The Intel Gigabit Ethernet controller does not distinguish between bad packets
and short packets. Therefore, checking either Rx Bad Frames or Rx Short Frames
has the same results for Driver type Intel Gigabit.
Max MTU
Specify a maximum transmission unit number (MTU). This parameter allows you to
specify a smaller maximum transmission unit number. The default is 1518.
Tx threshold
Enter a value to control when the Ethernet device will begin to perform direct
memory access (DMA) on packets from memory. The default is 224.
Note:
• This parameter only applies for Driver type Intel 8255X.
• Before you change this parameter, see Intel 8255x 10/100 Mbps Ethernet
Controller Family — Open Source Software Developer Manual.
Tx buffers
Enter the maximum number of buffers to hold in the queue before the driver is to
drop new transmit requests. The default is 128.
Rx buffers
Enter the maximum number of buffers to hold in the queue before the driver is to
drop new receive packets. The default is 64.
Note: For both Tx Buffers and Rx Buffers, the number of buffers must be a
multiple of 8.
Display tuning information
Select this check box to enable a display of statistical data collected during the run of
the model.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
5-9
5
Model-Based Ethernet Communications Support
Create Ethernet Packet
Create Ethernet Packet based on the MAC address and EtherType provided
Library
Simulink Real-Time Library for Ethernet
Description
Use the Create Ethernet Packet block to create the Ethernet packets that you want to
transfer.
Block Parameters
Destination MAC
Enter the MAC address of the target computer to receive the data.
EtherType (use 0 for length)
Enter a value to represent either the EtherType or the length that the Ethernet
frame is to transfer.
• EtherType — If you are working with Ethernet packets that use EtherType
values, enter a valid EtherType value to specify which prototype the Ethernet
frame will transfer.
• Ethernet length — If you are working with Ethernet packets that use Ethernet
lengths, enter 0.
5-10
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Ethernet Init
Ethernet Init
Initialize network card for real-time raw Ethernet communication
Library
Simulink Real-Time Library for Ethernet
Description
Use the Ethernet Init block to initialize the Ethernet communication channel.
You must use an Ethernet Init block for each Ethernet board.
Note: The Ethernet Init and Buffer Mngmt blocks are combined in the Real-Time
Ethernet Configuration block. Use this block for new development.
Block Parameters
This block has three tabs, Device, Addressing, and Advanced.
Device
Device ID
From the list, select a unique integer to identify the Ethernet board. Use this ID to
associate the other Ethernet blocks with this board.
Driver
Identifies the driver for each chip family supported. Possible values are Intel
8255X and Intel Gigabit.
PCI Bus
Enter the PCI bus number for the Ethernet card.
PCI Slot
Enter the PCI slot number for the Ethernet card.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
5-11
5
Model-Based Ethernet Communications Support
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
Addressing
Address source
From the list, select:
• EEPROM
Allow the block to get the Ethernet card MAC address that is built into the
Ethernet card.
• Specify
Enable the MAC parameter so that you can manually enter a MAC address for
the Ethernet card.
MAC
Enter the MAC address for the Ethernet card.
Enable this parameter by selecting Specify for the Address source parameter.
Rx promiscuous
Select this check box to direct the model to receive all packets regardless of their
destination address.
Multicast address list
Enter a list of multicast address vectors as a cell array. By default, this parameter
contains an empty cell array. The Ethernet Rx block uses these addresses in addition
to the broadcast address and unicast address.
Advanced
You do not normally need to modify the values of the parameters in this tab. Changing
the values of these parameters can change the behavior of your system.
Rx bad frames
Select this check box to direct the model to receive all packets, including erroneous
ones (such as CRC error, alignment error, and so forth).
5-12
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Ethernet Init
Rx short frames
Select this check box to direct the model to receive all packets, including frames that
are less than 64 bytes in length.
Note: The Intel Gigabit Ethernet controller does not distinguish between bad packets
and short packets. Therefore, checking either Rx Bad Frames or Rx Short Frames
has the same results for Driver type Intel Gigabit.
Max MTU
Specify a maximum transmission unit number (MTU). This parameter allows you to
specify a smaller maximum transmission unit number. The default is 1518.
Tx threshold
Enter a value to control when the Ethernet device will begin to perform direct
memory access (DMA) on packets from memory. The default is 224.
Note:
• This parameter only applies for Driver type Intel 8255X.
• Before you change this parameter, see Intel 8255x 10/100 Mbps Ethernet
Controller Family — Open Source Software Developer Manual.
Tx buffers
Enter the maximum number of buffers to hold in the queue before the driver is to
drop new transmit requests. The default is 128.
Rx buffers
Enter the maximum number of buffers to hold in the queue before the driver is to
drop new receive packets. The default is 64.
Note: For both Tx Buffers and Rx Buffers, the number of buffers must be a
multiple of 8.
Display tuning information
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
5-13
5
Model-Based Ethernet Communications Support
Select this check box to enable a display of statistical data collected during the run of
the model.
5-14
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Ethernet Rx
Ethernet Rx
Receive data over Ethernet network
Library
Simulink Real-Time Library for Ethernet
Description
Use the Ethernet Rx block to receive Ethernet packets and to filter on the received
packets. You can filter packets by EtherType or length. You can use multiple Ethernet
Rx blocks with the same device ID. However, you must configure each block to filter a
unique set of packets.
Block Parameters
This block has two tabs, Rx and Filter.
Rx
Device ID
From the list, select a unique number to identify the Ethernet board. Select the same
Device ID as the one you selected for the Real-Time Ethernet Configuration block.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
Filter
Filter criteria
From the list, select how you want to filter on EtherTypes (Ethernet II framing
standard) or Ethernet lengths (IEEE® 802.3 framing standard).
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
5-15
5
Model-Based Ethernet Communications Support
• Receive all unmatched types [0 to 65535]
Select this option to output all unmatched packets, both Ethernet II framing and
IEEE 802.3 framing standards.
• Receive unmatched lengths [0 to 1500]
Select this option to output all packets with IEEE 802.3 framing standard.
• Receive unmatched EtherTypes [150 to 65535]
Select this option to output all output packets with Ethernet II framing standard.
• Specify types to match
Select this option to enter your own criteria of the EtherTypes to output. This
option enables the Receive these types (vector of types 0–65535) parameter.
Receive these types (vector of types 0–65535)
Enter a vector of EtherTypes that you want to enable to output, for example
[hex2dec('0000')].
This field appears only if you select Specify types to match for the Filter
criteria parameter.
5-16
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Ethernet Tx
Ethernet Tx
Transmit data over Ethernet network
Library
Simulink Real-Time Library for Ethernet
Description
Use the Ethernet Tx block to send network packets.
Block Parameters
Device ID
From the list, select a unique number to identify the Ethernet board. Select the same
Device ID as the one you selected for the Real-Time Ethernet Configuration block.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
5-17
5
Model-Based Ethernet Communications Support
Extract Ethernet Packet
Extract data from Ethernet packet
Library
Simulink Real-Time Library for Ethernet
Description
Use the Extract Ethernet Packet block to extract data from an Ethernet packet.
Block Parameters
Data Size
Enter the data size (in bytes) for the data you want to extract from an Ethernet
packet.
5-18
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Filter Address
Filter Address
Filter Ethernet packets based on MAC address
Library
Simulink Real-Time Library for Ethernet
Description
Use the Filter Address block to filter network buffer packets, using their MAC addresses
as the sort criteria. See “Filter Type and Filter Address Blocks” on page 5-4 for cautions
on setting the parameters for this block.
Block Parameters
MAC Address
Enter a cell array of the MAC address for the filter.
Drop non-matches
Select this check box to discard packets whose MAC addresses do not match those
entered in the parameter MAC Address.
Clear this check box to direct the block to output packets whose MAC addresses do
not match those entered in the MAC Address parameter.
Filter on destination address
Clear this check box (default) to direct the block to filter addresses for the source
address.
Select this check box to direct the block to filter addresses for the destination
address.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
5-19
5
Model-Based Ethernet Communications Support
Filter Type
Filter Ethernet packets based on EtherType
Library
Simulink Real-Time Library for Ethernet
Description
Use the Filter Type block to filter network buffer packets, using their EtherType values
as the sort criteria. See “Filter Type and Filter Address Blocks” on page 5-4 for cautions
on setting the parameters for this block.
Block Parameters
Match Length (1-1500)
Select this check box to match packets whose EtherType values fall within the range
1 to 1500.
EtherType
Enter a space delimited list of EtherTypes that you want to filter upon.
Drop non-matches
Clear this check box (default) to direct the block to output packets whose EtherTypes
or Ethernet lengths do not match those entered in the parameter EtherType.
Select this check box to direct the block to discard packets whose EtherTypes or
Ethernet lengths do not match those entered in the parameter EtherType.
5-20
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Header Extract
Header Extract
Extract header data from Ethernet packet
Library
Simulink Real-Time Library for Ethernet
Description
Use the Header Extract block to extract the header data of network buffer packets.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
5-21
‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ | ‪www.MatlabSite.com‬‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
6
Network Buffer Library for ModelBased Ethernet Communications
Support
• “Network Buffer Blocks” on page 6-2
• “Blocks — Alphabetical List” on page 6-3
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
6
Network Buffer Library for Model-Based Ethernet Communications Support
Network Buffer Blocks
The Ethernet library has a sublibrary, Network Buffers, which contains blocks specific
to the management of Ethernet network buffers. The blocks in this sublibrary are core
blocks that you might want to use to create other subsystems. However, the top-level
Ethernet blocks provide enough functionality for model-based Ethernet communications.
6-2
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Blocks — Alphabetical List
Blocks — Alphabetical List
Buffer Mngmt
Chain Size
Compose
Extract
Link
Manage
Merge
Split
Unlink
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
6-3
6
Network Buffer Library for Model-Based Ethernet Communications Support
Buffer Mngmt
Initialize network buffer pools
Library
Simulink Real-Time Library for Ethernet
Description
Use the Buffer Mngmt block to initialize network buffers.
Block Parameters
This block has two tabs, Main and Advanced.
Main
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
Advanced
You do not normally need to modify the values of the parameters in this tab. Changing
the values of these parameters can change the behavior of your system.
Buffer pool sizes (256, 512, 1024, 2048)
Enter a vector of the number of buffers for each pool size (256, 512, 1024, 2048).
Display tuning information
Select this check box to enable a display of statistical data collected during the run of
the model.
6-4
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Chain Size
Chain Size
Determine the number of network buffers in the chain
Library
Simulink Real-Time Library for Ethernet
Description
Use the Chain Size block to determine the number of buffers that are on the chain.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
6-5
6
Network Buffer Library for Model-Based Ethernet Communications Support
Compose
Create a network buffer from raw input data
Library
Simulink Real-Time Library for Ethernet
Description
Use the Compose block to create a network buffer. This block creates a pointer to a
network buffer.
6-6
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Extract
Extract
Extract raw data from network buffer
Library
Simulink Real-Time Library for Ethernet
Description
Use the Extract block to extract network buffer packets.
Block Parameters
Packet size (-1: inherit)
Enter the packet size for the network buffer packet to extract. Enter -1 (default) to
inherit the packet size.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
6-7
6
Network Buffer Library for Model-Based Ethernet Communications Support
Link
Link vector of network buffers into a chain
Library
Simulink Real-Time Library for Ethernet
Description
Use the Link block to convert a vector of network buffer signals into a linked list of
signals.
6-8
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Manage
Manage
Output or buffer packets as indicated by the parameters
Library
Simulink Real-Time Library for Ethernet
Description
Output or buffer packets as indicated by the parameters.
Block Parameters
Chain size
Specify the queuing (output) behavior of the block as packets are received.
Value
Description
inf
Output all packets. No queuing occurs.
0
Delete all packets, no packets pass through.
Positive number, Pass through the first C packets
C
Negative
number, C
Pass through the last C packets
Buffer size
Specify the buffering behavior of the block as packets are received.
Value
Description
inf
Buffer all remaining packets. Delete no packets.
0
Do not buffer packets. Delete all remaining packets.
Positive number, Buffer the remaining first B packets.
B
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
6-9
6
Network Buffer Library for Model-Based Ethernet Communications Support
Value
Description
Negative
number, B
Buffer the remaining last B packets.
Threshold
Enter a minimum threshold before which this block begins to output buffers.
Value
Description
0
Specifies no threshold.
Negative
number,T
Delay passing buffer packets until T packets are buffered.
Positive number, Passes buffer packets if T packets are buffered.
T
6-10
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Merge
Merge
Merge the incoming network buffer chains into one
Library
Simulink Real-Time Library for Ethernet
Description
Use the Merge block to combine signal pointers to a linked list.
Block Parameters
Number of inputs
Enter the number of network buffer signal pointers to combine into a linked list.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
6-11
6
Network Buffer Library for Model-Based Ethernet Communications Support
Split
Split a network buffer chain
Library
Simulink Real-Time Library for Ethernet
Description
Use the Split block to separate a linked list of buffer pointers into separate individual
pointers.
Block Parameters
Number of outputs
Enter the number of pointers the input linked list should be separated into.
• If the number of buffers is the same as this value, this block splits them
and outputs them in the order they appear in the vector, or in reverse order
(depending on the setting of the Split in reverse order parameter).
• If the number of buffers is less than Number of outputs, the block outputs zeros
(0s) for the extra output ports.
• If the number of buffers is greater than Number of outputs, the block either
deletes the extra buffers, or chains the remaining buffers together (depending on
the setting of the Allow chaining for last signal parameter).
Split in reverse order
Select this check box to split out the network buffers in the reverse order in which
they are received.
Allow chaining for last signal
Select this check box to chain together remaining network buffers. There might be
remaining buffers if the incoming linked list contains more buffers than the number
in Number of outputs.
6-12
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Split
Clear this check box to delete the remaining buffers.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
6-13
6
Network Buffer Library for Model-Based Ethernet Communications Support
Unlink
Unlink a chain into a vector of network buffers
Library
Simulink Real-Time Library for Ethernet
Description
Use the Unlink block to convert a linked list of signals into a vector of network buffer
signal.
Block Parameters
Vector length (-1: inherit)
Enter the number of signals in the linked list of signals that you want to separate.
Enter -1 (default) to inherit the vector length.
6-14
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
7
Model-Based EtherCAT
Communications Support
• “Modeling EtherCAT Networks” on page 7-3
• “Install EtherCAT Hardware and Software for Configuration” on page 7-6
• “EtherCAT Installation and Setup Requirements” on page 7-7
• “Configure EtherCAT Hardware” on page 7-8
• “Scan EtherCAT Network” on page 7-9
• “Configure EtherCAT Master Node Data” on page 7-11
• “Create EtherCAT Task” on page 7-12
• “Configure EtherCAT Task Inputs” on page 7-14
• “Configure EtherCAT Task Outputs” on page 7-16
• “Export and Save EtherCAT Configuration” on page 7-18
• “Install EtherCAT Network for Execution” on page 7-19
• “Configure EtherCAT Master Node Model” on page 7-20
• “Configure EtherCAT Init Block” on page 7-21
• “Configure EtherCAT PDO Receive Blocks” on page 7-23
• “Configure EtherCAT PDO Transmit Blocks” on page 7-24
• “Configure EtherCAT Model Configuration Parameters” on page 7-25
• “Fixed-Step Size Derivation” on page 7-27
• “EtherCAT Protocol Mapping” on page 7-28
• “EtherCAT Configurator Component Mapping” on page 7-29
• “EtherCAT-Compatible Ethernet Chip Sets” on page 7-30
• “EtherCAT Data Types” on page 7-33
• “EtherCAT Init Block Error Values” on page 7-34
• “EtherCAT Init Block DC Error Values” on page 7-36
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
7
Model-Based EtherCAT Communications Support
• “Blocks — Alphabetical List” on page 7-37
7-2
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Modeling EtherCAT Networks
Modeling EtherCAT Networks
Ethernet for Control Automation (EtherCAT) is an open Ethernet network protocol for
real-time distributed control, for example in automotive and industrial applications. The
EtherCAT protocol provides:
• Deterministic and fast cycle times
• Inexpensive hardware cost
EtherCAT networks consist of one master node and several slave nodes. The Simulink
Real-Time EtherCAT sublibrary supports only the master node of an EtherCAT network.
You cannot emulate slave nodes using the blocks in the EtherCAT sublibrary. However,
you can use these blocks to prototype multiple EtherCAT networks with multiple
Ethernet cards.
You model an EtherCAT network using one of the third-party EtherCAT configurators:
the Beckhoff® ET9000, the Beckhoff TwinCAT®, or the Acontis EC-Engineer. To map
the network model into a Simulink Real-Time model, become familiar with the following
mappings:
• “EtherCAT Protocol Mapping”
• “EtherCAT Configurator Component Mapping”
Blocks and Tasks
At a minimum, each EtherCAT model must contain an EtherCAT Init block. The
EtherCAT Init block contains a reference to an EtherCAT configuration. The file
describes the network, including the device variables of the network. It also contains
information identifying the Ethernet card for the EtherCAT network that the software
accesses.
If you generate the configuration file using the Beckhoff ET9000 or the Beckhoff
TwinCAT software, use the software to create at least one cyclic input/output task. Link
this task to at least one input channel and one output channel on each slave device. If
you generate the file using Acontis EC-Engineer, the software creates one default task
linked to all slave device input/output channels.
When you know the input/output task rates, set the Fixed-step size in the
Configuration Parameters dialog box to a value consistent with the following constraints:
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
7-3
7
Model-Based EtherCAT Communications Support
• The task rates of all EtherCAT slave devices.
• The sample times of all other blocks in the Simulink model.
When you know the device variables that you are using in your model, add an EtherCAT
PDO Receive or EtherCAT PDO Transmit block for every EtherCAT device variable.
When you add these blocks to the model, the block obtains the list of device variables
from the configuration file in the EtherCAT Init block. When you specify a device
variable in the block dialog box, the software updates the block information with device
variable information from the configuration file.
To transmit CANopen over EtherCAT (CoE) information through your network, add
SDO upload and download blocks to your model. The SDO blocks come in two types,
synchronous and asynchronous. From the EtherCAT perspective, there is little difference
in behavior of these types. The difference arises during the execution of the real-time
application. The Sync SDO blocks halt execution while they wait for a response. The
Async SDO blocks continue executing and poll the hardware for a response. To avoid a
CPU overload, use a slower execution rate for the SDO blocks than for the PDO blocks.
To track the state of the network or force the network into a particular state, add an
EtherCAT Get State or EtherCAT Set State block.
Order of Network Events
Simulink Real-Time EtherCAT schedules network events according to the order
of execution of the EtherCAT blocks. There are two major rate groups: one for the
EtherCAT Sync SDO Upload and EtherCAT Sync SDO Download blocks, and another for
the rest of the EtherCAT blocks.
1
EtherCAT Init (phase 1) — Reads data from EtherCAT variables from the last
received frame into EtherCAT PDO Receive blocks.
2
Either of the following blocks, in arbitrary order:
• EtherCAT PDO Receive — Processes data read from the last frame received from
a slave device.
• EtherCAT PDO Transmit — Buffers data to send in the next frame to a slave
device.
3
Each of the following blocks, in arbitrary order:
• EtherCAT Sync SDO Upload — Queues an SDO frame with new value, waits for
response.
7-4
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Modeling EtherCAT Networks
• EtherCAT Sync SDO Download — Queues an SDO frame with request for data,
waits for response.
• EtherCAT Async SDO Upload — Queues an SDO frame with new value, checks
for response, continues execution.
• EtherCAT Async SDO Download — Queues an SDO frame with request for data,
checks for response, continues execution.
Upload and download take at least three ticks of the fastest PDO cycle time to
complete processing.
• EtherCAT Get State — Reads current state of EtherCAT network.
• EtherCAT Set State — Queues request to change current state of EtherCAT
network.
4
EtherCAT Init (phase 2) — Sends the PDO frames, followed by the next available
queued SDO frames.
See Also
Blocks
EtherCAT Init
Blocks
EtherCAT PDO Receive | EtherCAT PDO Transmit
Blocks
EtherCAT Async SDO Download | EtherCAT Async SDO Upload | EtherCAT Sync SDO
Download | EtherCAT Sync SDO Upload
Blocks
EtherCAT Get State | EtherCAT Set State
More About
•
“Fixed-Step Size Derivation”
•
“EtherCAT Protocol Mapping”
•
“EtherCAT Configurator Component Mapping”
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
7-5
7
Model-Based EtherCAT Communications Support
Install EtherCAT Hardware and Software for Configuration
To install the EtherCAT network hardware and configuration software, execute the
following steps. For requirements, see “EtherCAT Installation and Setup Requirements”.
1
Record the PCI bus and PCI slot for the existing Ethernet cards in the development
computer. Include cards used to access your local area network and the card used to
link the development and target computers.
2
Install a dedicated, EtherCAT compatible Ethernet card on your development
computer.
3
Record the PCI bus and PCI slot for the new Ethernet card. Verify the PCI bus and
PCI slot for the existing cards.
4
Download or purchase the Beckhoff ET9000 EtherCAT Configurator software,
available at http://www.beckhoff.com.
5
Install the Beckhoff ET9000 software on your development computer.
The next task is “Configure EtherCAT Hardware”.
7-6
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
EtherCAT Installation and Setup Requirements
EtherCAT Installation and Setup Requirements
For both the development and target computers, the EtherCAT hardware has the
following requirements:
• The Ethernet card must be compatible with EtherCAT communication. For a list of
supported chip sets, see “EtherCAT-Compatible Ethernet Chip Sets”.
• The Ethernet card must use a static IP address and a nonroutable subnet.
For information on setting up the dedicated Ethernet card, see your network
administrator.
• On the target computer, install two Ethernet cards. Dedicate one card to linking the
development and target computers. Dedicate the other to model-based EtherCAT
communication.
On the development computer, the best practice is also to install two Ethernet
cards. You can use the same Ethernet card for EtherCAT network configuration and
Ethernet link. Unplug the EtherCAT network cable and plug in the Ethernet link
cable before building and downloading the model.
The Beckhoff ET9000 software runs only on the development computer. It has the
following requirements:
• The development computer must be a 32-bit Windows® computer.
• The development computer Ethernet card must be configured to enable only the
Internet Protocol Version 4 (TCP/IPv4) driver.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
7-7
7
Model-Based EtherCAT Communications Support
Configure EtherCAT Hardware
To configure the EtherCAT network using the Beckhoff ET9000 EtherCAT Configurator,
execute the following steps. The model comes from example EtherCAT Communication Analog I/O.
1
“Scan EtherCAT Network”
2
“Configure EtherCAT Master Node Data”
3
“Export and Save EtherCAT Configuration”
The next task is “Install EtherCAT Network for Execution”.
7-8
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Scan EtherCAT Network
Scan EtherCAT Network
To scan an EtherCAT network using the Beckhoff ET9000 EtherCAT Configurator
program:
1
Connect your EtherCAT network to the development computer Ethernet port
dedicated to EtherCAT. Turn on the network.
2
Start the Beckhoff ET9000 software from Windows.
3
Right-click I/O Devices and select Scan Devices.
A dialog box opens stating that not all types of devices can be found automatically.
4
Click OK.
A dialog box opens listing Ethernet devices on the development computer.
5
Select the check box next to the Ethernet device into which you plugged your
EtherCAT network. If you do not see an Ethernet device identified as an EtherCAT
device, check your EtherCAT network configuration and power supply.
6
Click OK.
7
In the dialog box, click Yes.
An EtherCAT device hierarchy appears under I/O Devices. A dialog box opens
asking if you want to activate free run mode.
8
Click No.
9
Expand Term 1, Term 2, and Term 3. then click the EtherCAT tab.
The Beckhoff ET9000 window looks like this figure.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
7-9
7
Model-Based EtherCAT Communications Support
The next task is “Configure EtherCAT Master Node Data”.
7-10
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Configure EtherCAT Master Node Data
Configure EtherCAT Master Node Data
Before configuring the master node of an EtherCAT network, scan the network using the
Beckhoff ET9000 EtherCAT Configurator program.
To configure the master node, execute the following steps.
1
“Create EtherCAT Task”
2
“Configure EtherCAT Task Inputs”
3
“Configure EtherCAT Task Outputs”
The next task is “Export and Save EtherCAT Configuration”.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
7-11
7
Model-Based EtherCAT Communications Support
Create EtherCAT Task
Before creating an EtherCAT task and configuring its time settings, scan the network
using the Beckhoff ET9000 EtherCAT Configurator program.
To create and configure an EtherCAT task, execute the following steps.
1
Right-click Additional Tasks and select Append Task.
A dialog box opens prompting you for a name and comments.
2
Click OK to accept the default name, here Task 1.
An EtherCAT task hierarchy appears under Additional Tasks.
3
Click node Task 1, and then set the Cycle ticks box to 10 in the Task tab. This
value sets the cycle time to 10 milliseconds, displayed in the box labeled ms.
Note the cycle time in milliseconds. In the Configuration Parameters dialog box,
you use the cycle time to calculate a value for the Fixed-step size (fundamental
sample time) box. See “Configure EtherCAT Model Configuration Parameters”.
The Beckhoff ET9000 window looks like this figure.
7-12
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Create EtherCAT Task
The next task is “Configure EtherCAT Task Inputs”.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
7-13
7
Model-Based EtherCAT Communications Support
Configure EtherCAT Task Inputs
To configure the inputs of an EtherCAT task, add and configure a task using the
Beckhoff ET9000 EtherCAT Configurator program.
To configure the task inputs, execute the following steps.
1
Expand nodes Term 2 and AI Standard Channel 1.
2
Click and drag node Value under AI Standard Channel 1 to Inputs under Task
1.
3
Click Value under Inputs and select the Variable tab.
4
Click the Linked to button.
A dialog box opens for attaching a variable to an input.
5
Select the first Value entry under Term 2, and then click OK.
The Beckhoff ET9000 window looks like this figure.
7-14
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Configure EtherCAT Task Inputs
The next task is “Configure EtherCAT Task Outputs”.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
7-15
7
Model-Based EtherCAT Communications Support
Configure EtherCAT Task Outputs
To configure the outputs of an EtherCAT task, add and configure a task using the
Beckhoff ET9000 EtherCAT Configurator program.
To configure the task outputs, execute the following steps.
1
Expand nodes Term 3 and AO Outputs Channel 1.
2
Click and drag node Analog output under AO Outputs Channel 1 to Outputs
under Task 1.
3
Click Analog output under Outputs and select the Variable tab.
4
Click the Linked to button.
A dialog box opens for attaching a variable to an output.
5
Select the first Analog output entry under Term 3 and click OK.
The Beckhoff ET9000 window looks like this figure.
7-16
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Configure EtherCAT Task Outputs
The next task is “Export and Save EtherCAT Configuration”.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
7-17
7
Model-Based EtherCAT Communications Support
Export and Save EtherCAT Configuration
The EtherCAT Network Information (ENI) file represents the master node of an
EtherCAT network. To create the ENI file, scan and configure the network using the
Beckhoff ET9000 EtherCAT Configurator program. To export the ENI file, execute the
following steps.
1
Click node Device 1 (EtherCAT), and then click the EtherCAT tab.
2
Click Export Configuration File.
3
In the file save dialog box, enter an XML file name, such as
BeckhoffAIOconfig.xml, and then click Save. Do not name the ENI file
required by a Simulink Real-Time model already named modelname with the name
modelname.xml.
4
Click File > Save.
5
In the file save dialog box, enter an ESM file name, such as
BeckhoffAIOconfig.esm, and then click Save.
To review or modify your configuration, open the ESM file using the Beckhoff ET9000
EtherCAT Configurator program. If you modify the configuration, save both the XML
and ESM files. If the ESM file is not present, the Beckhoff ET9000 program cannot open
the XML file. The same is true for the Beckhoff TwinCAT program.
The next task is “Install EtherCAT Network for Execution”.
7-18
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Install EtherCAT Network for Execution
Install EtherCAT Network for Execution
To install the EtherCAT Network for execution using the target computer as master
node, execute the following steps. For requirements, see “EtherCAT Installation and
Setup Requirements”.
1
Record the PCI bus and PCI slot for the existing Ethernet cards in the target
computer. For more on identifying and selecting Ethernet cards for linking the
development and target computers, see “Ethernet Card Selection by Index”.
2
Install a dedicated, EtherCAT compatible Ethernet card on the target computer.
3
Record the PCI bus and PCI slot for the new Ethernet card. Verify the PCI bus and
PCI slot for the existing card. Update the Simulink Real-Time environment settings
to select the Ethernet card required for the Ethernet link.
4
Connect your EtherCAT network to the target computer Ethernet port dedicated to
EtherCAT. Turn on the network.
The next task is “Configure EtherCAT Master Node Model”.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
7-19
7
Model-Based EtherCAT Communications Support
Configure EtherCAT Master Node Model
Before configuring model xpcEthercatBeckhoffAIO for execution using the target
computer as master node, use the Beckhoff ET9000 EtherCAT Configurator program to
configure the network.
To configure model xpcEthercatBeckhoffAIO for execution, execute the following
steps.
1
“Configure EtherCAT Init Block”
2
“Configure EtherCAT PDO Receive Blocks”
3
“Configure EtherCAT PDO Transmit Blocks”
4
“Configure EtherCAT Model Configuration Parameters”
The next tasks are building, downloading, and executing the EtherCAT master node
model.
7-20
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Configure EtherCAT Init Block
Configure EtherCAT Init Block
To configure the Init block of model xpcEthercatBeckhoffAIO, execute the following
steps.
Before you use the EtherCAT Init block, configure the EtherCAT network using the
Beckhoff ET9000 configurator. As part of this process, create and save an EtherCAT
Network Information (ENI) file. See “Configure EtherCAT Hardware”.
1
Open model xpcEthercatBeckhoffAIO.
2
Double-click the EtherCAT Init block.
3
At the Config file (ENI) text box, browse to the EtherCAT Network
Information (ENI) file that you created when you configured the network (here,
'BeckhoffAIOconfig.xml'). You can enter the file name with or without single
quotes.
4
Take the default value 0 for parameter Device index.
If the model includes more than one EtherCAT network, enter a unique Device
index for each network. Enter the same value for all blocks in each network.
5
Enter the PCI bus and PCI slot you recorded while configuring the EtherCAT
hardware for execution. See “Install EtherCAT Network for Execution”.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
7-21
7
Model-Based EtherCAT Communications Support
6
Click Refresh Data to read the ENI file and store the data in the EtherCAT Init
block.
7
Click OK.
The next task is “Configure EtherCAT PDO Receive Blocks”.
7-22
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Configure EtherCAT PDO Receive Blocks
Configure EtherCAT PDO Receive Blocks
To configure the EtherCAT PDO Receive blocks of model xpcEthercatBeckhoffAIO,
execute the following steps. You must have used the Beckhoff ET9000 configurator to
configure the EtherCAT network.
1
Double-click the EtherCAT PDO Receive block labeled EtherCAT PDO Receive.
2
Set parameter Device Index to the value set in the EtherCAT Init block.
3
From the Signal Name list, select the EtherCAT network being accessed, here Term
2 (EL3062).AI Standard Channel 1.Value.
4
Note the value of parameter Sample Time, which is in seconds.
5
Click OK.
Execute steps 5–9 for the EtherCAT PDO Receive block labeled EtherCAT PDO
Receive 1.
The next task is “Configure EtherCAT PDO Transmit Blocks”.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
7-23
7
Model-Based EtherCAT Communications Support
Configure EtherCAT PDO Transmit Blocks
To configure the EtherCAT PDO Transmit blocks of model xpcEthercatBeckhoffAIO,
execute the following steps. You must have used the Beckhoff ET9000 configurator to
configure the EtherCAT network.
1
Open model xpcEthercatBeckhoffAIO.
2
Double-click the EtherCAT PDO Transmit block labeled EtherCAT PDO Transmit.
3
Set parameter Device Index to the value set in the EtherCAT Init block.
4
Select a Signal Name value consistent with the EtherCAT network being accessed,
here Term 3 (EL4002).AO Outputs Channel 1.Analog output.
5
Note the value of parameter Sample Time, which is in seconds.
6
Click OK.
Execute steps 2–6 for the EtherCAT PDO Transmit block labeled EtherCAT PDO
Transmit 1.
The next task is “Configure EtherCAT Model Configuration Parameters”.
7-24
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Configure EtherCAT Model Configuration Parameters
Configure EtherCAT Model Configuration Parameters
To configure the configuration parameters for model xpcEthercatBeckhoffAIO,
execute the following steps. You must have used the Beckhoff ET9000 configurator
to configure the EtherCAT network. For more information, see “Fixed-Step Size
Derivation”.
1
Open model xpcEthercatBeckhoffAIO.
2
Calculate the greatest common divisor (GCD) of the Sample Time values for the
EtherCAT tasks and for all source blocks in the model. In this case, the GCD is
0.010.
3
In the Model Editor, click Simulation > Model Configuration Parameters and
click the Solver tab.
4
Set the Type parameter to Fixed-step and Fixed-step size (fundamental
sample time) to one of the following:
• An integral divisor of the GCD value, in seconds.
• auto, if all other source blocks in the model have defined sample times.
In this case, set it to 0.010.
The model configuration parameters dialog box looks like this figure.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
7-25
7
Model-Based EtherCAT Communications Support
5
Click OK.
The next tasks are building, downloading, and executing the EtherCAT master node
model.
7-26
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Fixed-Step Size Derivation
Fixed-Step Size Derivation
To configure the sample rate for an EtherCAT model, set the fixed-step size for the entire
model and the sample rates for key blocks.
The fixed-step size determines the task rates of the EtherCAT tasks and the sample
rates of the other source blocks in the model. Subject to the fixed step size value,
the block type determines the sample rate groups: a comparatively slow rate for the
synchronous SDO blocks, and another, faster rate for the rest of the blocks.
Using an EtherCAT network configurator, specify the EtherCAT task rate based on the
requirements of the EtherCAT network hardware. Choose the fixed-step size so that the
GCD of the task rates and the block sample rates is an integer multiple of the fixed-step
size.
The software sends all PDO data updates at the fastest specified task rate, even if you
created multiple EtherCAT tasks running at different rates. The PDO read and write
blocks run at the rate for the tasks containing the given EtherCAT variable.
If you know that the other source blocks have defined sample times, you can set Fixedstep size to auto. If one or more block rates are incompatible with the fixed sample
time, there is an error during system update. If you do not encounter an error, from the
Simulink Display menu, set Sample Time > Colors to reveal the block rates.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
7-27
7
Model-Based EtherCAT Communications Support
EtherCAT Protocol Mapping
EtherCAT supports a number of overlay protocols. Simulink Real-Time supports some of
the protocols directly, provides others with minimal support, and ignores some others.
7-28
Overlay Protocol
Protocol Description
Support Type
Means of Support
CANopen over
EtherCAT (CoE)
Implements CAN
functionality using
EtherCAT
Direct
Model CoE using
SDO upload and
download blocks.
Ethernet over
EtherCAT (EoE)
Provides EtherCAT
wrapper around
Ethernet packets.
EtherCAT acts as
network switch
Minimal
Send wrapped EoE
messages between
separate slave
devices.
File Access over
EtherCAT (FoE)
Updates the
EtherCAT board
ROM
Ignored
Update the
EtherCAT slave
ROM using Beckhoff
TwinCAT.
Functional Safety
over EtherCAT
(FSoE)
Sends asynchronous Ignored
‘safety’ messages
over the network.
Servo over
EtherCAT (SoE)
Wraps hardwarespecific servo
commands in a
common protocol.
Ignored
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
EtherCAT Configurator Component Mapping
EtherCAT Configurator Component Mapping
The following table summarizes the mapping between third-party EtherCAT configurator
components and Simulink Real-Time blocks and block attributes. For more information,
see the documentation for the Beckhoff ET9000, the Beckhoff TwinCAT, or the Acontis
EC-Engineer configurator.
EtherCAT Configurator Component
Simulink Real-Time Component
Beckhoff ET9000, TwinCAT
Acontis EC-Engineer
Cycle ticks (task rate)
Cycle time
Sample time, Task rates
Scalars and vectors
Dimension
Dimension
BitSize
Byte size of type
Type Size
Data Type, BitSize
Data type
Signal Type
EtherCAT device variable
linked to a variable in a
task
All PDO variables included
in default task, with no
linking required.
EtherCAT PDO
Receive Signal Name
Device variables in Process
Image entity
EtherCAT PDO Receive or
EtherCAT PDO Transmit
block
EtherCAT PDO Receive or
EtherCAT PDO Transmit
block
See Also
EtherCAT PDO Receive | EtherCAT PDO Transmit
More About
•
“EtherCAT Data Types”
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
7-29
7
Model-Based EtherCAT Communications Support
EtherCAT-Compatible Ethernet Chip Sets
The Simulink Real-Time EtherCAT communication blocks support the Intel Gigabit
Ethernet and Intel Fast Ethernet (10/100) chip sets. The Intel vendor ID is 0x8086.
Intel Gigabit Ethernet Chip Sets
7-30
Device ID
Chip Number
Chip Description
0x100E
02000
Intel PRO/1000 MT Desktop Adapter
0x1010
82546EB
Intel PRO/1000 MT Dual Port Server Adapter
0x1013
82541EI
Gigabit Ethernet Controller (Copper)
0x1019
82547EI
Gigabit Ethernet Controller (LOM)
0x1026
82545EP
Gigabit Ethernet Controller
0x104A
82566DM
Intel 82566DM Gigabit Ethernet
0x104D
82566MC
Intel 82566MC Gigabit Ethernet
0x105E
82579V
Intel PRO/1000 PT Dual Port Server Adapter
0x1075
82547EI
Gigabit Ethernet Controller
0x1076
82541EI
Gigabit Ethernet Controller
0x1078
82541ER
Gigabit Ethernet Controller
0x1079
82546EB
Dual Port Gigabit Ethernet Controller
0x107C
82541PI
Gigabit Ethernet Controller (Copper) rev 5
0x107D
82572EI
Intel 82572EI Gigabit Ethernet Controller
0x108B
PC82573V
Intel network controller (PCIE Gigabit Ethernet)
0x108C
82573E
Intel 82573E Gigabit Ethernet Controller (Copper)
0x109A
82573L
Intel PRO/1000 PL Network Adaptor
0x10A4
82571GB
Intel PRO/1000 PT Quad Port Server Adapter
0x10A7
82575EB
82575EB Gigabit Network Connection
0x10B9
82572GI
Intel PRO/1000 PT Desktop
0x10BC
82571GB
Intel PRO/1000 PT Low Profile Quad Port Server Adapter
0x10BD
82566DM
Intel 82566DM Gigabit Ethernet Adapter
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
EtherCAT-Compatible Ethernet Chip Sets
Device ID
Chip Number
Chip Description
0x10C9
82576
82576 Gigabit ET Dual Port Server Adapter
0x10CE
82567V-2
Intel 82567V-2 Gigabit Network Connection
0x10D3
82574L
Intel 82574L Gigabit Ethernet Controller
0x10DE
02761028
Intel Gigabit network connection
0x10EA
82577LM
Intel 82577LM Gigabit LAN Controller
0x10EB
82577LC
Intel 82577 Gigabit Ethernet
0x10EF
82578DM
Intel 82578DM Gigabit Ethernet
0x10F0
82578DC
Intel 82578DC Gigabit Ethernet
0x10F5
82567LM
Intel 82567LM-2 Gigabit Network Connection
0x1501
82567V3
Intel 82567V3 Gigabit Network Connections
0x1502
0x04931028
Intel 82579LM Gigabit Network Card
0x1503
82579V
Gigabit Network Connection
0x150C
82583V
Intel 82583V Gigabit Ethernet Controller
0x150E
82580 QUAD
82580 Gigabit Network Connection
0x1521
I350
i350 Gigabit Network Connection
0x1526
82576
Intel Gigabit ET2 Quad Port Server Adapter
0x1527
82580 QUAD
FIBRE
Intel Ethernet Server Adapter I340-F4
0x1533
210_COPPER
Intel I210 Gigabit Network Connection
0x1539
211AT
Intel Ethernet Controller I211-AT
0x153A
217LM
0x153B
217V
0x155A
218LM
0x157B
210_COPPER_FLASHLESS
Intel I210 Gigabit Network Connection
0x1559
218V
0xABB1
0xABB2
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
7-31
7
Model-Based EtherCAT Communications Support
Intel Fast Ethernet (10/100) Chip Sets
7-32
Device ID
Chip Number
Chip Description
0x1039
10011734
LAN Controller: 82562ET, 82562EZ, 82562VE, 82562VM
0x103A
82801DB
LAN Controller with 82562ET/EZ (CNR)
0x1050
82562EZ
Pro/100 VE Network Connection
0x1059
82551QM
Fast Ethernet PCI/CardBus Controller
0x1092
27DA
PRO/100 VE Network Controller
0x1209
8255xER/IT
Fast Ethernet Controller for XP PC
0x1229
IE22
Intel PRO/100 M Desktop Adapter: 82557, 82558, 82559,
82550, 82551
0x2449
82559ER
82559ER Integrated 10Base-T/100Base-TX Ethernet
Controller
0x27DC
336C1462
Intel PRO/100 VE Desktop Adapter
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
EtherCAT Data Types
EtherCAT Data Types
The Simulink Real-Time EtherCAT blocks directly support the following EtherCAT data
types. The software maps other EtherCAT data types to a byte array. The byte array
requires explicit conversion using Byte Pack, Byte Unpack, or S-function blocks.
EtherCAT Data Type
Data Type Size (bits)
Converted Simulink Data Type
bit
1
uint8
bit8
8
uint8
bitarr
8 (bit array)
uint8
bitarr16
16 (bit array)
uint16
bitarr32
32 (bit array)
uint32
BOOL
1
Boolean
int8
8
int8
int16
16
int16
int32
32
int32
int64
64
int64
uint8
8
uint8
uint16
16
uint16
uint32
32
uint32
uint64
64
uint64
float
32
real32_T
double
64
real_T
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
7-33
7
Model-Based EtherCAT Communications Support
EtherCAT Init Block Error Values
The Simulink Real-Time EtherCAT Init block returns the following EtherCAT error
values. The value 0 indicates that no error occurred.
The block clears ErrVal after you read it. To hold it for later examination, send it to a
Signal Latch block.
7-34
Error Value
Description
65537 (0x10001)
Cyclic command: working counter error
65538 (0x10002)
Master initialization command: working counter error
65539 (0x10003)
Slave initialization command: working counter error
65540 (0x10004)
EOE mailbox receive: working counter error
65541 (0x10005)
COE mailbox receive: working counter error
65542 (0x10006)
FOE mailbox receive: working counter error
65543 (0x10007)
EOE mailbox send: working counter error
65544 (0x10008)
COE mailbox send: working counter error
65545 (0x10009)
FOE mailbox send: working counter error
65546 (0x1000a)
Got no response on a sent Ethernet frame
65547 (0x1000b)
Got no response on a sent EtherCAT initialization command from
slave
65548 (0x1000c)
Got no response on a sent EtherCAT master initialization
command
65549 (0x1000d)
Missing EtherCAT command in received Ethernet frame
65550 (0x1000e)
Timeout when waiting for mailbox initialization command
response
65551 (0x1000f)
Not all slave devices are in operational state when receiving cyclic
frames
65552 (0x10010)
Ethernet link (cable) not connected
65553 (0x10011)
Not in use
65554 (0x10012)
Redundancy: line break detected
65555 (0x10013)
At least one slave is in error state when receiving cyclic frames
(BRD AL-STATUS)
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
EtherCAT Init Block Error Values
Error Value
Description
65556 (0x10014)
Slave error status information
65557 (0x10015)
Fixed station address lost (or slave missing) - FPRD to
AL_STATUS failed
65558 (0x10016)
SOE mailbox receive: working counter error
65559 (0x10017)
SOE mailbox send: working counter error
65560 (0x10018)
SOE mailbox write responded with an error
65561 (0x10019)
COE mailbox SDO abort
65562 (0x1001a)
Client registration dropped, possibly call to ecatConfigureMaster
by other thread (RAS)
65563 (0x1001b)
Redundancy: line is repaired
65564 (0x1001c)
FOE mailbox abort
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
7-35
7
Model-Based EtherCAT Communications Support
EtherCAT Init Block DC Error Values
The Simulink Real-Time EtherCAT Init block returns the following EtherCAT
distributed clock (DC) error values. The value 0 indicates that no error occurred.
7-36
Error Value
Description
1 (0x1)
Init function not called or not successful
2 (0x2)
Controller error — synchronization out of limit
3 (0x3)
Not enough memory
4 (0x4)
Hardware layer — (BSP) invalid
5 (0x5)
Hardware layer — error modifying the timer
6 (0x6)
Hardware layer — timer is not running
7 (0x7)
Hardware layer — function is called on wrong CPU
8 (0x8)
Invalid DC sync period length
9 (0x9)
Error DCM Controller SetVal is too small
10 (0xA)
Error DCM Controller — Drift between local timer and ref clock
too high
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Blocks — Alphabetical List
Blocks — Alphabetical List
EtherCAT Init
EtherCAT PDO Receive
EtherCAT PDO Transmit
EtherCAT Get State
EtherCAT Set State
EtherCAT Sync SDO Upload
EtherCAT Sync SDO Download
EtherCAT Async SDO Upload
EtherCAT Async SDO Download
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
7-37
7
Model-Based EtherCAT Communications Support
EtherCAT Init
Initialize EtherCAT Master node with data in Beckhoff configuration file
Library
Simulink Real-Time Library for EtherCAT
Description
The EtherCAT Init block initializes the EtherCAT master stack. The block specifies the
Ethernet interface cards in the network.
Before you use this block, create and save an EtherCAT Network Information (ENI) file.
You export the ENI file from one of the following EtherCAT configurators: the Beckhoff
ET9000, the Beckhoff TwinCAT, or the Acontis EC-Engineer. See “Configure EtherCAT
Hardware” on page 7-8.
Click Browse to find the ENI file. To read the ENI file and store the data in the
EtherCAT Init block, click Refresh Data.
The Simulink Real-Time software supports multiple EtherCAT networks. To use
multiple networks:
• Use a different Ethernet card interface for each EtherCAT network.
• In the model, use one EtherCAT Init block for each network.
• Place the EtherCAT Init block in only the top-level subsystem of the root model.
Block Outputs
Name
Description
Status
A vector containing six values:
[ErrVal MasterState DCErrVal MasterToNetworkClkDiff
DCInitState NetworkToSlaveClkDiff]
7-38
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
EtherCAT Init
• ErrVal — 0 if no error occurs. Otherwise, this element contains a value from
“EtherCAT Init Block Error Values”.
After you read ErrVal, the block clears it. To hold ErrVal for later examination,
send it to a Signal Latch block.
• MasterState — one of the following states.
State
Value
Description
INIT
1
Initialization – The system finds slave devices and
initializes the communication controller.
PREOP
2
Preoperational — The system uses the communication
controller to exchange application-specific initialization
data. In this state, the network cannot transmit or
receive signal data.
SAFEOP
4
Safe operational — The network is running and ready
for full operation. The master sends input data to the
slave device. The slave device output remains in a safe
state.
OP
8
Operational — The network is in full operation. The
master sends input data to the slave device. The slave
device responds with output data.
• DCErrVal — 0 if the distributed clock is turned off or if no error occurs. Otherwise,
this element contains a value from “EtherCAT Init Block DC Error Values”.
• MasterToNetworkClkDiff — Difference, in nanoseconds, between the master
stack clock on the target computer and the clock on the first EtherCAT slave device
that has enabled DC.
• DCInitState — 1 if the distributed clock has been started. If 0, DC has not yet been
initialized or the XML configuration file did not enable DC.
• NetworkToSlaveClkDiff — Difference, in nanoseconds, between the clock on the
first EtherCAT slave device and the least closely locked clock on the remaining slave
devices. Applies only to slave devices that have enabled DC. If only one device on the
network has enabled DC, this value is 0.
Block Parameters
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
7-39
7
Model-Based EtherCAT Communications Support
Config file (ENI)
Specify the ENI file that you exported from the EtherCAT configurator.
Specify the full path name. If you specify only the file name and more than one file
with that name exists on the MATLAB path, MATLAB displays a message box to
select the file that you want.
Device index
A unique integer in the range 0 to 15 that identifies the Ethernet card for an
EtherCAT network.
For each EtherCAT network, the software generates a unique device index. The
software inserts that device index as Device index into the EtherCAT Init block
that represents the network.
PCI Bus
Enter the PCI bus number for the Ethernet card.
PCI Slot
Enter the PCI slot number for the Ethernet card.
Enable Log and Debugging
Select this check box to enable access to debugging and logging block parameters.
When you select Enable Log and Debugging, the following block parameters are
visible.
Enable DC
Selected by default. Clear it only for driver and network debugging.
To disable distributed clocks for a reason other than debugging, modify the
configuration file to disable the clocks. Do not clear the Enable DC check box unless
MathWorks® technical support suggests that you do so.
Log link layer error messagesLog master state changesLog all state changesLog
base clock changesLog master config changes
Select these check boxes to generate driver-level messages for driver and network
debugging.
For a high-speed model, turning these options on can cause CPU overloads.
Target log filename
7-40
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
EtherCAT Init
Enter the name of the log file on the target computer, in single quotes. The default
value is 'c:\dbglog.txt'.
If the target computer does not have a usable disk partition, the software does not
create the log file.
See Also
“EtherCAT Init Block Error Values” | “EtherCAT Init Block DC Error Values” | Signal
Latch
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
7-41
7
Model-Based EtherCAT Communications Support
EtherCAT PDO Receive
Receive data from slave device represented by process data object
Library
Simulink Real-Time Library for EtherCAT
Description
The EtherCAT PDO Receive block receives data from the EtherCAT slave device.
The block parameter dialog box has two sections, parameters and signal information.
When you specify an EtherCAT network and device variable name:
• The EtherCAT PDO Receive block mask is updated with the selected signal name.
• The signal information in the block parameter dialog box is updated to reflect the
device variable.
Note: If an error occurs while the software parses the configuration file specified in the
EtherCAT Init block, this block shows an error message.
Block Outputs
Name
Description
D
Data received from the EtherCAT slave
device.
Block Parameters
Device index
A unique integer in the range 0 to 15 that identifies the Ethernet card for an
EtherCAT network.
7-42
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
EtherCAT PDO Receive
To associate a block with an EtherCAT network, copy the Device index value from
the EtherCAT Init block representing that network into the Device index for the
block.
The default value of Device index is 0.
Signal name
From the list, select the EtherCAT device variable name.
The block parameter dialog box updates the signal information to reflect the device
variable that you selected.
Signal Information
Description
Signal Offset
Location in the process image from which the data is
available after the execution of the EtherCAT Init block.
This value is the EtherCAT configurator BitOffs − 80.
Signal Type
The Simulink data type for the EtherCAT data. For
a mapping of Simulink data types to EtherCAT data
types, see “EtherCAT Data Types”
Type Size (bits)
Size of the EtherCAT data type. See “EtherCAT Data
Types” for a mapping of Simulink data types to the
EtherCAT data types and data type sizes.
Signal Dimension
Dimension of the signal. The EtherCAT blocks support
scalars and vectors (dimension of 1).
Sample Time
Rate at which this block is executed. This rate is the
execution rate of the EtherCAT task, as specified in the
Beckhoff ET9000 EtherCAT configurator.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
7-43
7
Model-Based EtherCAT Communications Support
EtherCAT PDO Transmit
Send data to slave device represented by process data object
Library
Simulink Real-Time Library for EtherCAT
Description
The EtherCAT PDO Transmit transmits computed data to a particular variable in the
EtherCAT slave device.
The block parameter dialog box has two sections, parameters and signal information.
When you specify an EtherCAT network and device variable name:
• The EtherCAT PDO Receive block mask is updated with the selected signal name.
• The signal information in the block parameter dialog box is updated to reflect the
device variable.
Note: If an error occurs while the software parses the configuration file specified in the
EtherCAT Init block, this block shows an error message.
Block Inputs
Name
Description
D
Data to transmit to the EtherCAT slave device.
Block Parameters
Device index
A unique integer in the range 0 to 15 that identifies the Ethernet card for an
EtherCAT network.
7-44
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
EtherCAT PDO Transmit
To associate a block with an EtherCAT network, copy the Device index value from
the EtherCAT Init block representing that network into the Device index for the
block.
The default value of Device index is 0.
Signal name
From the list, select the EtherCAT device variable name.
The block parameter dialog box updates the signal information to reflect the device
variable that you selected.
Signal Information
Description
Signal Offset
Location in the process image from which the data is
available after the execution of the EtherCAT Init block.
This value is the EtherCAT configurator BitOffs − 80.
Signal Type
The Simulink data type for the EtherCAT data. For
a mapping of Simulink data types to EtherCAT data
types, see “EtherCAT Data Types”
Type Size (bits)
Size of the EtherCAT data type. See “EtherCAT Data
Types” for a mapping of Simulink data types to the
EtherCAT data types and data type sizes.
Signal Dimension
Dimension of the signal. The EtherCAT blocks support
scalars and vectors (dimension of 1).
Sample Time
Rate at which this block is executed. This rate is the
execution rate of the EtherCAT task, as specified in the
Beckhoff ET9000 EtherCAT configurator.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
7-45
7
Model-Based EtherCAT Communications Support
EtherCAT Get State
Get state of EtherCAT network
Library
Simulink Real-Time Library for EtherCAT
Description
The EtherCAT Get State block returns the state of the EtherCAT network.
State
Value
Description
INIT
1
Initialization – The system finds slave devices and
initializes the communication controller.
PREOP
2
Preoperational — The system uses the communication
controller to exchange application-specific initialization
data. In this state, the network cannot transmit or receive
signal data.
SAFEOP
4
Safe operational — The network is running and ready for
full operation. The master sends input data to the slave
device. The slave device output remains in a safe state.
OP
8
Operational — The network is in full operation. The
master sends input data to the slave device. The slave
device responds with output data.
Block Outputs
Name
Description
State
Reception from the EtherCAT network.
Block Parameters
Device index
7-46
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
EtherCAT Get State
A unique integer in the range 0 to 15 that identifies the Ethernet card for an
EtherCAT network.
To associate a block with an EtherCAT network, copy the Device index value from
the EtherCAT Init block representing that network into the Device index for the
block.
The default value of Device index is 0.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
7-47
7
Model-Based EtherCAT Communications Support
EtherCAT Set State
Set state of EtherCAT network
Library
Simulink Real-Time Library for EtherCAT
Description
The EtherCAT Set State block sets the state of the EtherCAT network. Each state has
the corresponding integer:
State
Value
Description
INIT
1
Initialization – The system finds slave devices and
initializes the communication controller.
PREOP
2
Preoperational — The system uses the communication
controller to exchange application-specific initialization
data. In this state, the network cannot transmit or receive
signal data.
SAFEOP
4
Safe operational — The network is running and ready for
full operation. The master sends input data to the slave
device. The slave device output remains in a safe state.
OP
8
Operational — The network is in full operation. The
master sends input data to the slave device. The slave
device responds with output data.
Block Inputs and Outputs
Inputs
7-48
Name
Description
New State
Transmission to the EtherCAT network.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
EtherCAT Set State
Outputs
Name
Description
Prev State
Previous state of the network.
Error
0 if no error occurs. Otherwise, a nonzero value.
Block Parameters
Device index
A unique integer in the range 0 to 15 that identifies the Ethernet card for an
EtherCAT network.
To associate a block with an EtherCAT network, copy the Device index value from
the EtherCAT Init block representing that network into the Device index for the
block.
The default value of Device index is 0.
Timeout
Enter the number of seconds to wait for the EtherCAT network state to transition.
Set the timeout to 0 to return immediately.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
7-49
7
Model-Based EtherCAT Communications Support
EtherCAT Sync SDO Upload
Read data synchronously from slave device represented by service data object
Library
Simulink Real-Time Library for EtherCAT
Description
The EtherCAT Sync SDO Upload block reads a CANopen dictionary entry in the
specified EtherCAT slave. The block then waits until it receives a response or until the
timeout period is over.
The response to an operation can take several ticks of the main task sample time. Assign
the synchronous blocks a sample time slower than the main task sample time.
Block Outputs
Name
Description
Data
Data received from the EtherCAT slave device.
Error
0 if no error occurs. Otherwise, a nonzero value.
Block Parameters
Index
Specify the decimal index of the CANopen dictionary entry.
If you specify an invalid index, the block does not return an error or a time out. The
results are undefined.
Subindex
Specify the decimal subindex of the CANopen dictionary entry.
7-50
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
EtherCAT Sync SDO Upload
If you specify an invalid subindex, the block does not return an error or a time out.
The results are undefined.
Data Type
From the list, select the data type of the CANopen dictionary entry.
If you select a data type that does not match the type of the entry, the block returns
an error.
Dimension
Specify the row and column dimension of the CANopen dictionary entry.
Enter a value of 1. EtherCAT blocks support only scalars and vectors.
Device index
A unique integer in the range 0 to 15 that identifies the Ethernet card for an
EtherCAT network.
To associate a block with an EtherCAT network, copy the Device index value from
the EtherCAT Init block representing that network into the Device index for the
block.
The default value of Device index is 0.
Slave Name
From the list, select the name of the slave that contains the CANopen data dictionary
variable.
The block populates this drop-down list with the contents of the configuration file.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
Timeout
Enter the number of milliseconds to wait for a response from the EtherCAT slave.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
7-51
7
Model-Based EtherCAT Communications Support
EtherCAT Sync SDO Download
Transmit data synchronously to slave device represented by service data object
Library
Simulink Real-Time Library for EtherCAT
Description
The EtherCAT Sync SDO Download block writes to a CANopen dictionary entry in the
specified EtherCAT slave. The block then waits until it receives a response or until the
timeout period is over.
The response to an operation can take several ticks of the main task sample time. Assign
the synchronous blocks a sample time slower than the main task sample time.
Block Inputs and Outputs
Inputs
Name
Description
Data
Input data for writing to the EtherCAT slave device.
Outputs
Name
Description
Error
0 if no error occurs. Otherwise, a nonzero value.
Block Parameters
Index
Specify the decimal index of the CANopen dictionary entry.
7-52
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
EtherCAT Sync SDO Download
If you specify an invalid index, the block does not return an error or a time out. The
results are undefined.
Subindex
Specify the decimal subindex of the CANopen dictionary entry.
If you specify an invalid subindex, the block does not return an error or a time out.
The results are undefined.
Data Type
From the list, select the data type of the CANopen dictionary entry.
If you select a data type that does not match the type of the entry, the block returns
an error.
Dimension
Specify the row and column dimension of the CANopen dictionary entry.
Enter a value of 1. EtherCAT blocks support only scalars and vectors.
Device index
A unique integer in the range 0 to 15 that identifies the Ethernet card for an
EtherCAT network.
To associate a block with an EtherCAT network, copy the Device index value from
the EtherCAT Init block representing that network into the Device index for the
block.
The default value of Device index is 0.
Slave Name
From the list, select the name of the slave that contains the CANopen data dictionary
variable.
The block populates this drop-down list with the contents of the configuration file.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
Timeout
Enter the number of milliseconds to wait for a response from the EtherCAT slave.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
7-53
7
Model-Based EtherCAT Communications Support
EtherCAT Async SDO Upload
Read data asynchronously from slave device represented by service data object
Library
Simulink Real-Time Library for EtherCAT
Description
The EtherCAT Async SDO Upload block requests a CANopen dictionary entry from the
specified EtherCAT slave. It then immediately returns whatever value was returned
from the device on an earlier call to the block.
Block Inputs and Outputs
Inputs
Name
Description
Enable
When true, the block uploads data.
Outputs
Name
Description
Data
Data received from the EtherCAT slave device.
Status
One of the following values:
• 0 — Mailbox transfer object idle, transfer not running
• 1 — Mailbox transfer object running, transfer not
complete
• 2 — Transfer successfully executed
• 3 — Error occurred during transfer request
7-54
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
EtherCAT Async SDO Upload
Block Parameters
Index
Specify the decimal index of the CANopen dictionary entry.
If you specify an invalid index, the block does not return an error or a time out. The
results are undefined.
Subindex
Specify the decimal subindex of the CANopen dictionary entry.
If you specify an invalid subindex, the block does not return an error or a time out.
The results are undefined.
Data Type
From the list, select the data type of the CANopen dictionary entry.
If you select a data type that does not match the type of the entry, the block returns
an error.
Dimension
Specify the row and column dimension of the CANopen dictionary entry.
Enter a value of 1. EtherCAT blocks support only scalars and vectors.
Device index
A unique integer in the range 0 to 15 that identifies the Ethernet card for an
EtherCAT network.
To associate a block with an EtherCAT network, copy the Device index value from
the EtherCAT Init block representing that network into the Device index for the
block.
The default value of Device index is 0.
Slave Name
From the list, select the name of the slave that contains the CANopen data dictionary
variable.
The block populates this drop-down list with the contents of the configuration file.
Sample time
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
7-55
7
Model-Based EtherCAT Communications Support
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
7-56
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
EtherCAT Async SDO Download
EtherCAT Async SDO Download
Transmit data asynchronously to slave device represented by service data object
Library
Simulink Real-Time Library for EtherCAT
Description
The EtherCAT Async SDO Download block writes a CANopen dictionary entry in the
specified EtherCAT slave. The block then immediately continues processing its input
data.
Block Inputs and Outputs
Inputs
Name
Description
Data
Input data for writing to the EtherCAT slave device.
Enable
When true, the block downloads data.
Outputs
Name
Description
Status
One of the following values:
• 0 — Mailbox transfer object idle, transfer not running
• 1 — Mailbox transfer object running, transfer not
complete
• 2 — Transfer successfully executed
• 3 — Error occurred during transfer request
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
7-57
7
Model-Based EtherCAT Communications Support
Block Parameters
Index
Specify the decimal index of the CANopen dictionary entry.
If you specify an invalid index, the block does not return an error or a time out. The
results are undefined.
Subindex
Specify the decimal subindex of the CANopen dictionary entry.
If you specify an invalid subindex, the block does not return an error or a time out.
The results are undefined.
Data Type
From the list, select the data type of the CANopen dictionary entry.
If you select a data type that does not match the type of the entry, the block returns
an error.
Dimension
Specify the row and column dimension of the CANopen dictionary entry.
Enter a value of 1. EtherCAT blocks support only scalars and vectors.
Device index
A unique integer in the range 0 to 15 that identifies the Ethernet card for an
EtherCAT network.
To associate a block with an EtherCAT network, copy the Device index value from
the EtherCAT Init block representing that network into the Device index for the
block.
The default value of Device index is 0.
Slave Name
From the list, select the name of the slave that contains the CANopen data dictionary
variable.
The block populates this drop-down list with the contents of the configuration file.
Sample time
7-58
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
EtherCAT Async SDO Download
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
7-59
‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ | ‪www.MatlabSite.com‬‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
‫‪UDP‬‬
‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ | ‪www.MatlabSite.com‬‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ | ‪www.MatlabSite.com‬‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
8
Real-Time UDP Communication
Support
• “Using Real-Time UDP Communications” on page 8-2
• “Blocks — Alphabetical List” on page 8-3
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
8
Real-Time UDP Communication Support
Using Real-Time UDP Communications
Consider using the real-time UDP communication blocks for the following:
• Enhanced performance over standard UDP communications — Real-time UDP
communication support requires a dedicated Ethernet card. Real-time applications
use real-time UDP blocks to send and receive UDP packets through the dedicated
Ethernet card. Standard UDP communication shares bandwidth with the link
between the development and target computers.
• Flexible configuration — Real-time UDP communication supports variable lengths
and variable numbers of packets. Standard UDP communication also supports
variable lengths, but only one packet at a time.
IP fragmentation is not supported in Simulink Real-Time UDP blocks. The packet
payload is limited to 1472 bytes (1500 bytes UDP packet size − 28 bytes combined
packet header size).
Before you start, verify that you have a dedicated Ethernet card on your target computer.
A dedicated Ethernet card is to be used only for real-time UDP communications, and not
for a link between the development and target computers. This requirement means that
your target computer must have at least two Ethernet cards, one for the link between
the development and target computers, and one for real-time UDP communications.
For a list of supported Ethernet chip families, see What Is Model-Based Ethernet
Communications?.
8-2
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Blocks — Alphabetical List
Blocks — Alphabetical List
Real-Time UDP Configuration
Receive
Send
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
8-3
8
Real-Time UDP Communication Support
Real-Time UDP Configuration
Configure network interface for real-time UDP communication
Library
Simulink Real-Time for Real-Time UDP
Description
The Real-Time UDP Configuration block configures the network for real-time UDP
operation.
IP fragmentation is not supported in Simulink Real-Time UDP blocks. The packet
payload is limited to 1472 bytes (1500 bytes UDP packet size − 28 bytes combined packet
header size).
Block Parameters
Device ID
From the list, select a unique integer to identify the Ethernet board. Use this ID to
associate the other UDP blocks with this board.
IP Address
Enter the IP address for the interface.
Subnet Mask
Enter the subnet mask for the interface.
Gateway
Enter the gateway address for the interface.
Ethernet Driver
Identifies the driver for each chip family supported. Possible values are Intel
8255X and Intel Gigabit.
PCI Bus
8-4
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Real-Time UDP Configuration
Enter the PCI bus number for the Ethernet card.
PCI Slot
Enter the PCI slot number for the Ethernet card.
See Also
Receive, Send
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
8-5
8
Real-Time UDP Communication Support
Receive
Receive data over UDP network on a dedicated network interface
Library
Simulink Real-Time for Real-Time UDP
Description
The Receive block receives UDP data on the specified local (destination) port. To receive
all data sent to this port, set Source IP address to 0.0.0.0, otherwise set Source IP
address to a valid IP address.
IP fragmentation is not supported in Simulink Real-Time UDP blocks. The packet
payload is limited to 1472 bytes (1500 bytes UDP packet size − 28 bytes combined packet
header size).
Block Outputs
Name
Description
Data
Vector of uint8 containing data received
N
Number of new bytes received, and
otherwise 0
The default block behavior is to keep the previous output when there is no new data.
Block Parameters
Device ID
From the list, select a unique number to identify the Ethernet board. Select the same
Device ID as the one you selected for the Real-Time UDP Configuration block.
Source IP address
8-6
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Receive
Enter a valid IP address as a dotted decimal string, for example, 10.10.10.3. You
can also use a MATLAB expression that returns a valid IP address as a string. With
Local (destination) port, this parameter defines the source address.
The default address, 0.0.0.0, causes the block to accept UDP packets from any
accessible computer. If set to a specific IP address, packets arriving from only that IP
address are received.
Local (destination) port
Specify the port of the computer or device from which to receive the UDP packets.
With Source IP address, this parameter defines the source address.
Output port width
Enter the output port width.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
See Also
Real-Time UDP Configuration, Send
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
8-7
8
Real-Time UDP Communication Support
Send
Send data over UDP network on a dedicated network interface
Library
Simulink Real-Time for Real-Time UDP
Description
The Send block sends UDP packets from Local (source) port to Destination port. To
broadcast to all devices, set Destination IP address to 255.255.255.255, otherwise
set Destination IP address to a valid IP address.
IP fragmentation is not supported in Simulink Real-Time UDP blocks. The packet
payload is limited to 1472 bytes (1500 bytes UDP packet size − 28 bytes combined packet
header size).
Block Inputs
Name
Description
Data
Vector of uint8 containing data to send
N
Number of bytes to send
Block Parameters
Device ID
From the list, select a unique number to identify the Ethernet board. Select the same
Device ID as the one you selected for the Real-Time UDP Configuration block.
Destination IP address
Specify the IP address of the computer or other device to which you want to send the
UDP packets. To broadcast the packets to all listening computers or devices, enter
8-8
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Send
255.255.255.255. With Destination port, this parameter defines the destination
address.
Destination port
Specify the computer port to which you want to send the UDP packets. With
Destination IP address, this parameter defines the destination address.
Local (source) port
Specify the target computer port from which you want to send the UDP packets.
Enter -1 to automatically assign a port for the target computer.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
See Also
Real-Time UDP Configuration, Receive
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
8-9
‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ | ‪www.MatlabSite.com‬‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
9
IP Library for Real-Time UDP
Communication Support
• “Low-Level Internet Protocol Library” on page 9-2
• “Blocks — Alphabetical List” on page 9-3
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
9
IP Library for Real-Time UDP Communication Support
Low-Level Internet Protocol Library
The Internet Protocol (IP) library contains blocks specific to the low-level management
of the UDP network. The blocks in this sublibrary are core blocks that you might want
to use to create other subsystems. However, the top-level real-time UDP blocks provide
enough functionality for real-time UDP communications. To access the low-level blocks,
type xpciplib in the MATLAB Command Window.
9-2
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Blocks — Alphabetical List
Blocks — Alphabetical List
UDP Consume
UDP Produce
UDP Rx
UDP Tx
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
9-3
9
IP Library for Real-Time UDP Communication Support
UDP Consume
Consume a UDP packet
Library
Simulink Real-Time Library for IP
Description
The UDP Consume block outputs a network buffer with raw data that you can output to
a Network Buffer library block. To create this output, the block:
1
Receives as input a network buffer that contains a UDP header.
2
Removes the UDP header.
3
Outputs the updated network buffer.
The block has two output ports:
• Buffers
Chain of network buffers.
• Chain size
Number of buffers on the chain.
Block Parameters
IP Group
Enter a number in the range 0 to 7. This value identifies the IP Init block inside the
Real-Time UDP Configuration subsystem that is associated with this block.
Output port width
Enter the width of the port. A value other than 0 creates the following output ports:
• Source IP Address
9-4
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
UDP Consume
• Destination IP Address
• Local UDP Port
• Remote UDP Port
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
9-5
9
IP Library for Real-Time UDP Communication Support
UDP Produce
Produce UDP packet by adding a UDP header to the input data
Library
Simulink Real-Time Library for IP
Description
The UDP Produce block receives a network buffer and adds a header to that buffer. It
then outputs that updated buffer.
Block Parameters
IP Group
Enter a number in the range 0 to 7. This value identifies the IP Init block inside the
Real-Time UDP Configuration subsystem that is associated with this block.
IP address to send to (255.255.255.255 for broadcast)
Specify IP address of the computer to which to send the UDP packets. To broadcast
the packets to all listening computers or devices, enter 255.255.255.255. With
Remote IP port to send to, this parameter defines the destination address.
Remote IP port to send to
Specify the computer port to which to send the UDP packets. With IP address to
send to (255.255.255.255 for broadcast), this parameter defines the destination
address.
Use the following local IP port (-1 for automatic assignment)
Specify the target computer port from which to send the UDP packets.
Enter -1 to automatically assign a port for the target computer.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
9-6
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
UDP Rx
UDP Rx
Receive UDP packet
Library
Simulink Real-Time Library for IP
Description
The UDP Rx block outputs a network buffer with a UDP header.
Block Parameters
IP Group
Enter a number in the range 0 to 7. This value identifies the IP Init block inside the
Real-Time UDP Configuration subsystem that is associated with this block.
IP address to receive from (0.0.0.0 for accepting all)
Enter a valid IP address as a dotted decimal string. For example, 10.10.10.3. You
can also use a MATLAB expression that returns a valid IP address as a string. With
IP port to receive from, this parameter defines the source address.
The default address, 0.0.0.0, enables the acceptance of all UDP packets from any
accessible computer. If set to a specific IP address, only packets arriving from that IP
address are received.
IP port to receive from
Specify the port of the computer or device from which to receive the video frames.
With IP address to receive from (0.0.0.0 for accepting all), this parameter
defines the source address.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
9-7
9
IP Library for Real-Time UDP Communication Support
UDP Tx
Transmit UDP packet
Library
Simulink Real-Time Library for IP
Description
The UDP Tx block receives a network buffer with a UDP header and sends it.
Block Parameters
IP Group
Enter a number in the range 0 to 7. This value identifies the IP Init block inside the
Real-Time UDP Configuration subsystem that is associated with this block.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
9-8
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
10
UDP I/O Support
• “User Datagram Protocol (UDP)” on page 10-2
• “UDP Transport Protocol” on page 10-3
• “Two-Way Data Exchange Using UDP” on page 10-6
• “UDP Communication Setup” on page 10-11
• “UDP and Variable-Size Signals” on page 10-12
• “Boards and Blocks — Alphabetical List” on page 10-14
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
10
UDP I/O Support
User Datagram Protocol (UDP)
The Simulink Real-Time software supports communication from the target computer
to other systems or devices using User Datagram Protocol (UDP) packets. UDP is a
transport protocol similar to TCP. However, unlike TCP, UDP provides a direct method
to send and receive packets over an IP network. UDP uses this direct method at the
expense of reliability by limiting error checking and recovery.
10-2
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
UDP Transport Protocol
UDP Transport Protocol
The User Datagram Protocol (UDP) is a transport protocol layered on top of the Internet
Protocol (IP). It is commonly known as UDP/IP. It is analogous to TCP/IP. A convenient
way to present the details of UDP/IP is by comparison to TCP/IP:
• Connection Versus Connectionless — TCP is a connection based protocol, while UDP
is a connectionless protocol. In TCP, the two ends of the communication link must
be connected throughout the communication. An application using UDP prepares
a packet and sends it to the receiver's address without first checking to see if the
receiver is ready to receive a packet. If the receiving end is not ready to receive a
packet, the packet is lost
• Stream Versus Packet — TCP is a stream-oriented protocol, while UDP is a packetoriented protocol. This means that TCP is considered to be a long stream of data that
is transmitted from one end to the other with another long stream of data flowing in
the other direction. The TCP/IP stack is responsible for breaking the stream of data
into packets and sending those packets while the stack at the other end is responsible
for reassembling the packets into a data stream using information in the packet
headers. UDP, on the other hand, is a packet-oriented protocol where the application
itself divides the data into packets and sends them to the other end. The other end
does not have to reassemble the data into a stream. Note, some applications might
indeed present the data as a stream when the underlying protocol is UDP. However,
this is the layering of an additional protocol on top of UDP, and it is not something
inherent in the UDP protocol itself.
• TCP Supports Error Detection — The packets that are sent by TCP contain a unique
sequence number. The starting sequence number is communicated to the other side
at the beginning of communication. Also, the receiver acknowledges each packet,
and the acknowledgment contains the sequence number so that the sender knows
which packet was acknowledged. This implies that packets lost on the way can be
retransmitted (the sender would know that they did not reach their destination
because it had not received an acknowledgments). Also, packets that arrive out of
sequence can be reassembled in order by the receiver.
Further, timeouts can be established, because the sender will know (from the first few
packets) how long it takes on average for a packet to be sent and its acknowledgment
received. UDP, on the other hand, simply sends the packets and does not keep track
of them. Thus, if packets arrive out of sequence, or are lost in transmission, the
receiving end (or the sending end) cannot know.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
10-3
10
UDP I/O Support
TCP communication can be compared to a telephone conversation where a continuous
connection is required and two-way streaming data (the words spoken by each party to
the conversation) are exchanged. UDP, on the other hand, can be compared to sending
letters by mail (without a return address). If the other party is not found, or the letter is
lost in transit, it is simply discarded. The analogy fails, however, when considering the
speed of communication. Both TCP and UDP communication roughly happen at the same
speed, because both use the underlying Internet Protocol (IP) layer.
Note: Reliable is used in the sense of “not guaranteed to succeed” as opposed to “succeeds
all of the time”. Unreliable is used in the sense of “may fail (packets may not arrive)
without the application being aware that the packet did not arrive” as opposed to
“fails most of the time.” In practice, UDP will continue receiving packets as long as the
receiving socket is active and is processing data as quickly as it arrives.
UDP was chosen as the Simulink Real-Time transport layer because of its lightweight
nature. Since the primary objective of an application running in the Simulink Real-Time
framework is real-time, the lightweight nature of UDP gives the real-time application a
good chance of succeeding in real-time execution. Also, the datagram nature of UDP is
good for sending samples of data from the application generated by the Simulink Coder
software. Because TCP is stream oriented, separators between sets of data must be
used for the data to be processed in samples. It is easier to build an application to deal
with unreliable data than it is to decode data in real time. If the application is unable to
process the data as quickly as it arrives, the following packets can just be ignored and
only the most recent packet can be used.
Communication can involve a packet made up of Simulink data types such as double,
int8, int32, uint8, or a combination of these. The Simulink Real-Time block library
provides blocks for combining various signals into one packet (packing), and then
transmitting it. It also provides blocks for splitting a packet (unpacking) into its
component signals that can then be used in a Simulink model. The maximum size of a
packet is limited to about 1450 bytes.
The UDP blocks work in the background when the real-time application is not running.
The UDP communication has been set up to have a maximum of two UDP packets
waiting to be read. This applies to one UDP port, which corresponds to one UDP Receive
block. Subsequent packets are rejected. This prevents excessive memory usage and
minimizes the load on the TCP/IP stack. Consequently, when a large background task
is performed, such as uploading a screen shot or communicating large pages through
10-4
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
UDP Transport Protocol
the WWW interface, packet loss might occur. Design applications so that the receipt of
further packets after the ones that were lost bridges gaps. .
Note also that because UDP block transfers operate as background tasks, the Simulink
Real-Time software disables them in polling mode. See “Restrictions on Single- and
Multicore Processors”.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
10-5
10
UDP I/O Support
Two-Way Data Exchange Using UDP
This section provides an example of how to set up two-way data exchange between two
Simulink Real-Time systems, between the Simulink Real-Time and Simulink products,
or between two Simulink models. When one or both of the systems is running as a nonreal-time Simulink model, be sure to set the sample time.
Note: To use UDP for your Simulink Real-Time system, be sure to create a TCP/IP boot
disk and boot the target computer with that boot disk.
The hypothetical models are called udpsendreceiveA and udpsendreceiveB.
Two different sets of data are transferred between these two models, one set from
udpsendreceiveA to udpsendreceiveB and another set in the opposite direction.
The data to transfer is in the following order:
udpsendreceiveA to udpsendreceiveB
• uint8 (3x3)
• uint16 (1x1)
• double (2x4)
udpsendreceiveB to udpsendreceiveA
• single (4x1)
• double (2x2)
• uint32 (2x2)
• int8 (5x3)
For the purposes of this example, the inputs are generated using Simulink Constant
blocks that use the MATLAB random number function (rand). The Simulink Coder
software uses this function at the time of code generation to generate random numbers.
To generate the vector of uint8 (3x3), use the MATLAB function
uint8(255 * rand(3,3))
since 255 is the maximum value for an unsigned 8-bit integer. The other values are
generated similarly.
10-6
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Two-Way Data Exchange Using UDP
With this setup, construct the send side of udpsendreceiveA.
Note that the width of the UDP packet to be sent is 75 bytes. The parameters used in
the Pack block are Input port datatypes {'uint8','uint16','double'} and Byte
Alignment 1.
For the Send block, set the IP Address to send to parameter to 192.168.0.11. This is
the hypothetical address of the system that will run udpsendreceiveA. Set the IP Port
to send to parameter to 25000 (picked arbitrarily). The sample time is set to 0.01.
Use this information to construct the receive end of udpsendreceiveB.
For setting up the Receive block, set IP address to receive from to 192.168.0.10
(the hypothetical address of the system that will run udpsendreceiveB). The IP
port to receive from is set to 25000 (the same value as set in the Remote IP port
to send to parameter of the Send block in udpsendreceiveA). The Output port
width is set to 75, which is obtained from the output port width of the Pack block in
udpsendreceiveA.
For the Unpack block, Byte Alignment is set to 1 and the Output port datatypes
is set to {'uint8','int16','double'} from the Pack block in udpsendreceiveA.
The Output port dimensions is set to {[3 3],1,[2 4]} from the dimensions of the
inputs to the Pack block in udpsendreceiveA.
Note that in udpsendreceiveB, the second output port of the Receive block is sent into
a terminator. You can use this to determine when a packet has arrived. The same is true
for the outputs of the Unpack block, which in a real model would be used in the model.
To construct the udpsendreceiveB to udpsendreceiveA side of the communication,
follow an analogous procedure. The final udpsendreceiveA is shown below.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
10-7
‫‪UDP I/O Support‬‬
‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ | ‪www.MatlabSite.com‬‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
‫‪10‬‬
‫‪10-8‬‬
Two-Way Data Exchange Using UDP
The following table lists the parameters in udpsendreceiveA.
Block
Parameter
Value
Receive
IP address
192.168.0.11
IP port
25000
Output port width
80
Sample time
0.01
Output port dimensions
{4,[2 2],[2 2],[5 3]}
Output port data types
{'single','double',
'uint32','int8'}
Byte alignment
2
Unpack
The final udpsendreceiveB model is shown below.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
10-9
10
UDP I/O Support
The following table lists the parameters in udpsendreceiveB.
Block
Parameter
Value
Pack
Input port data types
{'single','double',
'uint32','int8'}
Byte alignment
2
IP address
192.168.0.10
IP port
25000
Sample time
0.01
Send
10-10
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
UDP Communication Setup
UDP Communication Setup
The infrastructure provided in the Simulink Real-Time Library for UDP communication
consists mainly of two blocks — a Send block and a Receive block. These blocks are in
the Simulink Real-Time Library, available from the Simulink Library under Simulink
Real-Time. You can also access them from the MATLAB command line by typing
slrtlib
The blocks are located under the UDP heading in the library. The Send block takes as
input a vector of type uint8, which it sends. This is limited to a length of about 1450
bytes (i.e., a 1 by 1450 vector). Similarly, the Receive block outputs a vector of uint8. To
convert arbitrary Simulink data types into this vector of uint8, a Pack block is provided,
while an Unpack block is provided to convert a vector of uint8s back into arbitrary
Simulink data types.
You can have up to 32 UDP blocks in a model (Send and Receive blocks combined in
arbitrary order).
The Simulink Real-Time block library includes a Byte Reversal block for communication
with big-endian architecture systems. You do not need this block if you are
communicating between 80x86-based computer systems running either the Simulink
Real-Time or Microsoft® Windows software.
The blocks are set up to work both from within the Simulink environment and from
an application running under the Simulink Real-Time system. However, you must be
careful when using a Simulink simulation and a Simulink Real-Time application to
communicate, or when using two Simulink models. This is because a Simulink model
is not a real-time model and can run several times faster or slower than a real-time
application. The sample time of the send and receive blocks and the sample time of the
Simulink model must be set so that the blocks can communicate.
Note the following:
• Your model cannot have two UDP Receive blocks configured with the same receive
port, for example, the same receive port and different IP addresses.
• Your model cannot have two UDP Send blocks configured with the same send (not -1)
port, for example, the send port and different IP addresses.
See the UDP Data Streaming example for a example of how to perform UDP data
streaming with the Simulink Real-Time system.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
10-11
10
UDP I/O Support
UDP and Variable-Size Signals
The Simulink Real-Time UDP sublibrary does not directly support variable-size signals.
Of particular note, the UDP Send block input port accepts only fixed-size signals. This
topic describes a workaround.
To send variable-size signals though UDP in a real-time application, select the Allow
variable length packets parameter of the UDP Send block. This check box creates
a second input for the block. With this second input, you can specify the number of
elements of the fixed-size input signal to send through UDP.
Consider the following example. This example configures the MATLAB Function block
to accept a variable-size signal and maps that signal to a fixed-size output signal. It also
outputs the number of relevant elements. You can the output the fixed-size output signal
and number of elements to the inputs of the UDP Send block.
• Create an MATLAB Function block to accept a variable-size input signal.
• Enter code like the following in the MATLAB Function block. In this code, the
maximum size of the variable-size input signal is 9.
function [y,y_length] = fcn(u)
%#codegen
y = uint8(zeros(9,1));
y_length = length(u);
for a = 1:y_length
y(a) = u(a);
end
• In the MATLAB Function Editor, select Tools > Edit Data/Ports. In Ports and
Data Manager, select the data u, then select the corresponding Variable size check
box.
• Select the data y and enter the size of the variable-size data input signal in the
corresponding Size parameter. For this example, the size value is 9.
• Provide a variable-size signal source for the MATLAB Function block.
10-12
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
UDP and Variable-Size Signals
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
10-13
10
UDP I/O Support
Boards and Blocks — Alphabetical List
10-14
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
UDP Receive
UDP Receive
Receive UDP packets over the Ethernet link between development and target computers
Library
Simulink Real-Time Library for Legacy UDP
Description
The UDP Receive receives a byte stream (represented as a vector of uint8 values) from
the UDP board. Use the Byte Unpacking block to convert from the vector of uint8 values
to the signal data type. See the UDP Data Streaming example for a example of how to
use the Byte Unpacking block to extract your data.
IP fragmentation is not supported in Simulink Real-Time UDP blocks. The packet
payload is limited to 1472 bytes (1500 bytes UDP packet size − 28 bytes combined packet
header size).
Block Outputs
Name
Description
Data
Vector of uint8 containing data received
N
Number of new bytes received, and
otherwise 0
The default block behavior is to keep the previous output when there is no new data.
Block Parameters
IP address to receive from
Enter a valid IP address as a dotted decimal string. For example, 10.10.10.3. You
can also use a MATLAB expression that returns a valid IP address as a string.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
10-15
10
UDP I/O Support
Can be left with the default value of 0.0.0.0. This accepts all UDP packets from any
accessible computer. If set to a specific IP address, only packets arriving from that IP
address are received.
IP port to receive from
Receiver port that the block accepts data from. The other end of the communication
sends data to the port specified here. This value must match the Remote IP port to
send to parameter of the UDP Send block
Output port width
Width of the acceptable packets, in bytes. You can obtain this number when
designing the other side (send side) of the communication. If you select Allow variable
length packets, this parameter defines the maximum length of the message.
If Allow variable length packets is cleared, the block receives only packets of
Output port width length. It discards the other packets.
Allow variable length packets
Select this check box to enable the reception of variable length messages. The value
of Output port width defines the maximum length of the message. If this check box
is selected, the first output port sends the actual data. If the port size is less than the
size of the actual data, the block sends up to the allowed length of data. It discards
the extra data. The UDP Receive block does not return the number of discarded
bytes. The behavior of the second output port depends on what environment the block
is in:
• If the block is in the Simulink Real-Time environment, the second output port
sends the length of the original incoming message, m.
• If the block is in the Simulink environment, the second output port sends the size
of the first output port +1.
If this check box is cleared (default), the first output port contains the actual data,
and the second output port contains:
• 1, if the block receives the packet.
• 0, if the block does not receive the packet.
Sample time
You can set this parameter to -1 for an inheritable sample time, but you should set
this parameter to some specific (small) value to eliminate chances of dropped packets.
This is especially true when you are using a small base sample time.
10-16
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
UDP Receive
See Also
UDP Send
Byte Unpacking
UDP Data Streaming
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
10-17
10
UDP I/O Support
UDP Send
Send UDP packets over the Ethernet link between development and target computers
Library
Simulink Real-Time Library for Legacy UDP
Description
The UDP Send block sends a byte stream (represented as a uint8 vector) to the UDP
board. Use the Byte Packing block to convert from the signal data type to a single vector
of uint8 values. See the UDP Data Streaming example for a example of how to use the
Byte Packing block to convert your data to a uint8 vector.
IP fragmentation is not supported in Simulink Real-Time UDP blocks. The packet
payload is limited to 1472 bytes (1500 bytes UDP packet size − 28 bytes combined packet
header size).
Block Inputs
Name
Description
Data
Vector of uint8 containing data to send
Block Parameters
IP address to send to
Specify the IP address to send the packet. Enter a valid IP address as a dotted
decimal string. For example, 10.10.10.3. You can also use a MATLAB expression
that returns a valid IP address as a string.
Remote IP port to send to
Specify the port to which to send the packet. This value must match the IP port to
receive from parameter of the UDP Receive block
10-18
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
UDP Send
Use the following local IP port
Set this parameter to -1 (default) to allow the networking stack to automatically
determine the local IP port that is used for sending. Otherwise, specify a particular
port to send a packet from that port.
Allow variable length packets
Select this check box to enable the sending of variable length messages. Selecting this
check box enables a second input port.
The width of the first signal entering the first input port specifies the maximum
length of the input message. If this check box is selected, the first input port receives
the actual data, and the second input port receives the actual length of the message.
If this check box is cleared, the block sends all the data each time.
Sample time
You can set this parameter to -1 for an inheritable sample time, but you should set
this parameter to some specific (large) value to eliminate chances of dropped packets.
This is especially true when you are using a small base sample time.
See Also
Byte Packing
UDP Receive
UDP Data Streaming
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
10-19
‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ | ‪www.MatlabSite.com‬‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Parallel Ports, J1939, Shared Memory
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ | ‪www.MatlabSite.com‬‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
11
Parallel Ports
• “Using Parallel Ports” on page 11-2
• “Boards and Blocks — Alphabetical List” on page 11-5
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
11
Parallel Ports
Using Parallel Ports
In this section...
“Introduction” on page 11-2
“Using the Parallel Port as an Interrupt Source” on page 11-3
“Using Add-On Parallel Port Boards” on page 11-4
Introduction
Most target computers have a parallel port that you can use for a variety of devices. The
Simulink Real-Time block library provides blocks that enable you to use the parallel
ports of a target computer for digital input and output, and source interrupts.
Warning The parallel port is part of the motherboard on many computers. Be careful
when configuring the port and connecting external hardware to the port. Incorrect
connections to the port might damage your computer.
The Simulink Real-Time parallel port blocks assume that the connector to the parallel
port has one 25-pin connector whose pins have the following designations:
• Eight data pins
• Five status pins
• Four control pins
• Eight ground pins
Function
Channel
1
2
3
4
5
6
7
8
Bit
0
1
2
3
4
5
6
7
Digital Input
02
03
04
05
06
07
08 09
Digital Output
02
03
04
05
06
07
08 09
Digital Input (Status)
15
13
12
10
11
Digital Output (Control) 01
14
16
17
Interrupt
11-2
Additional Pins
10
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Using Parallel Ports
C0
1
D0
2
D1
3
D2
4
D3
5
D4
6
D5
7
D6
8
D7
9
S6
10
S7
11
S5
12
S4
13
14 C1
15 S3
16 C2
17 C3
18 Gnd
19 Gnd
20 Gnd
21 Gnd
22 Gnd
23 Gnd
24 Gnd
25 Gnd
Using the Parallel Port as an Interrupt Source
To use the parallel port as an interrupt source, use pin 10 of the parallel port as the
interrupt source. Configure the Simulink Real-Time model as follows:
1
Select Simulation > Model Configuration Parameters.
2
Under node Code Generation, select node Simulink Real-Time Options.
3
In the Execution options pane:
• From Execution mode, select Real-Time.
• From Real-time interrupt source, select the IRQ level (typically 7).
• From I/O board generating the interrupt, select Parallel_Port.
• In PCI slot (-1: autosearch) or ISA base address, enter the base address of
the parallel port (typically 0x378).
If you want to use the Async IRQ Source block, you do not have to configure the model.
Instead, you can set the Async IRQ Source block parameters as follows:
• IRQ line number — Select the IRQ level (typically 7).
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
11-3
11
Parallel Ports
• I/O board generating the interrupt — Select Parallel_Port.
• PCI slot — Enter the base address of the parallel port (typically 0x378).
Using Add-On Parallel Port Boards
To use an add-on parallel port board with the parallel port blocks, configure the base
address for the board as follows:
1
To get the base address of a board, in the MATLAB Command Window, call the
function SimulinkRealTime.target.getPCIInfo with the 'verbose' option.
For example
tg = slrt;
getPCIInfo(tg, 'verbose')
2
Identify the base address for the add-on parallel port board.
3
In your model, open the parallel port block and set the value of the Base address
parameter to Other.
The Alternate base address parameter is displayed.
4
In the Alternate base address parameter, enter the base address you identified in
step 2.
5
Configure the rest of the block as desired.
Note: You cannot use add-on parallel port boards as interrupt sources. You also cannot
trigger the execution of a model with these boards.
11-4
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Boards and Blocks — Alphabetical List
Boards and Blocks — Alphabetical List
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
11-5
11
Parallel Ports
Parallel Port Digital Input
Parallel Port Digital Input block
Library
Simulink Real-Time Library for Parallel Port
Scaling Input to Output
Hardware Input
Block Output Data Type
Scaling
TTL
Double (Format:8 1-bit
Channels)
Double:
TTL low = 0.0
TTL high = 1.0
uint8 (Format:One 8-bit
Port)
uint8:
TTL low corresponding bit is
clear
TTL high corresponding bit
is set
Block Parameters
Base address
Select a parallel port base address. This address depends on the computer BIOS.
From the list, select one of the following. If your base address is not one of the
supplied standard base addresses, select Other and enter your base address in
Alternate base address.
• 0x3bc
• 0x378
• ox278
• Other
11-6
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Parallel Port Digital Input
Alternate base address
Enter an alternate parallel port base address, in hexadecimal. This parameter
appears only if you select Other for Base address. For example,
0x300
Format
From the list, select one of the following modes to specify how to treat data:
• 8 1–bit Channels
Treats data as individual bits. Configures block to accept up to eight 1-bit
channels.
• One 8–bit Port
Treats data as a single byte. Configures block to accept one 8-bit port.
Channels
Enter a vector of numbers between 1 and 8. This parameter appears only if you select
8 1–bit Channels for Format. For example,
[1, 3]
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
11-7
11
Parallel Ports
Parallel Port Digital Input Status Bits
Parallel Port Digital Input Status Bits block
Library
Simulink Real-Time Library for Parallel Port
Scaling Input to Output
Hardware Input
Block Output Data Type
Scaling
TTL
Double (Format:5 1-bit
Channels)
Double:
TTL low = 0.0
TTL high = 1.0
uint8 (Format:One 5-bit
Port)
uint8:
TTL low corresponding bit is
clear
TTL high corresponding bit
is set
Block Parameters
Base address
Select a parallel port base address. This address depends on the computer BIOS.
From the list, select one of the following. If your base address is not one of the
supplied standard base addresses, select Other and enter your base address in
Alternate base address.
• 0x3bc
• 0x378
• ox278
• Other
11-8
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Parallel Port Digital Input Status Bits
Alternate base address
Enter an alternate parallel port base address, in hexadecimal. This parameter
appears only if you select Other for Base address. For example,
0x300
Format
From the list, select one of the following modes to specify how to treat data:
• 5 1–bit Channels
Treats data as individual bits. Configures block to accept up to five 1-bit channels.
• One 5–bit Port
Treats data as a single byte. Configures block to accept one 5-bit port.
Channels
Enter a vector of numbers between 1 and 5. This parameter appears only if you select
5 1–bit Channels for Format. For example,
[1, 3]
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
11-9
11
Parallel Ports
Parallel Port Digital Output
Parallel Port Digital Output block
Library
Simulink Real-Time Library for Parallel Port
Scaling Output to Input
Hardware Output
Block Input Data Type
Scaling
TTL
Double (Format:8 1-bit
Channels)
Double:
< 0.5 = TTL low
> 0.5 = TTL high
uint8 (Format:One 8-bit
Port)
uint8:
Bit clear = TTL low
Bit set = TTL high
Block Parameters
Base address
Select a parallel port base address. This address depends on the computer BIOS.
From the list, select one of the following. If your base address is not one of the
supplied standard base addresses, select Other and enter your base address in
Alternate base address.
• 0x3bc
• 0x378
• ox278
• Other
Alternate base address
11-10
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Parallel Port Digital Output
Enter an alternate parallel port base address, in hexadecimal. This parameter
appears only if you select Other for Base address. For example,
0x300
Format
From the list, select one of the following modes to specify how to treat data:
• 8 1–bit Channels
Treats data as individual bits. Configures block to accept up to eight 1-bit
channels.
• One 8–bit Port
Treats data as a single byte. Configures block to accept one 8-bit port.
Channels
Enter a vector of numbers between 1 and 8. This parameter appears only if you select
5 1–bit Channels for Format. For example,
[1, 3]
Initial value vector
The initial value vector contains the initial voltage values for the output channels.
Enter a scalar or a vector that is the same length as the channel vector. If you specify
a scalar value, that value is replicated as the initial value over the channel vector.
The channels are set to the initial values between the time the model is downloaded
and the time it is started.
Final action vector
The final action vector controls the behavior of the channel at model termination.
Enter a scalar or a vector that is the same length as the channel vector. If you specify
a scalar value, that setting is replicated over the channel vector. If you specify a
value of 1, the corresponding channel is reset to the value specified in the initial
value vector. If you specify a value of -1, the block sets the channel to the value
specified in the Final value vector value for that channel. If you specify a value of
0, the channel remains at the last value attained while the model was running.
Final value vector
The final value vector contains the final value for each output channel. Enter a scalar
or a vector that is the same length as the channel vector. If you specify a scalar value,
that setting is replicated over the channel vector. If the Final action vector is -1,
the block sets the channel to this value on model termination.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
11-11
11
Parallel Ports
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
11-12
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Parallel Port Digital Output Control Bits
Parallel Port Digital Output Control Bits
Parallel Port Digital Output Control Bits block
Library
Simulink Real-Time Library for Parallel Port
Scaling Output to Input
Hardware Output
Block Input Data Type
Scaling
TTL
Double (Format:4 1-bit
Channels)
Double:
< 0.5 = TTL low
> 0.5 = TTL high
uint8 (Format:One 4-bit
Port)
uint8:
Bit clear = TTL low
Bit set = TTL high
Block Parameters
Base address
Select a parallel port base address. This address depends on the computer BIOS.
From the list, select one of the following. If your base address is not one of the
supplied standard base addresses, select Other and enter your base address in
Alternate base address.
• 0x3bc
• 0x378
• ox278
• Other
Alternate base address
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
11-13
11
Parallel Ports
Enter an alternate parallel port base address, in hexadecimal. This parameter
appears only if you select Other for Base address. For example,
0x300
Format
From the list, select one of the following modes to specify how to treat data:
• 4 1–bit Channels
Treats data as individual bits. Configures block to accept up to four 1-bit
channels.
• One 4–bit Port
Treats data as a single byte. Configures block to accept one 4-bit port.
Channels
Enter a vector of numbers between 1 and 4. This parameter appears only if you select
4 1–bit Channels for Format. For example,
[1, 3]
Initial value vector
The initial value vector contains the initial voltage values for the output channels.
Enter a scalar or a vector that is the same length as the channel vector. If you specify
a scalar value, that value is replicated as the initial value over the channel vector.
The channels are set to the initial values between the time the model is downloaded
and the time it is started.
Final action vector
The final action vector controls the behavior of the channel at model termination.
Enter a scalar or a vector that is the same length as the channel vector. If you specify
a scalar value, that setting is replicated over the channel vector. If you specify a
value of 1, the corresponding channel is reset to the value specified in the initial
value vector. If you specify a value of -1, the block sets the channel to the value
specified in the Final value vector value for that channel. If you specify a value of
0, the channel remains at the last value attained while the model was running.
Final value vector
The final value vector contains the final value for each output channel. Enter a scalar
or a vector that is the same length as the channel vector. If you specify a scalar value,
that setting is replicated over the channel vector. If the Final action vector is -1,
the block sets the channel to this value on model termination.
11-14
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Parallel Port Digital Output Control Bits
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
11-15
‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ | ‪www.MatlabSite.com‬‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
12
SAE J1939
• “SAE J1939 Blocks” on page 12-2
• “Blocks — Alphabetical List” on page 12-3
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
12
SAE J1939
SAE J1939 Blocks
The Simulink Real-Time J1939 blocks enable you to send and receive messages over a
CAN network using the SAE J1939 message protocol. Before you start, provide a J1939
database in .dbc format.
Note the following:
• Use the FIFO mode of the Softing CAN hardware with these blocks.
The J1939 I/O - Using Transport Protocol example illustrates the transmission
and reception of J1939 data. It uses a loopback connection of two CAN ports in a
single target computer. Note, the example requires a J1939 database file, C:\work
\J1939_demo.dbc, which the Simulink Real-Time software does not supply. You must
provide your own database file, which must contain the requested information outlined in
the example.
This topic assumes familiarity with the SAE J1939 specifications.
12-2
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Blocks — Alphabetical List
Blocks — Alphabetical List
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
12-3
12
SAE J1939
J1939 Controller Application
J1939 Controller Application
Library
Simulink Real-Time Library for J1939
Description
The J1939 Controller Application block supports address claiming. It enables the
dynamic exchange of address information with other nodes in the J1939 bus, resolving
conflicts. Once conflicts are resolved, the blocks on the CAN network each have unique
addresses and IDs.
Use this block to register your J1939 device on the CAN bus. Associate this block with
the J1939 Transmit Message and J1939 Receive Message blocks.
The block has two tab groups, General and NAME. The General tab contains general
block information. The NAME tab has ten parameters that, when combined, create a
unique identification address (NAME) for this J1939 device. Refer to the SAE J1939-81
and base SAE J1939 specifications for details.
Block Outputs
This block has the following output port:
Status output (Optional)
Outputs a status signal.
Current node address output (Optional)
Outputs current node address.
Block Parameters
General tab:
12-4
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
J1939 Controller Application
CA ID
Enter the controller application ID.
Protocol Stack ID
Enter the protocol stack ID.
Node address
From a range of 0 to 253, specify the node address of the node for which J1939
communication is to occur. This value is the source address for the J1939
communication. Set this address to the same as that in the J1939 Transmit Message
block.
Show status output
Select this check box to enable an output status signal.
Show current node address as output
Select this check box to enable an output current node address signal.
NAME tab:
Identity Number
Enter the identity number for the controller application. Use the identify number
provided by the ECU manufacturer.
Manufacturer Code
Enter the code of the electronic control unit (ECU) manufacturer.
ECU Instance
Enter a number to identify the particular ECU associated with Function.
If this number identifies the first or only instance, enter 0.
Function Instance
Enter a number to identify an instance of the function for the Vehicle System in the
CAN network.
Function
Enter an 8-bit value for the function for this controller application. See Appendix B of
the base SAE J1939 specification for a list of allowed function values.
If you enter a value between 0 and 127, the block independently evaluates the
function value.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
12-5
12
SAE J1939
If you enter a value greater than 127, the block takes into account the value of the
Vehicle System parameter when evaluating the function value.
Reserved
Reserved. Leave set to 0.
Vehicle System
Enter a 7-bit value for the vehicle system for this controller application. See
Appendix B of the base SAE J1939 specification for a list of allowed vehicle system
values.
Vehicle System Instance
Enter a number to identify an instance of the vehicle system in the CAN network.
If this number identifies the first or only instance, enter 0.
Industry Group
Enter a 3-bit value for the industry group for this controller application. See
Appendix B of the base SAE J1939 specification for a list of allowed industry group
values.
Arbitrary Address Capable
Select this check box to allow the controller application to resolve address claim
conflicts with arbitrary source addresses.
See Also
SAE J1939-81 specification
12-6
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
J1939 Database (CANdb) Setup
J1939 Database (CANdb) Setup
J1939 Database Setup
Library
Simulink Real-Time Library for J1939
Description
The J1939 Database Setup block is where you specify the user-supplied database for the
J1939 block set. Use one block per model.
Block Parameters
J1939 database file
Specify the J1939 database location and file name. For example, enter J1939.dbc if
the file is in the current folder; otherwise enter the full path with the file name, such
as C:\work\J1939.dbc.
This file defines the J1939 message set and is in a format defined by Vector
Informatik GmbH.
Note: You must supply the database file. The Simulink Real-Time software does not
supply this file.
J1939 Database Format
From the list, select:
• J1939 PG — Full Extended CAN ID
Specifies that the database format is the new version of CANdb. The block
extracts the Parameter Group Number (PGN) from the full extended CAN ID (29–
bit).
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
12-7
12
SAE J1939
• J1939 PG
Specifies that the database format is simplified ID (CANDB++ 2.7 SP7 and
before).
12-8
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
J1939 Message Trigger
J1939 Message Trigger
J1939 Message Triggering
Library
Simulink Real-Time Library for J1939
Description
The J1939 Message Trigger block triggers the transmission of a J1939 message under
conditions that the block specifies. When using this block in your model, connect its
Trigger Out port to the Trigger input port of the J1939 Transmit Message block. The
possible triggering conditions are:
• Nonzero input at the Trigger Message input port
• Expiration of the repetition interval
• A detected change in the input signal
Block Inputs
This block has the following input ports:
Trigger Message
Manually triggers the message transmission when the input value is 1.
Signal For Change Detection
Detects changes in the input.
Block Outputs
This block has the following output ports:
Trigger Out
Outputs an active signal when a condition for triggering a message occurs. Connect
this output to the Trigger input port of the J1939 Transmit Message block.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
12-9
12
SAE J1939
Block Parameters
Repeat on interval
Select this check box to enable periodic triggering at the interval specified in the
Repetition Interval parameter.
Repetition Interval (ms)
Specify the enabled repetition interval in milliseconds. The repetition interval must
be an integer multiple of the model update rate.
Send on a change in signal
Select this check box to enable triggering when both of the following are true:
• Input signal wired to the Signal For Change Detection port input port changes by
at least the value in the Minimum Change Threshold parameter.
• Specified time in the Minimum Change Interval parameter has expired.
Minimum Change Threshold (%)
Specify the threshold change to trigger a message. The trigger event is a change in
the input signal relative to the signal value from the previous triggering.
Minimum Change Interval (ms)
Specify the minimum time for the block to wait after a message transmission occurs
because of a change in the signal.
12-10
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
J1939 Protocol Stack
J1939 Protocol Stack
J1939 Protocol Stack instance
Library
Simulink Real-Time Library for J1939
Description
The J1939 Protocol Stack block defines a J1939 protocol stack instance that you
can associate with the CAN boards. This block is useful for the transmission and
reception of CAN data to or from the bus. For each selected CAN board, you must have a
corresponding CAN FIFO Setup block in the model. The protocol stack handles both the
regular J1939 communication and the (optional) Transport Protocol functionality. Use
this block with the J1939 Transmit Message and/or J1939 Receive Message blocks.
Block Parameters
General tab:
Protocol Stack ID
Enter the protocol stack ID.
Max CAN Message Receive (Per Sample Time)
Specify maximum number of CAN messages that the block can receive (process) in a
single sample time.
Max CAN Message Transmit (Per Sample Time)
Specify maximum number of CAN messages the block can send in a single sample
time.
Sample time
Specify the sample rate for the protocol stack.
Transport Protocol tab:
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
12-11
12
SAE J1939
Enable Transport Protocol
Select this check box to enable the transport protocol. Enabling the transport protocol
allows for the sending and receiving of J1939 data, whose size is greater than 8 bytes,
over the CAN bus.
Maximum Concurrent Sessions
Specify maximum transport protocol sessions that can be active at a given time.
Network Management tab
Enable Address Claiming
Select this check box to enable address claiming. Selecting this check box enables
J1939 Controller Application blocks to negotiate node addresses with other nodes on
the bus.
12-12
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
J1939 Receive Message
J1939 Receive Message
J1939 Receive Message
Library
Simulink Real-Time Library for J1939
Description
The J1939 Receive Message block receives a J1939 message. The J1939 database file
defines the message type. You specify the J1939 database with the J1939 Database
(CANdb) Setup block.
Block Outputs
Signal Output(s)
Depending on the J1939 message defined in the J1939 database file, the block can
have multiple output signal ports. If the bit length of a signal exceeds 32, the output
is a byte array; otherwise, the block output data type is double.
New Message Received (Optional)
Outputs 1 when a new message is received from the CAN bus; otherwise, outputs 0.
Block Parameters
PGN
From the list, select the parameter group number. The contents of this list vary
depending on the messages that the J1939 database file specifies.
CA ID
Specify the ID of the controller application that this block maps to. The ID must
match the CA ID value of the corresponding J1939 Controller Application block.
Source Address Filter (255:all)
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
12-13
12
SAE J1939
Specify the source node address from which the block is to expect messages. Type 255
to receive messages from any node.
Destination Address Filter
From the list, select the node destination of the expected message:
• global and specific
Receive all messages for all types of destination nodes.
• global only
Receive only broadcast messages.
• CA specific only
Receive only messages sent to this node.
Show 'New Message Received' output port
Select this check box to create a New Message Received output port.
12-14
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
J1939 Transmit Message
J1939 Transmit Message
J1939 Transmit
Library
Simulink Real-Time Library for J1939
Description
The J1939 Transmit Message block transmits a J1939 message The J1939 database
file defines the message type. You specify the J1939 database with the J1939 Database
(CANdb) Setup block.
Block Inputs
• Trigger
Enables the transmission of the message for that sample (a value of 1 indicates send,
a value of 0 indicates do not send).
• Signal Input(s)
Depending on the J1939 message defined in the J1939 database file, the block can
have multiple input signal ports. If the bit length of a signal exceeds 32, the input is a
byte array; otherwise, the block input data type is double.
Block Parameters
PGN
From the list, select the parameter group number. The contents of this list vary
depending on the messages that the J1939 database file specifies.
CA ID
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
12-15
12
SAE J1939
Identifies the controller application that this block maps to. The ID must match the
CA ID value of the corresponding J1939 Controller Application block.
Priority (0-7; highest to lowest
From a range of 0 to 7, specify the priority for the message transmission. 0 is the
highest, 7 is the lowest.
Destination Address (0–253 or 255)
Specify the node address of the destination node. Type 255 for broadcast.
Note: For message-oriented PGNs, this block ignores this parameter.
12-16
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
13
Shared Memory Support
This topic describes implementations of reflective (shared) memory by various
manufacturers.
• “GE Fanuc Embedded Systems Shared Memory” on page 13-2
• “Create GE Fanuc Shared Partitions” on page 13-3
• “Initialize GE Fanuc Shared Nodes” on page 13-5
• “GE Fanuc Shared Partition Structure” on page 13-7
• “GE Fanuc Shared Node Initialization Structure” on page 13-9
• “GE Intelligent Platforms Shared Memory” on page 13-14
• “Create GE Intelligent Platforms Shared Partitions” on page 13-15
• “Initialize GE Intelligent Platforms Shared Nodes” on page 13-18
• “GE Intelligent Platforms Shared Partition Structure” on page 13-20
• “GE Intelligent Platforms Shared Node Initialization Structure” on page 13-22
• “Curtiss-Wright Electronic Systems Shared Memory” on page 13-25
• “Create Curtiss-Wright Shared Partitions” on page 13-26
• “Initialize Curtiss-Wright Shared Nodes” on page 13-28
• “Curtiss-Wright Shared Partition Structure” on page 13-29
• “Curtiss-Wright Shared Node Initialization Structure” on page 13-34
• “Boards and Blocks — Alphabetical List” on page 13-39
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
13
Shared Memory Support
GE Fanuc Embedded Systems Shared Memory
Simulink Real-Time supports reflective (shared) memory boards manufactured by GE
Fanuc Embedded Systems (http://www.gefanucembedded.com/) – formerly VMIC.
13-2
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Create GE Fanuc Shared Partitions
Create GE Fanuc Shared Partitions
The Simulink Real-Time software uses a model for reflective memory (also known as
shared memory) that includes Simulink blocks for shared memory driver functions and
MATLAB structures to define node initialization and shared memory partitions. This
topic describes the Simulink Real-Time support of the GE Fanuc Embedded Systems
VMIPCI-5565 (formerly from VMIC) and PCI-5565PIORC boards. Both the VMIPCI-5565
and PCI-5565PIORC boards are fully supported and will be collectively referenced as
PCI-5565 in the documentation. The Simulink Real-Time library supports these boards
with the same set of blocks.
To use the Simulink Real-Time PCI-5565 shared memory blocks, you must define
shared memory partition structures. A partition structure describes how you want to
allocate (partition) the shared memory. The Simulink Real-Time software allocates
shared memory as segments of data that are packed into memory regions or partitions.
Along with the Shared Memory Pack and Shared Memory Unpack blocks, the following
PCI-5565 blocks use shared memory partition structures:
• GE Fanuc 5565 read
• GE Fanuc 5565 write
After defining the shared memory partitions, you can add PCI-5565 shared memory
driver blocks to your Simulink model. See “GE Fanuc Shared Partition Structure” on
page 13-7 for the complete list of fields in a partition.
The following description refers to the completepartitionstruct command. Type
help completepartitionstruct
for more information.
• Create a partition structure in one of the following ways. Using the
completepartitionstruct command at the MATLAB Command Window, create a
default partition structure. For example, type
Partition = completepartitionstruct([],'5565')
Partition =
Address: '0x0'
Type: 'uint32'
Size: '1'
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
13-3
13
Shared Memory Support
Alignment: '4'
Internal: [1x1 struct]
• At the MATLAB Command Window, create a user-defined partition structure. The
easiest way to do this is to create a script file, partially define a structure, load that
script into the MATLAB workspace, and supplement the resulting structure with a
call to the completepartitionstruct function. For example
Partition(1).Address='0x5000';
Partition(1).Type='int8';
Partition(1).Size='10';
Partition(2).Type='uint16';
Partition(2).Size='5';
Partition(3).Type='uint8';
Partition(3).Size='1';
Partition(3).Alignment='8';
Partition(4).Type='double';
Partition(4).Size='3';
This example defines a partition with four segments.
• The Address field is optional. Only specify this field for the first segment of a
partition. The elements of a partition are defined as a continuous memory block
from the first address. The function extrapolates segment addresses from the
first segment definition. If you have or require fragmented memory, use multiple
partitions.
• The Type and Size fields are required for all segments in the partition structure.
• The Alignment value is optional. It is '4' by default, which forces segments
that do not have alignment specifications to start on 4 byte (32 bit) boundaries.
In the preceding partition definition, the third segment (Partition(3)) has an
alignment of '8'.
• The base addresses of subsequent segments are defined by the data type, size, and
alignment of the preceding segment.
• Call the completepartitionstruct() command to fully populate the partition
structure.
Partition = completepartitionstruct(Partition,'5565');
13-4
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Initialize GE Fanuc Shared Nodes
Initialize GE Fanuc Shared Nodes
In addition to shared memory partitions, you must also define a node initialization
structure before using the PCI-5565 shared memory blocks. A node initialization
structure describes the shared memory partitions (see “Create GE Fanuc Shared
Partitions” on page 13-3) and the PCI-5565 board configuration, including interrupt
settings, if used. The following PCI-5565 block requires a shared memory node
initialization structure.
• GE Fanuc 5565 init
• GE Fanuc 5565 read
After defining the node initialization structure, you can add PCI-5565 shared memory
driver blocks to your Simulink model. See “GE Fanuc Shared Node Initialization
Structure” on page 13-9 for the complete list of fields in a node initialization
structure.
The following description refers to the completenodestruct command. Type
help completenodestruct
for more information.
• Create a node initialization structure in one of the following ways. Using the
completenodestruct command at the MATLAB Command Window, create a
default node initialization structure. For example, type
node=completenodestruct([],'5565')
node =
Interface: [1x1 struct]
Partitions: [1x1 struct]
• Now modify the structure fields to meet your requirements. For example:
node.Interface.NodeID = '128';
node.Partitions = Partition;
• A user-defined node structure, created with MATLAB code or from the MATLAB
Command Window and supplement the resulting structure with a call to the
completenodestruct function. For example:
node.Interface.NodeID = '128';
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
13-5
13
Shared Memory Support
node.Partitions = Partition;
node.completenodestruct(node,'5565');
13-6
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
GE Fanuc Shared Partition Structure
GE Fanuc Shared Partition Structure
You do not need to use all the fields of a partition initialization structure. However,
knowing the possible structure fields will be helpful when you are setting up to use
shared memory.
A shared memory partition structure has the following fields:
Address:
Type:
Size:
Alignment:
Internal:
'0x0'
'uint32'
'1'
'4'
[1x1 struct]
where
Partition Fields
Description
Address
Specifies the base address (in hexadecimal) of the memory partition
within the node's shared memory space. The default value is
'0x0', the first location in shared memory.
Align partition addresses on 32-bit word boundaries (for example,
0x0, 0x4, 0x8, and so forth).
Type
Specifies the data type of the memory segment. Specify one of the
following types:
• single (IEEE Single Precision)
• double (IEEE Double Precision)
• uint8
• int8
• uint16
• int16
• uint32
• int32
• Boolean (a single byte represents a boolean value)
The default value is 'uint32'. The minimum partition size is 32
bits.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
13-7
13
Shared Memory Support
Partition Fields
Description
Size
Specifies the dimension and size of the memory segment. You can
enter a scalar value or a value with the [m,n] format. The default
value is '1'.
• scalar — Treats the Size entry as the specification of the length
of a non-oriented array or vector
• [m,n] — Treats the Size entry as an array dimension. The
total number of elements in this segment is m*n.
13-8
Alignment
If another partition precedes this partition, defines the byte
alignment of this segment. Specify one of the following alignment
values: 1, 2, 3, 4, or 8. The default value is '4'. This value forces a
double word boundary alignment.
Internal
Reserved for internal use.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
GE Fanuc Shared Node Initialization Structure
GE Fanuc Shared Node Initialization Structure
A node initialization structure has the following fields:
Interface: [1x1 struct]
Partitions: [1x1 struct]
where
Node Structure Fields Description
Interface
Specifies how the board is configured. The Interface structure has
the following fields, three of which are structures:
• Mode — Configures board registers (see “Board Mode” on page
13-9)
• Interrupts — Enables the board to generate PCI interrupts
from network events that have been broadcast from other
nodes, or in response to error conditions (see “Board Interrupts”
on page 13-10)
• NodeID — Specifies the node ID for the board (see “Board Node
ID” on page 13-12)
• Internal — Reserved for internal use
Partitions
Stores the shared memory segments (see “Create GE Fanuc
Shared Partitions” on page 13-3)
Board Mode
The PCI-5565 board has a number of registers that you can set through the
Interface.Mode field. To display the board mode fields, type
>> node.Interface.Mode
ans =
StatusLEDOff:
TransmitterDisable:
DarkOnDarkEnable:
LoopbackEnable:
LocalParityEnable:
MemoryOffset:
MemorySize:
'off'
'off'
'off'
'off'
'off'
'0'
'64MByte'
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
13-9
13
Shared Memory Support
Note that mode values interact with the PCI-5565 board setting of the LSR1 (Local
Control and Status Register 1) and LIER (Local Interrupt Enable Register) registers.
Refer to the PCI-5565 product documentation for further details on these two registers.
To monitor the status of these modes, select the Error Status Port check box of the GE
Fanuc 5565 read or GE Fanuc 5565 write block.
Of particular note are the following modes:
Board Modes
Description
StatusLEDOff
Turns the PCI-5565 board status LED on and off. Setting this
value to 'off' turns off the LED when the Simulink Real-Time
model runs, setting this value to 'on' turns on the LED when the
Simulink Real-Time model runs. When the Simulink Real-Time
software terminates, the LED status reverses in both cases. The
default value is 'off'.
MemoryOffset
Applies a global offset to the network data transfers coming from
the PCI-5565 board. The following table lists offset values and the
resulting offset. The default value is '0'.
MemorySize
Specifies the minimum memory size required, in the format
'sizeMByte'.The PCI-5565 driver checks this value against the
memory size of the PCI-5565 board. If you enter a size in this field
that is larger than the actual PCI-5565 board memory size, the
driver will return an error.
This table lists the values for MemoryOffset:
Value
Offset Produced
'0'
0
'1'
0x4000000
'2'
0x8000000
'3'
0xC000000
Board Interrupts
The PCI-5565 board can generate PCI interrupts in response to network events that have
been broadcast from other nodes, or in response to error conditions. For example, you can
configure two Simulink Real-Time Simulink models, one as master, and one as a slave of
13-10
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
GE Fanuc Shared Node Initialization Structure
the broadcast node in the master Simulink Real-Time model. In such a configuration, the
broadcast node interrupt triggers the model's time steps.
To display the interrupt mode fields, type
>> node.Interface.Interrupts
ans =
LocalMemoryParity:
MemoryWriteInhibited:
LatchedSyncLoss:
RXFifoFull:
RXFifoAlmostFull:
BadData:
PendingInit:
RoguePacket:
ResetNodeRequest:
PendingInt3:
PendingInt2:
PendingInt1:
'off'
'off'
'off'
'off'
'off'
'off'
'off'
'off'
'off'
'off'
'off'
'off'
Each field corresponds to a bit in the LIER register of the PCI-5565 board. Each bit
enables the specified interrupt source on the PCI-5565 board. Refer to the PCI-5565
product documentation for further details on this register.
To enable a node to generate a network interrupt source, add the 5565 broadcast block
to a model (for example, the master model). This block issues network interrupts at the
model sample rate. Correspondingly, to enable other nodes of the network (for example,
the slaves) to accept broadcast interrupts from the model, configure the slave model to
expect the broadcast interrupt.
The following procedure describes how to configure an entire Simulink Real-Time model
to accept a broadcast interrupt from a PCI-5565 board. See GE Fanuc 5565 broadcast
for a description of the Interrupt parameter value that the Simulink Real-Time model
expects.
1
From the MATLAB Command Window, type
tg = slrt;
getPCIInfo(tg, 'installed')
This command lists board information for the installed PCI devices that the
Simulink Real-Time software knows about.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
13-11
13
Shared Memory Support
2
Find the IRQ specified for the PCI-5565 board.
This is the interrupt source number you need to specify in the Real-Time interrupt
source field of the Simulink Real-Time Options pane.
3
Edit your script and add a line like the following.
node.Interface.Interrupts.PendingInt1='on'
This line directs the model to expect an interrupt. It assumes that the value of the
5565 broadcast block Interrupt parameter is 1.
4
From the MATLAB Command Window, type the name of your Simulink model.
The Simulink model appears.
5
Select Simulation > Model Configuration Parameters
6
Select node Code Generation.
7
Select node Simulink Real-Time Options.
8
Set the Execution mode field to Real-Time.
9
Click the Real-Time interrupt source list.
10 Select the interrupt source number to which the board is set.
11 Click the I/O board generating the interrupt list and select
GE_Fanuc(VMIC)_PCI-5565 from the list.
12 Click OK.
Note: If you have a larger model, and you want to localize control of the interrupt within
that model, use the IRQ Source block from the Asynchronous Event sublibrary.
Board Node ID
The jumpers of the PCI-5565 board specify the board node ID. Correspondingly, you can
also configure the PCI-5565 block with the board node ID using the Interface.NodeID
field. Enter values according to the following:
13-12
NodeID Value
Description
'any'
Allows the PCI-5565 driver to work with a PCI-5565 node
regardless of the PCI-5565 board node ID jumper setting
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
GE Fanuc Shared Node Initialization Structure
NodeID Value
Description
value from '0' to '255' Specifies the particular PCI-5565 node that the driver must
look for. If this value does not match the jumpered value on
the PCI-5565 board, the driver returns an error.
The default value of 'any' meets requirements in most instances. However, you might
want to specify a particular NodeID value if you have multiple PCI-5565 boards in your
system and you want to identify the driver for a particular node.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
13-13
13
Shared Memory Support
GE Intelligent Platforms Shared Memory
Simulink Real-Time supports high-speed fiber optic reflective memory boards
manufactured by GE Intelligent Platforms (http://defense.ge-ip.com/products/family/
avionics) – formerly SBS Technologies.
The Simulink Real-Time software uses a model for shared memory that includes
Simulink blocks, for the shared memory drivers, and MATLAB structures for defining
shared memory and node initialization partitions.
Note: The Simulink Real-Time SBS25x0 driver does not fully support node-to-node
network configuration. In most cases, a shared memory hub is required to use the SBS
Shared driver blocks. If you have additional questions, please contact MathWorks
Technical Support.
13-14
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Create GE Intelligent Platforms Shared Partitions
Create GE Intelligent Platforms Shared Partitions
To use the Simulink Real-Time SBS Broadcast Memory shared memory blocks to read,
write, pack, or unpack data, you must define a partition structure. SBS Broadcast
Memory shared memory drivers use MATLAB structures to define shared memory
partitions. A partition structure describes how you want to allocate (or partition) the
shared memory. The Simulink Real-Time software allocates shared memory with
bundles of data that are packed into memory partitions. The following SBS Broadcast
Memory blocks use shared memory partition structures:
• SBS25x0 read and SBS25x0 write
• Shared Memory Pack and Shared Memory Unpack
After you define the shared memory partitions, you can add SBS Broadcast Memory
shared memory driver blocks to your Simulink model. Create a shared memory structure
in one of the following ways. See “GE Intelligent Platforms Shared Partition Structure”
on page 13-20 for the complete list of fields for the structure.
The following description refers to the smpartsbs25x0 command. Type
help smpartsbs25x0
for a description of the command.
• Using the smpartsbs25x0 command at the MATLAB Command Window, create a
default partition structure. For example, type
x=smpartsbs25x0
>> smpartsbs25x0
SBS25x0 Shared Memory Parition
Shared-Memory partition
Total Bytes in partition = 4
Starting Address = 0x0
Number of segments = 1
To get the contents of x, type
>> get(x)
ans =
Address: '0x0'
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
13-15
13
Shared Memory Support
Type:
Alignment:
Size:
WIT:
'uint32'
'4'
'[ 1 ]'
'off'
• At the MATLAB Command Window, create a user-defined partition structure. The
easiest way to do this is to create a script file, partially define a structure, load that
script into the MATLAB workspace. For example
Partition(1).Address='0x5000';
Partition(1).Type='int8';
Partition(1).Size='10';
Partition(2).Type='uint16';
Partition(2).Size='5';
Partition(3).Type='uint8';
Partition(3).Size='1';
Partition(3).Alignment='8';
Partition(4).Type='double';
Partition(4).Size='3';
To get the contents of x with these settings, type
>> x=smpartsbs25x0(Partition)
SBS25x0 Shared Memory Parition
Shared-Memory partition
Total Bytes in partition = 16
Starting Address = 0x5000
Number of segments = 4
This example defines a partition with four segments.
• The Address field is optional. Only specify this field for the first segment of a
partition. The elements of a partition are defined as a continuous memory block
from the first address. The following segments extrapolate their addresses from
the first segment. If you have fragmented memory, use multiple partitions and
SBS Broadcast Memory read/write blocks to work with the memory.
• The Type and Size fields are required for all fields in the partition structure.
• The Alignment value is optional. It is '4' by default, which forces segments that
do not have alignment specifications to start on 4 byte (32 bit) boundaries. In this
partition, the third segment (Partition(3)) has an alignment of '8'.
• The base addresses of subsequent segments are fully defined by the data type,
size, and alignment of the preceding segment.
13-16
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Create GE Intelligent Platforms Shared Partitions
You can then call the smpartsbs25x0() command to fully populate the partition
structure.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
13-17
13
Shared Memory Support
Initialize GE Intelligent Platforms Shared Nodes
To use the Simulink Real-Time SBS Broadcast Memory shared memory, you must define
a node initialization structure. SBS Broadcast Memory shared memory drivers use
MATLAB structures to define shared memory node initialization. A node initialization
structure describes the shared memory partition (see “Create GE Intelligent Platforms
Shared Partitions” on page 13-15) and the SBS Broadcast Memory board configuration,
including interrupt configurations. The following SBS Broadcast Memory block requires
shared memory node initialization structures:
• SBS25x0 init
After you define the node initialization partition, you can add SBS Broadcast Memory
shared memory driver blocks to your Simulink model. Create a shared memory structure
in one of the following ways. See “GE Intelligent Platforms Shared Node Initialization
Structure” on page 13-22 for the complete list of fields for the structure.
The following description refers to the smnodesbs25x0 command. Type
help smnodesbs25x0
for a description of the command.
Using the smnodesbs25x0 command at the MATLAB Command Window, create a
default node initialization structure. For example, type
>> node=smnodesbs25x0
Node Definition for SBS2500/SBS2510 Broadcast Memory
To get the contents of node, type
>> get(node)
ans =
TargetAbortEnable:
LoopbackEnable:
Node2Node:
RXEnable:
TXEnable:
MemorySize:
WITEnable:
IRQ_ErrorEnable:
IRQ_WITEnable:
13-18
'off'
'off'
'off'
'on'
'on'
'256kByte'
'off'
'off'
'off'
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Initialize GE Intelligent Platforms Shared Nodes
Partition: []
SlotID: 'any'
• At the MATLAB Command Window, create a user-defined node structure. The easiest
way to do this is to create a script file, partially define a structure, load that script
into the MATLAB workspace. For example
z.LoopbackEnable='on';
z.Partition=x
To get the contents of node with these settings, type
>> node=smnodesbs25x0(node1)
Node Definition for SBS2500/SBS2510 Broadcast Memory
>> get(node)
ans =
TargetAbortEnable:
LoopbackEnable:
Node2Node:
RXEnable:
TXEnable:
MemorySize:
WITEnable:
IRQ_ErrorEnable:
IRQ_WITEnable:
Partition:
SlotID:
'off'
'on'
'off'
'on'
'on'
'256kByte'
'off'
'off'
'off'
[1x1 smpartsbs25x0]
'any'
Currently, you can define values only for the fields LoopbackEnable, WITEnable, and
Partition.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
13-19
13
Shared Memory Support
GE Intelligent Platforms Shared Partition Structure
You do not need to use all the fields of a partition initialization structure. However,
knowing the possible structure fields will be helpful when you are creating the
structures.
A shared memory partition structure has the following fields:
Address: '0x0'
Type:
Alignment:
Size:
WIT:
'uint32'
'4'
'[ 1 ]'
'off'
where
Partition Fields
Description
Address
Specifies the base address (in hexadecimal) of the memory partition
within the node's shared memory space. The default value is '0x0',
the first location in shared memory.
Align partition addresses on 32-bit word boundaries (for example, 0x0,
0x4, 0x8, and so forth).
Type
Specifies the data type of the memory segment. Specify one of the
following types:
• single (IEEE Single Precision)
• double (IEEE Double Precision)
• uint8
• int8
• uint16
• int16
• uint32
• int32
• Boolean (a single byte represents a boolean value)
The default value is 'uint32'. A minimum partition size is 32 bits.
13-20
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
GE Intelligent Platforms Shared Partition Structure
Partition Fields
Description
Size
Specifies the dimension and size of the memory segment. You can
enter a scalar value or a value with the [m,n] format. The default
value is '1'.
• scalar — Treats the Size entry as the specification of the length of
a non-oriented array or vector
• [m,n] — Treats the Size entry as an array dimension. The total
number of elements in this segment is m*n.
Alignment
If another partition precedes this partition, defines the byte alignment
of this segment. Specify one of the following alignment values: 1, 2,
3, 4, or 8. The default value is '4'. This value forces a double word
boundary alignment for the first address of this segment.
WIT
Write Interrupt Table. If this partition segment receives a write
request, specifies whether or not the partition generates an interrupt.
Specify 'off', 'first', 'all', 'last'. The default value is 'off'.
'off' — Prevents the partition from generating interrupts
'first' — Allows a write to the first double word of the memory
block to generate an interrupt.
'all' — Allows a write to all locations of the memory block to
generate an interrupt.
'last' — Allows a write to only the last double word of the memory
segment to generate an interrupt.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
13-21
13
Shared Memory Support
GE Intelligent Platforms Shared Node Initialization Structure
You do not need to use all the fields of a node initialization structure. However, knowing
the possible structure fields will be helpful when you are creating the structures.
A node initialization structure has the following fields:
TargetAbortEnable: 'off'
LoopbackEnable: 'off'
Node2Node: 'off'
RXEnable: 'on'
TXEnable: 'on'
MemorySize: '256kByte'
WITEnable: 'off'
IRQ_ErrorEnable: 'off'
IRQ_WITEnable: 'off'
Partition: []
SlotID: 'any'
These values interact with the Extended Control Register. Refer to the SBS Broadcast
Memory product documentation for further details on registers.
Of particular note are the following register modes:
Board Modes
Description
Loopback
Enable
Specifies if the Simulink Real-Time software can operate without
having the shared memory network fully operational.
• 'off' — Normal shared memory operation (requires operating
shared memory network)
• 'on' — Loop back enable. This allows the Simulink Real-Time
software to operate without having the shared memory network
fully operational.
Memory Size
13-22
Specifies the minimum memory size required. The SBS Broadcast
Memory driver checks this value against the memory size of the SBS
Broadcast Memory board. An SBS Broadcast Memory board has a
memory size of either '64MByte' or '128MByte'. If you enter a size
in this field that is larger than the actual SBS Broadcast Memory
board memory size, the driver will return an error. You can enter
values of:
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
GE Intelligent Platforms Shared Node Initialization Structure
Board Modes
Description
'256kByte'
'512kByte'
'1MByte'
'2MByte'
'4MByte'
'8MByte'
Partition
Specifies the memory partition to be initialized. The node requires this
value to initialize the interrupt table for the partition. This parameter
is required for Simulink Real-Time configurations that will be driven
by shared memory interrupts.
Board Interrupts
If you want to have an interrupt source, the SBS shared memory board can generate PCI
interrupts in response to writes to memory partitions of a memory block. You define this
behavior through the WIT field of shared memory partition structure. Each partition
segment has its own WIT setting.
To enable a memory location to generate an interrupt, set the WIT field as desired, then
configure the Simulink Real-Time model to generate an interrupt.
The following procedure describes how to configure an entire Simulink Real-Time model
to accept an interrupt from an SBS shared memory board:
1
From the MATLAB Command Window, type
tg = slrt;
getPCIInfo(tg, 'installed')
This command lists board information for the installed PCI devices that the
Simulink Real-Time software knows about.
2
If you have multiple SBS shared memory boards, find the board ID for which you
want to define the interrupt.
3
Find the IRQ specified for your SBS25x0 board.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
13-23
13
Shared Memory Support
This is the interrupt source number you need to specify in the Real-Time interrupt
source field of the Simulink Real-Time Options pane.
4
From the MATLAB Command Window, type the name of your Simulink model.
The Simulink model appears.
5
Select Simulation > Model Configuration Parameters
6
Select node Code Generation.
7
Select node Simulink Real-Time Options.
8
Set the Execution mode field to Real-Time.
9
Click the Real-Time interrupt source list.
10 Select the interrupt source number to which the board is set.
11 Click the I/O board generating the interrupt list and select the SBS board ID
associated with the IRQ:
SBS_25x0_ID_0x100
SBS_25x0_ID_0x101
SBS_25x0_ID_0x102
SBS_25x0_ID_0x103
12 If your system has multiple boards, at the PCI slot (-1: autosearch) or ISA base
address parameter, specify the PCI slot that contains the board you are configuring
for interrupts.
13 Click OK.
13-24
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Curtiss-Wright Electronic Systems Shared Memory
Curtiss-Wright Electronic Systems Shared Memory
Simulink Real-Time supports reflective (shared) memory boards manufactured
by Curtiss-Wright Electronic Systems (http://www.cwcelectronicsystems.com/
data_communications.html) – formerly Systran.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
13-25
13
Shared Memory Support
Create Curtiss-Wright Shared Partitions
The Simulink Real-Time software uses a model for reflective memory (also known as
shared memory) that includes Simulink blocks for shared memory driver functions and
MATLAB structures to define node initialization and shared memory partitions. This
topic describes Simulink Real-Time support of the Systran SCRAMNet+ SC150 board.
To use the Simulink Real-Time Systran SCRAMNet+ SC150 shared memory blocks, you
must define shared memory partition structures. A partition structure describes how
you want to allocate (partition) the shared memory. The Simulink Real-Time software
allocates shared memory as segments of data that are packed into memory regions or
partitions. Along with the Shared Memory Pack and Shared Memory Unpack blocks, the
following SCRAMNet+ SC150 blocks use shared memory partition structures:
• Systran SC150 read
• Systran SC150 write
• Systran SC150 rearm
After defining the shared memory partitions, you can add SCRAMNet+ SC150 shared
memory driver blocks to your Simulink model. See “Curtiss-Wright Shared Partition
Structure” for the complete list of fields in a partition structure.
The following description refers to the completepartitionstruct command. Type
help completepartitionstruct
for more information.
• Create a partition structure in one of the following ways. Using the
completepartitionstruct command at the MATLAB Command Window, create a
default partition structure. For example, type
Partition = completepartitionstruct([],'scramnet')
Partition =
Address:
Type:
Size:
Alignment:
RIE:
TIE:
ExtTrigger1:
13-26
'0x0'
'uint32'
'1'
'4'
'off'
'off'
'off'
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Create Curtiss-Wright Shared Partitions
ExtTrigger2: 'off'
HIPRO: 'off'
Internal: [1x1 struct]
• At the MATLAB Command Window, create a user-defined partition structure. The
easiest way to do this is to create a script file, partially define a structure, load that
script into the MATLAB workspace, and supplement the resulting structure with a
call to the completepartitionstruct function. For example
Partition(1).Address='0x5000';
Partition(1).Type='int8';
Partition(1).Size='10';
Partition(2).Type='uint16';
Partition(2).Size='5';
Partition(3).Type='double';
Partition(3).Size='3';
Partition(4).Type='uint8';
Partition(4).Size='[2, 3]';
This example defines a partition with four segments.
• The Address field is optional. Only specify this field for the first segment of a
partition. The elements of a partition are defined as a continuous memory block
from the first address. The function extrapolates segment addresses from the
first segment definition. If you have or require fragmented memory, use multiple
partitions.
• The Type and Size fields are required for all segments in the partition structure.
• The Alignment value is optional. It is '4' by default. This value forces segments
that do not have alignment specifications to start on 4 byte (32–bit) boundaries.
• The base addresses of subsequent segments are defined by the data type, size, and
alignment of the preceding segment.
• Call the completepartitionstruct() command to fully populate the partition
structure.
Partition = completepartitionstruct(Partition,'scramnet');
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
13-27
13
Shared Memory Support
Initialize Curtiss-Wright Shared Nodes
In addition to shared memory partitions, you must also define a node initialization
structure before using the SCRAMNet+ SC150 shared memory blocks. A node
initialization structure describes the shared memory partitions (see “Create CurtissWright Shared Partitions”) and the SCRAMNet+ SC150 board configuration, including
interrupt settings, if used. The Systran SC150 init block requires a shared memory node
initialization structure.
After defining the node initialization structure, you can add SCRAMNet+ SC150 shared
memory driver blocks to your Simulink model. See “Curtiss-Wright Shared Node
Initialization Structure” for the complete list of fields in a node initialization.
The following description refers to the completenodestruct command. Type
help completenodestruct
for more information.
• Create a node initialization structure in one of the following ways. Using the
completenodestruct command at the MATLAB Command Window, create a
default node initialization structure. For example, type
node=completenodestruct([],'scramnet')
node =
Interface: [1x1 struct]
Partitions: [1x1 struct]
• Now modify the structure fields to meet your requirements. For example:
node.interface.NodeID = '128';
node.Partitions = Partition;
• A user-defined node structure, created with MATLAB code or from the MATLAB
Command Window and supplement the resulting structure with a call to the
completenodestruct function. For example:
node.Interface.NodeID = '128';
node.Partitions = Partition;
node = completenodestruct(node,'scramnet');
13-28
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Curtiss-Wright Shared Partition Structure
Curtiss-Wright Shared Partition Structure
A shared memory partition structure has the following fields. You do not need to use all
the fields of a partition or node initialization structure. However, knowing the possible
structure fields will be helpful when you are setting up to use shared memory.
Address:
Type:
Size:
Alignment:
RIE:
TIE:
ExtTrigger1:
ExtTrigger2:
HIPRO:
Internal:
'0x0'
'uint32'
'1'
'4'
'off'
'off'
'off'
'off'
'off'
[1x1 struct]
where
Partition Fields
Description
Address
Specifies the base address (in hexadecimal) of the memory partition
within the node's shared memory space. The default value is '0x0',
the first location in shared memory. Note that the base address is
byte aligned.
Type
Specifies the data type of the memory segment. Specify one of the
following types:
• double
• float
• uint8
• int8
• uint16
• int16
• uint32
• int32
• boolean (a single byte represents a boolean value)
The minimum partition size is 32 bits.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
13-29
13
Shared Memory Support
Partition Fields
Description
The default value is 'uint32'.
Size
Specifies the dimension and size of the memory segment. You can
enter a scalar value or a value with the [m,n] format. The default
value is '1'.
• scalar — Treats the Size entry as the specification of the length
of a non-oriented array or vector
• [m,n] — Treats the Size entry as an array dimension. The total
number of elements in this segment is m*n.
Alignment
Specifies the byte alignment of the next partition (if one is defined).
Enter alignment value in bytes: 1, 2, 3, 4. The alignment value
defines the end of the current segment, and therefore the beginning
alignment of the next segment. The default value is '4', forcing a
double word boundary alignment. See “Alignment Examples”.
RIE
Specifies whether or not this partition can receive interrupts (Receive
Interrupt Register (RIE)). Specify 'off', 'first', 'all', 'last'.
The default value is 'off'.
'off' — Prevents the partition from receiving interrupts
'first' — Allows only the first double word of the memory segment
to be marked with the corresponding Auxiliary Control RAM bit.
'all' — Allows all memory locations of the memory segment to be
marked with the corresponding Auxiliary Control RAM bit.
'last' — Allows only the last double word of the memory segment
to be marked with the corresponding Auxiliary Control RAM bit.
13-30
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Curtiss-Wright Shared Partition Structure
Partition Fields
Description
TIE
Specifies whether or not this partition can transmit interrupts
(Transmit Enable (TIE)). Specify 'off', 'first', 'all', 'last'.
The default value is 'off'.
'off' — Prevents the partition from transmitting interrupts
'first' — Allows only the first double word of the memory segment
to be marked with the corresponding Auxiliary Control RAM bit.
'all' — Allows all memory locations of the memory segment to be
marked with the corresponding Auxiliary Control RAM bit.
'last' — Allows only the last double word of the memory segment
to be marked with the corresponding Auxiliary Control RAM bit.
ExtTrigger1
If this partition receives a write access, specifies whether or not
this partition can generate a trigger signal to an external connector.
Specify 'off', 'first', 'all', 'last'. The default value is
'off'.
'off' — Prevents the partition from generating signals
'first' — Allows only the first double word of the memory segment
to be marked with the corresponding Auxiliary Control RAM bit.
'all' — Allows all memory locations of the memory segment to be
marked with the corresponding Auxiliary Control RAM bit.
'last' — Allows only the last double word of the memory segment
to be marked with the corresponding Auxiliary Control RAM bit.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
13-31
13
Shared Memory Support
Partition Fields
Description
ExtTrigger2
If this partition receives a write access, specifies whether or not
this partition can generate a trigger signal to an external connector.
Specify 'off', 'first', 'all', 'last'. The default value is
'off'.
'off' — Prevents the partition from generating signals
'first' — Allows only the first double word of the memory segment
to be marked with the corresponding Auxiliary Control RAM bit.
'all' — Allows all memory locations of the memory segment to be
marked with the corresponding Auxiliary Control RAM bit.
'last' — Allows only the last double word of the memory segment
to be marked with the corresponding Auxiliary Control RAM bit.
HIPRO
Specifies whether or not the elements in this partition can be
transmitted as one network message. Specify 'off', or 'on'. The
default value is 'off'.
'off' — Prevents the partition from transmitting the elements as
one message
'on' — Allows the partition to transmit the elements as one
message
Internal
Reserved for internal use.
Alignment Examples
This example shows the shared memory map with default alignment values.
Partition1(1).Type='int32';
Partition1(1).Size='1';
Partition1(2).Type='boolean';
Partition1(2).Size='1';
Partition1(3).Type='uint32';
Partition1(3).Size='1';
Partition1 = completepartitionstruct(Partition1,'scramnet');
13-32
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Curtiss-Wright Shared Partition Structure
1 1 1 1 2
3 333
This example shows the shared memory map with alignment value changed from 4 to 1
in the second partition.
Partition1(1).Type='int32';
Partition1(1).Size='1';
Partition1(1).Alignment='4';
Partition1(2).Type='boolean';
Partition1(2).Size='1';
Partition1(2).Alignment='1';
Partition1(3).Type='uint32';
Partition1(3).Size='1';
Partition1 = completepartitionstruct(Partition1,'scramnet');
1 1 1 1 2 3 3 3 3
This example shows the shared memory map with alignment value changed from 4 to 2
in the second partition.
Partition1(1).Type='int32';
Partition1(1).Size='1';
Partition1(1).Alignment='4';
Partition1(2).Type='boolean';
Partition1(2).Size='1';
Partition1(2).Alignment='2';
Partition1(3).Type='uint32';
Partition1(3).Size='1';
Partition1 = completepartitionstruct(Partition1,'scramnet');
1 1 1 1 2
3 3 3 3
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
13-33
13
Shared Memory Support
Curtiss-Wright Shared Node Initialization Structure
A node initialization structure has the following fields:
Interface: [1x1 struct]
Partitions: [1x1 struct]
where
Node Structure
Fields
Description
Interface
Specifies settings for the board Control/Status Register (CSR). The
Interface structure has the following fields. Refer to the SCRAMNet
+ SC150 product documentation for a description of the CSR and its
operation modes.
• Mode — Configures board modes (see “Board Mode”)
• Timeout — Enables the board to set the timeout value (see
“Board Timeout”)
• DataFilter — Controls the data filtering operation (see “Board
Data Filter”)
• VirtualPaging — Controls the board virtual paging operation
(see “Virtual Paging”)
• Interrupts — Enables the board to generate and receive
interrupts from the network (see “Board Interrupts”)
• Internal — Reserved for internal use
Partitions
Stores the shared memory segments (see “Create Curtiss-Wright
Shared Partitions”)
Board Mode
The SCRAMNet+ SC150 board has a number of modes that you can set through the
Interface.Mode field. The Interface Mode fields set the corresponding bits in the CSR.
To display the board mode fields, type
>> node.Interface.Mode
13-34
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Curtiss-Wright Shared Node Initialization Structure
ans =
NetworkCommunicationsMode:
InsertNode:
DisableFiberOpticLoopback:
EnableWireLoopback:
DisableHostToMemoryWrite:
WriteOwnSlotEnable:
MessageLengthLimit:
VariableLengthMessagesOnNetwork:
HIPROEnable:
MultipleMessages:
NoNetworkErrorCorrection:
MechanicalSwitchOverride:
DisableHoldoff:
'TransmitReceive'
'on'
'on'
'off'
'off'
'off'
'256'
'off'
'off'
'on'
'on'
'on'
'on'
These modes have the following values:
Field
Values
Default
CSR
NetworkCommunications Mode
'none',
'receiveonly',
'transmitonly',
'transmit
receive'
'transmit
receive'
CSR3[8..15]
InsertNode
'off', 'on'
'on'
CSR0[0..1]
DisableFiberOptic Loopback
'off', 'on'
'on'
CSR2[6]
EnableWire Loopback
'off', 'on'
'off'
CSR2[7]
DisableHost ToMemory Write
'off', 'on'
'off'
CSR2[8]
WriteOwnSlotEnable
'off', 'on'
'off'
CSR2[9]
Message LengthLimit
'256', '1024'
'256'
CSR2[11]
Variable Length MessagesOn
Network
'off', 'on'
'off'
CSR212]
HIPROEnable
'off', 'on'
'off'
CSR2[13]
Multiple Messages
'off', 'on'
'on'
CSR2[14]
NoNetwork Error Correction
'off', 'on'
'on'
CSR2[15]
Mechanical Switch Override
'off', 'on'
'on'
CSR8[11]
Disable Holdoff
'off', 'on'
'on'
CSR8[11]
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
13-35
13
Shared Memory Support
Board Timeout
The SCRAMNet+ SC150 board allows you to set the network timeout through the
Interface.Timeout field. The Interface Timeout fields set the corresponding bits in
the CSR.
To display the timeout fields, type
>> node.Interface.Timeout
ans =
NumOfNodesInRing: '2'
TotalCableLengthInM: '2'
These fields have the following values:
Field
Values
Default
CSR
NumOfNodes InRing
'0'..'255'
'2'
CSR5
TotableCable LengthInM
'0'..'n'
'2'
CSR5
Refer to the SCRAMNet+ SC150 product documentation for a description of these fields.
Board Data Filter
The SCRAMNet+ SC150 board allows you to set the data filter operation through the
Interface.DataFilter field. The Interface DataFilter fields set the corresponding bits
in the CSR.
>> node.Interface.DataFilter
ans =
EnableTransmitDataFilter: 'off'
EnableLower4KBytesForDataFilter: 'off'
>>
These fields have the following values:
Field
Values
Default
CSR
Enable TransmitData Filter
'off', 'on'
'off'
CSR0[10]
EnableLower4KBytesFor
DataFilter
'off', 'on'
'off'
CSR0[11]
13-36
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Curtiss-Wright Shared Node Initialization Structure
Virtual Paging
The SCRAMNet+ SC150 board allows you to set the bits of the Virtual Paging Register
operation through the Interface.VirtualPaging field. The Interface VirtualPaging
fields set the corresponding bits in the CSR.
>> node.Interface.VirtualPaging
ans =
VirtualPagingEnable: 'off'
VirtualPageNumber: '0'
These fields have the following values:
Field
Values
Default
CSR
VirtualPagingEnable
'off', 'on'
'off'
CSR12[0]
VirtualPage Number
'0'..'2047'
'0'
CSR12[5..15]
Board Interrupts
The SCRAMNet+ SC150 board allows you to specify the interrupt sources transmitted
and received between the nodes of the network. You can set these bits through the
Interface.Interrupts field. The Interface Interrupts fields set the corresponding bits
in the CSR.
>> node.Interface.Interrupts
ans =
HostInterrupt:
InterruptOnMemoryMaskMatch:
OverrideReceiveInterrupt:
InterruptOnError:
NetworkInterrupt:
OverrideTransmitInterrupt:
InterruptOnOwnSlot:
ReceiveInterruptOverride:
'off'
'off'
'off'
'off'
'off'
'off'
'off'
'off'
These fields have the following values:
Field
Values
Default
CSR
HostInterrupt
'off', 'on'
'off'
CSR0[3]
InterruptOn MemoryMask Match
'off', 'on'
'off'
CSR0[5]
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
13-37
13
Shared Memory Support
Field
Values
Default
CSR
Override Receive Interrupt
'off', 'on'
'off'
CSR0[6]
InterruptOn Error
'off', 'on'
'off'
CSR0[7]
Network Interrupt
'off', 'on'
'off'
CSR0[8]
Override Transmit Interrupt
'off', 'on'
'off'
CSR0[9]
InterruptOn OwnSlot
'off', 'on'
'off'
CSR2[10]
Receive Interrupt Override
'off', 'on'
'off'
CSR8[10]
13-38
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Boards and Blocks — Alphabetical List
Boards and Blocks — Alphabetical List
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
13-39
‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ | ‪www.MatlabSite.com‬‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
‫‪Video, XCP‬‬
‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ | ‪www.MatlabSite.com‬‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ | ‪www.MatlabSite.com‬‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
14
Video Image Processing
• “Process Video Images Using Simulink Real-Time” on page 14-2
• “USB Video Display on Development Computer” on page 14-3
• “USB Video Display on Target Computer” on page 14-4
• “Camera Link Camera Display on Development Computer” on page 14-5
• “Camera Link Camera Display on Target Computer” on page 14-6
• “Acquire Images from Camera Link Cameras” on page 14-7
• “Camera Link Camera Triggering” on page 14-8
• “Serial Camera Configuration” on page 14-12
• “Install BitFlow Neon-CLB Support” on page 14-14
• “Boards and Blocks — Alphabetical List” on page 14-15
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
14
Video Image Processing
Process Video Images Using Simulink Real-Time
The Simulink Real-Time software supports webcams compliant with the USB Video
Class (UVC) standard and cameras compliant with the Automated Imaging Association
Camera Link® standard.
Note: UVC compliant cameras are often referred to as "driverless webcams". For more
information, see your camera documentation.
Using blocks from the Simulink Real-Time Video library, on your target computer, you
can do the following:
• Acquire real-time video frames from cameras connected to the target computer.
• Display the real-time image on the target computer monitor.
• Process or reduce the real-time image, for instance to select a region of interest.
• Compress video frames acquired on the target computer.
• Stream video frames acquired on the target computer to the development computer.
Using blocks from the Computer Vision System Toolbox™ or Image Processing
Toolbox™, on your development computer, you can do the following:
• Receive images from the target computer.
• Decompress video frames on the development computer.
• Process or reduce images.
• Display images on the development computer.
14-2
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
USB Video Display on Development Computer
USB Video Display on Development Computer
The following workflow acquires and displays video frames using a USB Video Class
(UVC) compliant webcam. To view the images on the development computer, compress
the video frames on the target computer and transmit them to the development
computer. You then decompress and display the video frames.
1
Enable USB general support through the target computer BIOS. See “BIOS
Settings”.
2
Acquire a USB Video Class (UVC) compliant webcam, and then connect it to the
target computer USB port.
3
If required to query the available camera configurations, add the USB Video Device
List block.
4
Add the image input block From USB Video Device to the target-side model.
Configure the block as required.
5
If required, add the JPEG Compression block to the target-side model. Some USB
cameras support on-chip JPEG compression. For these cameras, you do not need a
target-side JPEG Compression block. Connect this block to the output of the image
input block.
6
Add the Image Transmit block to the target-side model. Connect this block to the
output of the compression block. Configure the block to transmit frames to the
development computer.
7
Add the Image Receive block to the host-side model. Configure the block to receive
frames from the target computer.
8
Add the JPEG Decompression block to the host-side model. Connect this block to the
output of the Image Receive block.
9
Add the To Video Display block from the Computer Vision System Toolbox to the
host-side model.
10 Build and download the target-side model to the target computer.
11 Run the host-side model on the development computer.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
14-3
14
Video Image Processing
USB Video Display on Target Computer
The following workflow acquires and displays video frames using a USB Video Class
(UVC) compliant webcam. To view the images on the target computer, use a Video
Display block.
1
Enable USB general support through the target computer BIOS. See “BIOS
Settings”.
2
Acquire a USB Video Class (UVC) compliant webcam, and then connect it to the
target computer USB port.
3
If required to query the available camera configurations, add the USB Video Device
List block.
4
Add the image input block From USB Video Device to the target-side model.
Configure the block as required.
Record the setting of the Image signal parameter.
14-4
5
Add the Video Display block. Set its Image signal parameter to match the
corresponding setting in the From USB Video Device block.
6
Build and download the target-side model to the target computer.
7
Execute the model on the target computer.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Camera Link Camera Display on Development Computer
Camera Link Camera Display on Development Computer
The following workflow acquires and displays video frames using a camera that is
compliant with the Camera Link standard. To view the images on the development
computer, compress the video frames on the target computer and transmit them to the
development computer. You then decompress and display the video frames.
1
Install the BitFlow Neon-CLB board in a PCI Express® x4 or wider slot in the target
computer.
2
Install the BitFlow™ Neon-CLB Support Package and the BitFlow SDK. See “Install
BitFlow Neon-CLB Support”.
3
Acquire a monochrome digital camera that is compliant with Camera Link. The
camera must have a configuration file in the BitFlow SDK that specifies a freerunning or triggered mode.
To configure the BitFlow Neon-CLB board, the NEON BitFlow Image Input block
requires the BitFlow SDK and a configuration file for your specific camera. If the
SDK does not contain the required file, contact your BitFlow representative. You
cannot proceed without this file.
4
Attach the camera to the BitFlow Neon-CLB board in the target computer.
5
Add the NEON BitFlow Image Input block, available in the Simulink Real-Time
Video library, to the target-side model. Configure the block as required.
6
Add the JPEG Compression block to the target-side model. Connect this block to the
output of the image input block.
7
Add the Image Transmit block to the target-side model. Connect this block to the
output of the compression block. Configure the block to transmit frames to the
development computer.
8
Add the Image Receive block to the host-side model. Configure the block to receive
frames from the target computer.
9
Add the JPEG Decompression block to the host-side model. Connect this block to the
output of the Image Receive block.
10 Add the To Video Display block from the Computer Vision System Toolbox to the
host-side model.
11 Build and download the target-side model to the target computer.
12 Run the host-side model on the development computer.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
14-5
14
Video Image Processing
Camera Link Camera Display on Target Computer
The following workflow acquires and displays video frames using a camera that is
compliant with the Camera Link standard. To view the images on the target computer,
use a Video Display block.
1
Install the BitFlow Neon-CLB board in a PCI Express x4 or wider slot in the target
computer.
2
Install the BitFlow Neon-CLB Support Package and the BitFlow SDK. See “Install
BitFlow Neon-CLB Support”.
3
Acquire a monochrome digital camera that is compliant with Camera Link. The
camera must have a configuration file in the BitFlow SDK that specifies a freerunning or triggered mode.
To configure the BitFlow Neon-CLB board, the NEON BitFlow Image Input block
requires the BitFlow SDK and a configuration file for your specific camera. If the
SDK does not contain the required file, contact your BitFlow representative. You
cannot proceed without this file.
14-6
4
Attach the camera to the BitFlow Neon-CLB board in the target computer.
5
Add the NEON BitFlow Image Input block, available in the Simulink Real-Time
Video library, to the target-side model. Configure the block as required.
6
Add the Video Display block. Set its Image signal parameter to Single
multidimensional signal.
7
Build and download the target-side model to the target computer.
8
Execute the model on the target computer.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Acquire Images from Camera Link Cameras
Acquire Images from Camera Link Cameras
You can use the NEON BitFlow Image Input block to acquire images from cameras that
support the Automated Imaging Association Camera Link interface standard. This block
supports the BitFlow Neon-CLB board (see http://www.bitflow.com).
Be familiar with the following information:
• Video capture procedures
• Camera Link interface standard
• Manufacturer instructions for installing the BitFlow Neon-CLB board on the target
computer
• Instructions for installing the BitFlow SDK. See “Install BitFlow Neon-CLB Support”.
• Serial command codes for your particular camera model. See “Serial Camera
Configuration”.
The Simulink Real-Time product contains the following example that illustrates how to
acquire images from a camera connected to the BitFlow Neon-CLB board.
Image Capture with Camera Link and Bitflow Neon-CLB Frame Grabber
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
14-7
14
Video Image Processing
Camera Link Camera Triggering
The NEON BitFlow Image Input block interacts with the frame grabber and camera
using four trigger modes set in the camera configuration file:
• Free Running. The camera and frame grabber run continuously. When the camera
finishes an exposure, the frame grabber board copies the image to target memory
using DMA and signals a frame completion interrupt. Upon receiving the interrupt,
the model runs and performs image processing.
Before the next DMA completion interrupt, the model must complete image
processing. Otherwise, the CPU becomes overloaded.
14-8
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Camera Link Camera Triggering
If the model requires heavy image processing, create a multirate, multitasking model
that samples every Nth image. Place the image input block at the top level with a
sample time of Ts. Construct an atomic subsystem for image processing. Assign it
a sample time of Ts * 2 (or whatever factor N allows the subsystem to sample every
Nth image). Connect the output of the image input block to the input port of the
subsystem through a rate transition block.
The example Image Capture with Camera Link® and Bitflow™ Neon-CLB Frame
Grabber shows such a model, with the subsystem running at Ts * 3, or sampling
every third image. The model is configured for a large format camera where the Jpeg
Compression and Image Transmit blocks take more than Ts to complete.
• Timer Triggered. The target computer system timer starts the model. When
the model runs, it simultaneously starts a camera exposure and begins to process
the image captured during the previous time step. When the camera finishes the
exposure, the frame grabber copies the image to target memory using DMA for
processing in the next time step.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
14-9
14
Video Image Processing
• Differential Trigger. A rising edge on the differential trigger input triggers
the camera. When the camera finishes the exposure, the frame grabber copies the
image to target memory using DMA, and signals a frame completion interrupt. Upon
receiving the interrupt, the model runs and performs image processing.
Camera Link cameras are designed to respond to one of four camera control lines (CC1
to CC4) coming from the frame grabber. The required control line is in the triggeredmode configuration file for the camera. Connect the external trigger to the frame
grabber trigger input.
14-10
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Camera Link Camera Triggering
• TTL Trigger. A rising edge on the TTL trigger input triggers the camera. The model
runs from the frame completion interrupt.
• Opto Trigger. A rising edge on the Opto trigger input triggers the camera. The
model runs from the frame completion interrupt.
The camera configuration file puts the frame grabber into triggered mode, but does not
put the camera into that mode. You must send a command to the camera to set it to
triggered mode. See “Serial Camera Configuration” on page 14-12.
The camera configuration file determines whether you can use the block mask to switch
the trigger mode to another mode, such as Free Running. You could need to contact
BitFlow for a camera configuration file for the mode that you want.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
14-11
14
Video Image Processing
Serial Camera Configuration
To enter a serial command for the camera, enter it without quotation marks in the
Camera configuration serial command text box.
Enter multiple commands as one line without white space.
Each camera manufacturer has a serial command set documented in the manual for
each camera or family of cameras. Each command set is completely different from any
other. For example, to put a camera from the given series into triggered mode and set the
shutter time to 1 ms, use these mask settings and serial command strings.
Camera Series
Mask Settings
Serial Setup
CIS VCC G21
9600 baud
000000W004001\r
8 bits
000000W002005\r
No parity
Pulnix TM1400
9600 baud
:SA5\r
8 bits
No parity
Sony XCL
38400 baud
SHUTTER 7\r
8 bits
TRG_MODE 1\r
No parity
Cohu 7800
9600 baud
\002\0377cE2,10chk\003
8 bits
\002\0377cM2chk\003
No parity
\002\0377T0,1chk\003
chk is a checksum for the
given portion of the message.
For your camera, find the required command codes in the manufacturer documentation
for that specific camera. If those codes are not in the manual, contact the camera
manufacturer.
14-12
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Serial Camera Configuration
Some cameras return a success or failure value in response to the serial command. The
image input block dialog box includes a check box to allow the software to display such
values. Some responses include non-printable control characters, displayed as C escape
sequences.
Escape Sequence
Control Character
Definition
\r
CR
Carriage Return
\002
STX
Start of Text
\003
ETX
End of Text
\006
ACK
Acknowledge
\025
NACK
Negative Acknowledge
Some camera manufacturers offer Windows utilities to send configuration strings to their
cameras. Using such a utility, you can configure a camera on Windows, save the settings
on the camera, and then connect the camera to the target computer to use it.
Other camera manufacturers require a special serial cable that connects the camera’s
serial communication line to a separate serial connection. In this case, you cannot
initialize the camera using settings in the Camera configuration serial command
section. Instead, you must connect the DB9 to a serial port on the development computer
and use manufacturer software to configure the camera via the serial cable before
running the real-time application.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
14-13
14
Video Image Processing
Install BitFlow Neon-CLB Support
To add support for BitFlow Neon-CLB hardware to the Simulink Real-Time product, do
the following:
14-14
1
From the BitFlow website (http://www.bitflow.com), install the BitFlow SDK.
2
After installing the BitFlow SDK, test the installation by building and downloading
a video example.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Boards and Blocks — Alphabetical List
Boards and Blocks — Alphabetical List
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
14-15
14
Video Image Processing
BitFlow Neon-CLB
Support for BitFlow Neon-CLB camera interface board
Board
BitFlow Neon-CLB
General Description
The BitFlow Neon-CLB board has:
• One camera port that supports one camera that is compliant with Camera Link with
power over Camera Link (PoCL)
• SafePower, which protects against Camera Link power line faults
The BitFlow Neon-CLB board requires a PCI Express x4 or wider slot. The Simulink
Real-Time block library supports this board with the NEON BitFlow Image Input block.
Board Characteristics
Board name
BitFlow Neon-CLB
Manufacturer
BitFlow
Bus type
PCI Express
Multiple block instance support
No
Multiple board support
No
See Also
“Install BitFlow Neon-CLB Support”
14-16
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
NEON BitFlow Image Input
NEON BitFlow Image Input
Support for NEON BitFlow Image Input block
Library
Simulink Real-Time Library for BitFlow Camera Link
Description
The NEON BitFlow Image Input block enables you to acquire real-time video frames
or still images from a Camera Link camera attached to a BitFlow Neon-CLB camera
interface board on the target computer. On the acquired image signal, perform the
following:
• Display the output on the target computer monitor using a Video Display block.
• Stream captured frames to the development computer display (for example, using the
To Video Display block from Computer Vision System Toolbox).
• Analyze the image signals on the development computer.
• Compress or decompress the input signal with the JPEG Compression or JPEG
Decompression blocks.
The Image signal type for the NEON BitFlow Image Input block output is Single
multidimensional signal.
Block Parameters
Camera config file
Click the Browse button to select a configuration from the BitFlow SDK installation
folder.
The browser window displays a list of camera configuration files for BitFlow R64type camera boards. The BitFlow Neon CLB board supports cameras from this list.
Scroll and open the camera configuration file specified by you and your BitFlow
representative—for example, CIS-VCC-G21V31CL-E1-FreeRun.r64. Alternatively,
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
14-17
14
Video Image Processing
start typing the manufacturer name, and an abbreviated list of camera configuration
files appears for that manufacturer. Open the BitFlow camera configuration file for
your camera model.
If you cannot locate your camera in the list, contact BitFlow to find a camera that is
compatible with your requirements.
When you open the configuration file, it assigns values to the noneditable
parameters:
Manufacturer
Displays camera manufacturer name.
Model
Displays the model of the camera that the configuration file configures and works
with.
Mode
Describes the camera operation mode.
Bit Depth
Displays the number of bits per pixel that the camera uses.
Acquisition Timeout
Displays the number of milliseconds before the board sends an interrupt. For
example, if the camera is not on, the board emits an interrupt.
Full Width
Displays the width of the incoming image, in pixels.
Full Height
Displays the height of the incoming image, in lines.
Trigger Mode
From the Trigger Mode list, select one of the following:
• Free Running. The camera and frame grabber run continuously. When the
camera finishes an exposure, the frame grabber board copies the image to target
memory using DMA and signals a frame completion interrupt. Upon receiving the
interrupt, the model runs and performs image processing.
• Timer Triggered. The target computer system timer starts the model. When
the model runs, it simultaneously starts a camera exposure and begins to process
the image captured during the previous time step. When the camera finishes the
14-18
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
NEON BitFlow Image Input
exposure, the frame grabber copies the image to target memory using DMA for
processing in the next time step.
• Differential Trigger. A rising edge on the differential trigger input triggers
the camera. When the camera finishes the exposure, the frame grabber copies the
image to target memory using DMA and signals a frame completion interrupt.
Upon receiving the interrupt, the model runs and performs image processing.
• TTL Trigger. A rising edge on the TTL trigger input triggers the camera.
The model runs from the frame completion interrupt, as with Differential
Trigger.
• Opto Trigger. A rising edge on the Opto trigger input triggers the camera.
The model runs from the frame completion interrupt, as with Differential
Trigger.
The camera configuration file determines whether you can use the block mask to
switch the trigger mode to another mode, such as Free Running. You may need to
contact BitFlow for a camera configuration file for the mode that you want.
Acquisition Region of Interest
Select a rectangular region of the full image to output from the block. When you
select a new camera configuration file, these values are set to the full size of the
image specified in the configuration file.
Column 0, row 0 is in the upper left corner of the image.
Starting Column
Column numbers are 0-based.
Starting Row
Row numbers are 0-based.
Columns
The number of columns plus the starting column must be less than the full image
width.
Rows
The number of rows plus the starting row must be less than the full image
height.
Camera configuration serial command
Select the serial port configuration and specify a command to send to the camera
when the model starts executing.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
14-19
14
Video Image Processing
Baud Rate
Select one of the following: 9600, 19200, 38400, 57600, 115200, 230400, or
460800 baud.
Bits per Byte
Select one of the following: 5, 6, 7, or 8. Most camera configurations use 8 bits per
byte.
Parity
Select one of the following: None, Even, Odd, Mark, or Space.
Stop Bits
Select either 1 or 2.
Command String
Enter a command string to send to your camera. The exact format of the string
depends on the camera.
Display camera response string
Select this check box to display the camera response to the command string.
Nonprintable control codes are printed as C escape sequences.
Camera Configuration comments
Displays comments from BitFlow, Inc., about this configuration.
Sample time
Enter a base sample time or a multiple of the base sample time.
If you configure the real-time application to use the board interrupt, the application
adds the sample time to the displayed execution time.
PCI slot (-1:autosearch)
If only one board of this type is in the target computer, enter -1 to locate the board.
If two or more boards of this type are in the target computer, enter the bus number
and the PCI slot number of the board associated with this driver block. Use the
format [BusNumber,SlotNumber].
To determine the bus number and the PCI slot number, type:
tg = slrt;
getPCIInfo(tg, 'installed')
14-20
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
NEON BitFlow Image Input
See Also
USB Video Device List | Video Display | To Video Display | JPEG Compression | JPEG
Decompression
How To
•
“Camera Link Camera Triggering” on page 14-8
•
“Serial Camera Configuration” on page 14-12
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
14-21
14
Video Image Processing
From USB Video Device
From USB Video Device block
Library
Simulink Real-Time Library for USB Camera
Description
The From USB Video Device block enables you to acquire real-time video frames or still
images from a USB Video Class (UVC) webcam attached to a USB port on the target
computer. On the acquired image signal, perform the following:
• Display the output on the target computer monitor using a Video Display block.
• Stream captured frames to the development computer display (for example, using the
To Video Display block from Computer Vision System Toolbox).
• Analyze the image signals on the development computer.
• Compress or decompress the input signal with the JPEG Compression or JPEG
Decompression blocks.
When you add this block, also add the USB Video Device List block to help configure the
webcam.
The Image signal setting determines the Image signal setting for blocks receiving this
signal, such as the Video Display block.
Block Parameters
Configuration
Select a configuration that you specified in the USB Video Device List block. When
you click the Reload Device List button on the USB Video Device List block, this
configuration list is updated.
Port address (-1 for any)
14-22
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
From USB Video Device
Specify the port to which the webcam is attached. Enter -1 for any USB port.
Image width
Enter the width of the image input from the USB port, in pixels.
Image height
Enter the height of the image input from the USB port, in pixels.
Frame interval
Select the sample time between frame transfers:
• 1/60
• 1/30
• 1/25
• 1/20
• 1/15
• 1/10
• 1/7.5
• 1/5
Frame format
Select whether the incoming frames are to be compressed:
• Uncompressed
Do not compress frames.
• MJPEG
Compress frames using Motion JPEG format. Each frame is individually
compressed as a JPEG image. Selecting this option disables the Color format
and Image signal parameters.
Color format
Select the color format for the incoming frames:
• RGB24 (8:8:8)
Output frames using RGB24 color encoding.
• YCbCr (4:2:2)
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
14-23
14
Video Image Processing
Output frames using YCbCr color encoding.
Image signal
• One multidimensional signal
One signal where each dimension contains color information. Selecting this option
creates one port, Image.
• Separate color signals
Multiple color signals where each signal contains the information for one color.
Selecting this option creates the following ports, depending upon the colorspace.
• RGB: R, G, B
• YCbCr: Y, Cb, Cr
Show trigger input
Select this check box to display an input port, Trigger, for the block.
Show length output
Select this check box to display an output port, Length, for the block.
See Also
USB Video Device List | Video Display | To Video Display | JPEG Compression | JPEG
Decompression
How To
14-24
•
“Camera Link Camera Triggering” on page 14-8
•
“Serial Camera Configuration” on page 14-12
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Image Receive
Image Receive
Image Receive block
Library
Simulink Real-Time Library for Video Utilities
Description
The Image Receive block receives the video from the target computer located at the IP
address and port pair.
Block Parameters
IP address to receive from (0.0.0.0 for accepting all)
Enter a valid IP address as a dotted decimal string for the source address, for
example, 10.10.10.3. You can also use a MATLAB expression that returns a valid IP
address as a string.
The default address, 0.0.0.0, enables the acceptance of frames from any accessible
target computer. If set to a specific IP address, packets arriving from only that IP
address are received.
The IP port to receive from parameter specifies the port for the source.
IP port to receive from
Specify the port of the computer from which to receive the video frames. The IP
address to receive from (0.0.0.0 for accepting all) parameter specifies the IP
address for the source.
Use the following local IP port (-1 for automatic port assignment)
Specify the port of the computer receiving the video frames.
Enter -1 to automatically assign a port for the computer.
Allow variable length packets
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
14-25
14
Video Image Processing
Select this check box to enable the reception of variable-length frames. For example,
use this option for compressed frames, because the length of each frame varies.
If this check box is selected, the port sends the actual data. If the port size is less
than the size of the actual data, the block sends up to the allowed length of data.
Selecting this block creates a Length input port.
If this check box is cleared (default), the block receives only fixed-length packets.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
See Also
Image Transmit
14-26
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Image Transmit
Image Transmit
Image Transmit block
Library
Simulink Real-Time Library for Video Utilities
Description
The Image Transmit block sends the video frame from the target computer to the
development computer located at the IP address and port pair.
Block Parameters
IP address sent to (255.255.255.255 for broadcast)
Specify the IP address of the target computer to which you send the video frames. To
broadcast the video frames to all listening computers, enter 255.255.255.255. The
Remote IP port to send to parameter specifies the port for the destination.
Remote IP port to send to
Specify the target computer port to which you send the video frames. The IP
address sent to (255.255.255.255 for broadcast) parameter specifies the IP
address for the destination.
Use the following local IP port (-1 for automatic port assignment)
Specify the target computer port from which to send the video frames.
Enter -1 to automatically assign a port for the target computer.
Allow variable length packets
Select this check box to enable the transmission of variable-length frames. For
example, use this option for compressed frames, because the length of each frame
varies.
If this check box is selected, the port sends the actual data. If the port size is less
than the size of the actual data, the block sends up to the allowed length of data.
Selecting this block creates a Length input port.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
14-27
14
Video Image Processing
If this check box is cleared (default), the block sends only fixed-length packets.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
See Also
Image Receive
14-28
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
JPEG Compression
JPEG Compression
JPEG Compression block
Library
Simulink Real-Time Library for Video Utilities
Description
The JPEG Compression block compresses the video frame received by the target
computer.
Block Parameters
Compression quality (-1:default)
Enter a value between 0 and 100 to specify how much to compress the incoming
video frame. The lower the value, the less the compression quality.
Enter -1 to use the default compression quality for the video frame.
Input colorspace
One of the following:
• Grayscale
Compress the video frame using a grayscale color space scheme.
• YCbCr 4;4:4
Compress the video frame using the YCbCr color space scheme.
• RGB
Compress the video frame using the red, blue, green (RGB) color space scheme.
Image signal
• One multidimensional signal
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
14-29
14
Video Image Processing
One signal where each dimension contains color information. Selecting this option
creates one port, Image.
• Separate color signals
Multiple color signals where each signal contains the information for one color.
Selecting this option creates the following ports, depending upon the colorspace.
• Grayscale: Image
• RGB: R, G, B
• YCbCr: Y, Cb, Cr
Max output image size (bytes)
Enter the maximum output size for the compressed video frame, in bytes. Use format
height * width.
Show output image length
Select this check box to output the video frame length. Selecting this check box
displays the Length port.
See Also
JPEG Decompression
14-30
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
JPEG Decompression
JPEG Decompression
JPEG Decompression block
Library
Simulink Real-Time Library for Video Utilities
Description
The JPEG Decompression block decompresses the video frame received by the target
computer.
Block Parameters
Image width
Specify the width, in bytes, of the video frame to be decompressed.
Image height
Specify the height, in bytes, of the video frame to be decompressed.
Output colorspace
One of the following:
• Grayscale
Compress the video frame using a grayscale color space scheme.
• YCbCr 4;4:4
Compress the video frame using the YCbCr color space scheme.
• RGB
Compress the video frame using the red, blue, green (RGB) color space scheme.
Image signal
• One multidimensional signal
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
14-31
14
Video Image Processing
One signal where each dimension contains color information. Selecting this option
creates one port, Image.
• Separate color signals
Multiple color signals where each signal contains the information for one color.
Selecting this option creates the following ports, depending upon the colorspace.
• Grayscale: Image
• RGB: R, G, B
• YCbCr: Y, Cb, Cr
Show trigger input
Select this check box to display an input port, Trigger, for the block.
See Also
JPEG Compression
14-32
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
USB Video Device List
USB Video Device List
USB Video Device List block
Library
Simulink Real-Time Library for USB Camera
Description
When you connect a USB Video Class (UVC) webcam to the target computer, the USB
Video Device List block probes the device and displays the manufacturer information
of the webcam. Based on this information, the block configures its parameters with
supported options. You can select the configuration parameters required by your USB
webcam, and then name the configuration for future use.
When you add the From USB Video Device block to your model, add the USB Video
Device List block. You need the USB Video Device List block to configure the webcam.
Block Parameters
Manufacturer
Select the manufacturer for the installed webcam.
Format
Select an image format that the connected webcam supports, for example, MJPEG.
Resolution
Select a supported resolution for the image.
Interval
Select the sample time for the video frame.
Configurations
Use this parameter to store and name a particular configuration. A configuration
consists of the settings that you select for a particular webcam.
After you select the options in the other parameters:
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
14-33
14
Video Image Processing
1
In the edit field, enter a name for the configuration.
2
Click the Add button to add the configuration.
To remove the configuration, click the Remove button.
Reload Device List
Click this button to refresh the list of webcam information. Clicking this button also
updates the mask and parameters for the From USB Video Device block.
See Also
From USB Video Device
14-34
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Video Display
Video Display
Video Display block
Library
Simulink Real-Time Library for Video Utilities
Description
When you add the Video Display block to your model, you can display an RGB video
signal on the target computer. The signal can come from a USB Video webcam, a Camera
Link camera, or even a constant block.
The Image signal setting must match the Image signal setting for the camera output
block.
There can be no more than two Video Display blocks in a model. The combined number of
Video Display blocks and target scopes cannot exceed nine.
Block Parameters
Image signal
• One multidimensional signal
One signal where each dimension contains color information. Selecting this option
creates one port.
• Separate color signals
Multiple color signals where each signal contains the information for one color.
Selecting this option creates three ports.
Image colorspace
Can only be RGB.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
14-35
14
Video Image Processing
See Also
“Target Scope Usage”
14-36
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
15
XCP Support
• “XCP Protocol” on page 15-2
• “XCP Block Usage” on page 15-3
• “Blocks — Alphabetical List” on page 15-4
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
15
XCP Support
XCP Protocol
The Universal Measurement and Calibration Protocol (XCP) is a network protocol for
connecting calibration systems to electronic control units (ECUs). The Simulink RealTime software supports this capability with the XCP sublibrary. A model that contains
the blocks from this library can act as an XCP master that communicates with CAN or
UDP network slave or ECU devices. Using the XCP sublibrary, you can:
• Parse A2L (ASAP2 database) files.
• Synchronize one or more slave or ECU devices.
• Initialize an XCP slave server running in an ECU.
• Support data stimulation.
• Acquire real-time measurement data when specific events occur.
15-2
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
XCP Block Usage
XCP Block Usage
When you create models to work as XCP masters with ECU slaves:
• Provide an A2L (ASAP2) format file that contains signal and parameter access
information for the slave ECUs and for the XCP-specific network elements. Use an
XCP Configuration block to load this data into the XCP database.
• Send stimulus data to the slave device using the XCP Data Stimulation block.
• Read measurement data from the slave device using the XCP Data Acquisition block.
• Use one XCP CAN Transport Layer or XCP UDP Transport Layer block for each XCP
Configuration block.
If you are implementing the transport layer using CAN, use FIFO mode with the XCP
blocks, not object mode. See “FIFO Mode”.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
15-3
15
XCP Support
Blocks — Alphabetical List
XCP UDP Transport Layer
XCP CAN Transport Layer
15-4
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
XCP UDP Transport Layer
XCP UDP Transport Layer
Sends and receives XCP messages over real-time UDP
Library
Simulink Real-Time Library for XCP
Description
The XCP UDP Transport Layer block uses the specified Ethernet device to send and
receive XCP messages. Select the Ethernet device using the PCI bus and slot numbers.
Block Parameters
Master IP Address
Enter the IP address for the UDP master node.
Simulink Real-Time supports modeling the UDP master node only.
Port
UDP port that the transport layer uses.
Subnet Mask
Enter the subnet mask for the interface.
Gateway
Enter the gateway address for the interface.
Ethernet Driver
Identifies the Ethernet driver for each chip family supported. Possible values are
Intel 8255X and Intel Gigabit.
PCI Bus
Enter the PCI bus number for the Ethernet card.
PCI Slot
Enter the PCI slot number for the Ethernet card.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
15-5
15
XCP Support
Disable CTR error detection
Select this check box to turn off bus controller error detection.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
See Also
XCP Configuration | XCP Data Stimulation | XCP Data Acquisition
15-6
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
XCP CAN Transport Layer
XCP CAN Transport Layer
Generates and consumes XCP messages that are sent and received using CAN hardware
Library
Simulink Real-Time Library for XCP
Block Inputs and Outputs
Inputs
Name
Description
CAN Msg
Vector of CAN MESSAGE structures being
consumed
N
Number of messages in the vector
Outputs
Name
Description
CAN Msg
Vector of CAN MESSAGE structures being
generated
N
Number of messages in the vector
Description
The XCP CAN Transport Layer block handles CAN messages that are transmitted or
received by the CAN blocks in the Simulink Real-Time Library.
Connect the input side of the block to a block that receives CAN messages. Connect the
output side of the block to a block that transmits the XCP messages over CAN. You
must set up the transmitting block so that a CAN message is sent only when an XCP
message is available. Otherwise, the block sends 0 byte data when XCP messages are not
available, causing undefined behavior.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
15-7
15
XCP Support
See Also
XCP Configuration | XCP Data Stimulation | XCP Data Acquisition
15-8
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
16
Adlink
This topic describes the I/O boards supported by the Simulink Real-Time product (http://
www.adlinktech.com).
Adlink PCI-6208
Digital-to-analog converter board with four
bits of digital input and four bits of digital
output lines.
“Boards and Blocks — Alphabetical List” on Description of block parameters for Adlink
page 16-2
driver blocks.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
16
Adlink
Boards and Blocks — Alphabetical List
16-2
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Adlink PCI-6208
Adlink PCI-6208
Support for the Adlink PCI-6208 digital-to-analog converter board
Board
Adlink PCI-6208
General Description
The Adlink PCI-6208A is a digital to analog converter board. This board has four bits of
digital input and four bits of digital output lines.
The Simulink Real-Time block library supports this board with the following driver
blocks:
• Adlink PCI-6208A Analog Output
• Adlink PCI-6208A Digital Input
• Adlink PCI-6208A Digital Output
Board Characteristics
Board name
PCI-6208A
Manufacturer
Adlink
Bus type
PCI
Access method
I/O mapped
Multiple block instance support
No
Multiple board support
Yes
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
16-3
16
Adlink
Adlink PCI-6208A Analog Output
Adlink PCI-6208A Analog Output block
Library
Simulink Real-Time Library for Adlink
Scaling Output to Input
Hardware Output
Block Input Data Type
Scaling
ma
Double
1
Block Parameters
Channel vector
Enter a vector of numbers to specify the output channels.
For example, to use the first and second analog output (D/A) channels enter
[1, 2]
The channel numbers can occur in arbitrary order. Number the channels beginning
with 1 even though the board manufacturer numbers them beginning with 0. The
maximum allowable channel number is 4.
Range
From the list, choose
• 0 to 20 ma
• 5 to 25 ma
• 4 to 20 ma
Signal input to the block is in milliamperes (mA). The output voltage maximum is
10 volts. If the resistance is too large to get the chosen current, the voltage measured
across the output load will saturate.
16-4
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Adlink PCI-6208A Analog Output
For example, assume an input sine wave with:
Input = 10*sin(omega*t) + 10
If you set the range to 0 to 20 ma, the current should oscillate from 0 to 20 ma at
omega radians per second. The current will only reach 20 ma if the load resistance
is less than or equal to 500 ohms. If the load resistance is 1000 ohms, the maximum
current that 10 volts can drive is only 10 ma. The top half of the sine wave will be
clipped off.
Note the following:
• This block is scaled for the current output ports, not the voltage output ports.
• This block limits output to positive values only. This is in response to the board
hardware manual caution that states driving a negative voltage from the D/
A converter to the voltage to current output board might cause damage to the
current output.
Reset vector
The reset vector controls the behavior of the channel at model termination. Enter a
scalar or a vector that is the same length as the channel vector. If you specify a scalar
value, that setting is replicated over the channel vector. If you specify a value of 1,
the corresponding channel is reset to the value specified in the initial value vector.
If you specify a value of 0, the channel remains at the last value attained while the
model was running. For example, if Channel vector is [1 2] and the Reset vector
is [1], the action taken will be the same as if Reset vector was set to [1 1]. Both
channels will be reset to their initial values when model execution is stopped.
Initial value vector
The initial value vector contains the initial current values for the output channels.
Enter a scalar or a vector that is the same length as the channel vector. If you specify
a scalar value, that value is replicated as initial value over the channel vector. The
channels are set to the initial values between the time the model is downloaded and
the time it is started. When model execution is stopped, the corresponding position
in Reset vector is checked. Depending on that value, the channel is either reset to
the initial value or remains at the last value attained while the model was running.
For example, assume that Channel vector is [1 2], Reset vector is [1 0], and
Initial value vector is [2.3 5.6]. On initial download, channel 1 is set to 2.3 ma
and channel 2 to 5.6 ma. When the model is stopped, channel 1 resets to 2.3 ma and
channel 2 remains at the last value attained.
Sample time
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
16-5
16
Adlink
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
16-6
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Adlink PCI-6208A Digital Input
Adlink PCI-6208A Digital Input
Adlink PCI-6208A Digital Input
Library
Simulink Real-Time Library for Adlink
Scaling Input to Output
Hardware Input
Block Output Data Type
Scaling
TTL
Double
TTL low = 0
TTL high = 1
Block Parameters
Channel vector
Enter a vector of numbers to specify the digital input port ports.
For example, to use the first and second digital input channels enter
[1, 2]
The channel numbers can occur in arbitrary order. Number the channels beginning
with 1 even though the board manufacturer numbers them beginning with 0. The
maximum allowable channel number is 4. Each input can be listed at most once in
this vector.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
PCI slot
If only one board of this type is in the target computer, enter -1 to locate the board.
If two or more boards of this type are in the target computer, enter the bus number
and the PCI slot number of the board associated with this driver block. Use the
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
16-7
16
Adlink
format [BusNumber,SlotNumber]. To determine the bus number and the PCI slot
number, type:
tg = slrt;
getPCIInfo(tg, 'installed')
16-8
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Adlink PCI-6208A Digital Output
Adlink PCI-6208A Digital Output
Adlink PCI-6208A Digital Output
Library
Simulink Real-Time Library for Adlink
Scaling Input to Output
Hardware Output
Block Input Data Type
Scaling
TTL
Double
< 0.5 = TTL low
> 0.5 = TTL high
Block Parameters
Channel vector
Enter a vector of numbers to specify the digital output channels.
For example, to use the first and second analog digital output channels enter
[1, 2]
The channel numbers can occur in arbitrary order. Number the channels beginning
with 1 even if the board manufacturer numbers them beginning with 0. The
maximum allowable channel number is 8.
Reset vector
The reset vector controls the behavior of the channel at model termination. Enter a
scalar or a vector that is the same length as the channel vector. If you specify a scalar
value, that setting is replicated over the channel vector. If you specify a value of 1,
the corresponding channel is reset to the value specified in the initial value vector.
If you specify a value of 0, the channel remains at the last value attained while the
model was running. For example, if Channel vector is [1 2] and the Reset vector
is [1], the action taken will be the same as if Reset vector was set to [1 1]. Both
channels will be reset to their initial values when model execution is stopped.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
16-9
16
Adlink
Initial value vector
The initial value vector contains the initial voltage values for the digital output
channels. Enter a scalar or a vector that is the same length as the channel vector. If
you specify a scalar value, that value is replicated as initial value over the channel
vector. The channels are set to the initial values between the time the model
is downloaded and the time it is started. When model execution is stopped, the
corresponding position in Reset vector is checked. Depending on that value, the
channel is either reset to the initial value or remains at the last value attained while
the model was running. For example, assume that Channel vector is [ 1 2 ],
Reset vector is [1 0], and Initial value vector is [0 1]. On initial download,
channel 1 is set to off and channel 2 to on. When the model is stopped, channel 1
resets to off and channel 2 remains at the last value attained.
If the Initial value vector value is greater than 0.5, the corresponding digital
output port is turned on, otherwise it is turned off.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
PCI slot
If only one board of this type is in the target computer, enter -1 to locate the board.
If two or more boards of this type are in the target computer, enter the bus number
and the PCI slot number of the board associated with this driver block. Use the
format [BusNumber,SlotNumber]. To determine the bus number and the PCI slot
number, type:
tg = slrt;
getPCIInfo(tg, 'installed')
16-10
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
‫‪17‬‬
‫‪BittWare‬‬
‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ | ‪www.MatlabSite.com‬‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
17
BittWare
Running Models with BittWare Blocks
In this section...
“Model Notes” on page 17-2
“Frame Size, Sample Rate, and Sample Time Parameter Notes” on page 17-4
Model Notes
This topic describes notes on working with models that use the BittWare blocks.
• “Model Execution Timing” on page 17-2
• “Example Models” on page 17-3
• “Model Execution Limitations” on page 17-3
Model Execution Timing
To run the model, the Simulink Real-Time model is executed when each frame completes
on the board. Set the simulation parameters to use the interrupt from the Audio-PMC+
rather than the timer interrupt when running the model. First, you need to determine
the interrupt vector number to which the board is set. This is determined by the BIOS in
the target computer when the hardware starts.
1
From the MATLAB Command Window, type
tg = slrt;
getPCIInfo(tg, 'installed')
This command lists board information for the installed PCI devices that the
Simulink Real-Time software knows about.
2
Find the IRQ specified for this board. This is the interrupt source number you need
to specify in the Real-time interrupt source field of the Simulink Real-Time
Options node.
Set the interrupt vector number:
1
From the MATLAB Command Window, type the name of your Simulink model.
The Simulink model appears
2
17-2
Click Simulation > Model Configuration Parameters.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Running Models with BittWare Blocks
The Configuration Parameter dialog box is displayed for the model.
3
Select the Simulink Real-Time Options node under the Code Generation node.
4
Set the Execution mode field to Real-Time.
5
Click the Real-time interrupt source list.
6
Select the interrupt source number to which the board is set.
7
Click the I/O board generating the interrupt list and select AudioPMC+ from the
list.
8
Click OK and save the model.
Failure to set the interrupt vector as described, which results in your using the Simulink
Real-Time timer, will not stop the model from running. However, you will occasionally
see corrupt data since the Audio-PMC+ clock and the Simulink Real-Time timer drift
relative to each other and will sometimes overlap.
Example Models
Two example models are included with this version in the xpcdemos folder. To operate
these, set the required interrupt source in the simulation parameters dialog.
xpc8audiochannels shows the use of all 8 input and 8 output channels at the same
time. A block from DSP System Toolbox™ is used to convert from frame to sample based
signals to drive the Simulink Real-Time scopes.
xpcaudiospectrum uses the Simulink Real-Time Spectrum Scope subsystem from
the xpcdspspectrum sample model with the Audio-PMC+ as the source. This model
requires that Frame Size be set to 1 because of the way the spectrum scope displays the
results.
Model Execution Limitations
Model execution is entered each time a frame completes on the Audio-PMC+ board. The
frame rate is the fastest clock available. You cannot obtain a minor step execution that
runs more frequently than frame completions. To execute a multirate model, you must
use the frame completion time as the fastest rate. The audio input and audio output
blocks must be executed at the fastest rate in the model.
Input and output data from these blocks is in the form of a frame of data as used by DSP
System Toolbox. If the frame size is 1, then the blocks revert to sample based signals.
The blocks in DSP System Toolbox expect to see signals that are frames.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
17-3
17
BittWare
Frame Size, Sample Rate, and Sample Time Parameter Notes
Experimentally, with all 8 input and all 8 output channels in use, the Audio-PMC+ can
run with sample rates below the following frequencies as a function of Frame Size:
Frame Size
Maximum Sample
Rate
1
15 kHz
2
30 kHz
3
40 kHz
4
45 kHz
8
70 kHz
16
80 kHz
32
80 kHz
64
100 kHz
128
100 kHz
256
100 kHz
If fewer than 8 inputs and outputs are in use, then the maximum sample rate increases.
Frame Size
1 Channel
2 Channels
4 Channels
6 Channels
8 Channels
1
30 kHz
30 kHz
25 kHz
18 kHz
15 kHz
2
60 kHz
60 kHz
45 kHz
33 kHz
30 kHz
These above rates were obtained from testing at MathWorks. As with all hardware
benchmarks, results might vary, depending on a number of hardware conditions.
For example, the following hardware elements, among others, might change your
throughput:
• The PCI bus interface chip set on the motherboard
• Main memory speed
• General motherboard architecture
17-4
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
‫‪BVM, Contec, Curtiss-Wright‬‬
‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ | ‪www.MatlabSite.com‬‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ | ‪www.MatlabSite.com‬‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
18
BVM
This topic describes the BVM I/O board supported by the Simulink Real-Time product
(http://www.bvmltd.co.uk).
BVM PMCDIO64
A 64-bit digital I/O board with two ports. Each port can
be configured to be either 32 independent 1-bit channels
or a single 32-bit wide integer channel.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
18
BVM
Boards and Blocks — Alphabetical List
BVM PMCDIO64
BVM PMCDIO64 Digital Input
BVM PMCDIO64 Digital Output
18-2
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
BVM PMCDIO64
BVM PMCDIO64
Support for 64–bit digital I/O
Board
BVM PMCDIO64
General Description
The PMCDIO64 is a 64-bit digital I/O board. The hardware provides 64 bits, which the
driver splits into two ports of 32 bits each. Each port can be configured to be either input
or output. In addition, each port can be configured to be either 32 independent 1-bit
channels or a single 32-bit wide integer channel.
The Simulink Real-Time block library supports this board with these driver blocks:
• BVM PMCDIO64 Digital Input
• BVM PMCDIO64 Digital Output
Board Characteristics
Board name
PMCDIO64
Manufacturer
BVM
Bus type
PCI
Access method
Memory mapped
Multiple block instance support
Yes
Multiple board support
Yes
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
18-3
18
BVM
BVM PMCDIO64 Digital Input
PMCDIO64 Digital Input block
Library
Simulink Real-Time Library for BVM
Scaling Input to Output
Hardware Input
Block Output Data Type
Scaling
TTL
double
TTL low = 0.0
TTL high = 1.0
Block Parameters
Format
From the list, select either 32 One bit channels or Single 32 bit port.
If the format is 32 One bit channels, then the channel vector specifies the
configuration of the block. Each output is a double with value of 0 or 1. The value is 0
when the hardware input voltage is low.
If the format is Single 32 bit port, then the output from the block is a 32-bit
integer, where the 32 bits on the hardware feed into the single output. The channel
vector is not used in this mode and is unavailable on the Block Parameters dialog
box. The least significant bit is the lowest numbered bit in the hardware manual.
Channel vector
This is a vector of channels. This parameter is only used when the format is 32 One
bit channels. Channels are numbered from 1 to 32 even though the hardware
manual labels them 0 to 31.
Port
Each half of the 64 bits is a separate port. Port 1 is the lower 32 bits and Port 2 is the
upper 32 bits. You can use one port for input and the other port for output.
18-4
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
BVM PMCDIO64 Digital Input
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
PCI slot (-1:autosearch)
If only one board of this type is in the target computer, enter -1 to locate the board.
If two or more boards of this type are in the target computer, enter the bus number
and the PCI slot number of the board associated with this driver block. Use the
format [BusNumber,SlotNumber].
To determine the bus number and the PCI slot number, type:
tg = slrt;
getPCIInfo(tg, 'installed')
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
18-5
18
BVM
BVM PMCDIO64 Digital Output
PMCDIO64 Digital Output block
Library
Simulink Real-Time Library for BVM
Scaling Input to Output
Hardware Output
Block Input Data Type
Scaling
TTL
double
< 0.5 = TTL low
≥ 0.5 = TTL high
Block Parameters
Format
From the list, choose either 32 One bit channels or Single 32 bit port.
If the format is 32 One bit channels, then the channel vector specifies the
configuration of the block. Each input is a double. The hardware output is set to low
voltage if the input is < 0.5 and high voltage if the input is ≥ 0.5.
If the format is Single 32 bit port, then the input to the block is a 32-bit integer
where the 32 bits on the hardware are controlled by the single input. The channel
vector is not used in this mode and is unavailable on the Block Parameters dialog
box. The least significant bit is the lowest numbered bit in the hardware manual.
Channel vector
This is a vector of channels and is only used when the format is 32 One bit
channels. Channels are numbered from 1 to 32 even though the hardware manual
labels them 0 to 31. Hardware I/O signal numbers IO32 to IO63 are acquired by
choosing Port 2 and channels 1 to 32.
Reset action vector
18-6
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
BVM PMCDIO64 Digital Output
If you chose 32 One bit channels, enter a vector of 1's and 0's that is the same
length as the channel vector. A value of 1 indicates that the channel is reset to the
value in the initial value vector when the model is stopped. A value of 0 indicates
that the output remains at the last value written when the model is stopped. If you
enter a scalar value, that value is used for all channels.
If you chose Single 32 bit port, enter a 1 or a 0 to determine what happens
when the model is stopped. If you enter 1, the 32 bits of the output are reset to the
value given by the initial value vector. If you enter 0, the output remains at the last
value written when the model is stopped.
Initial value vector
If you chose 32 One bit channels, this vector determines both the initial value of
the outputs at model download time and the values when model execution is stopped.
A value of 1 for a given channel sets the output for that channel to 1 while any other
value sets the output to 0.
If you chose Single 32 bit port, enter the scaler value to write to the output
port. The value can be a hexadecimal or a decimal. If it is a hexadecimal, then use
C syntax. For example, 0xaaaaaaaa in hexadecimal would be the equivalent of
2863311530 in decimal.
Port
Each half of the 64 bits is a separate port. Port 1 is the lower 32 bits and Port 2 is the
upper 32 bits. You can use one port for input and the other port for output. In a given
model, each port can only be set to one direction.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
PCI slot (-1:autosearch)
If only one board of this type is in the target computer, enter -1 to locate the board.
If two or more boards of this type are in the target computer, enter the bus number
and the PCI slot number of the board associated with this driver block. Use the
format [BusNumber,SlotNumber].
To determine the bus number and the PCI slot number, type:
tg = slrt;
getPCIInfo(tg, 'installed')
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
18-7
‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ | ‪www.MatlabSite.com‬‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
19
Contec
This topic describes the Contec I/O boards supported by the Simulink Real-Time product
(http://www.contec.com).
Contec AD12-16(PCI)
I/O board with 16 single-ended or 8 differential
analog input (A/D) channels (12 bit), 4 digital input
lines, and 4 digital output lines.
Contec AD12-16(PCI)E
I/O board with 16 single-ended or 8 differential
analog input (A/D) channels (12 bit), one analog
output channel (12 bit), 4 digital input lines, 4
digital output lines, and an i8254-compatible
counter.
Contec AD12-16U(PCI)E
I/O board with 16 single-ended or 8 differential
analog input (A/D) channels (12 bit), one analog
output channel (12 bit), 4 digital input lines, 4
digital output lines, and an i8254-compatible
counter.
Contec AD12-64(PCI)
I/O board with 64 single-ended or 32 differential
analog input (A/D) channels (12 bit), 4 digital input
lines, and 4 digital output lines.
Contec AD16-16(PCI)E
I/O board with 16 single-ended or 8 differential
analog input (A/D) channels (16 bit), one analog
output channel (16 bit), 4 digital input lines, 4
digital output lines, and an i8254-compatible
counter.
Contec ADI12-16(PCI)
I/O board with 16 single-ended or 8 differential
analog input (A/D) channels (12 bit), 4 digital input
lines, and 4 digital output lines.
Contec CNT24-4D(PCI)
24-bit differential up/down counter board with four
channels.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
19
Contec
Contec CNT32-8M(PCI)
32-bit high-speed up/down counter board with eight
channels.
Contec DA12-16(PCI)
I/O board with 16 analog output (D/A) channels (12
bit).
Contec DA12-4(PCI)
I/O board with 4 analog output (D/A) channels (12
bit).
Contec PI-64L(PCI)H
Digital input board with 64 digital input channels.
Contec PIO-32/32F(PCI)
Opto-isolated high-speed I/O board with 32 digital
input channels and 32 output channels.
Contec PIO-32/32L(PCI)H
I/O board with 32 digital input channels and 32
output channels.
Contec PIO-32/32T(PCI)
I/O board with 32 digital input lines and 32 digital
output lines.
Contec PO-64L(PCI)H
Digital output board with 64 digital output
channels.
“Boards and Blocks — Alphabetical Description of block parameters for Contec driver
blocks.
List” on page 19-3
19-2
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Boards and Blocks — Alphabetical List
Boards and Blocks — Alphabetical List
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
19-3
19
Contec
Contec AD12-16(PCI)
Contec AD12-16(PCI) board
Board
Contec AD12-16(PCI)
General Description
The Contec AD12-16(PCI) is an I/O board with 16 single-ended or 8 differential analog
input (A/D) channels (12 bit), 4 digital input lines, and 4 digital output lines.
The Simulink Real-Time block library supports this board with these driver blocks:
• Contec AD12-16(PCI) Analog Input (A/D)
• Contec AD12-16(PCI) Digital Input
• Contec AD12-16(PCI) Digital Output
The Simulink Real-Time software does not support the Counter/Timer functionality of
the board.
Board Characteristics
19-4
Board name
AD12-16(PCI)
Manufacturer
Contec
Bus type
PCI
Access method
I/O mapped
Multiple block instance support
No
Multiple board support
Yes
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Contec AD12-16(PCI) Analog Input (A/D)
Contec AD12-16(PCI) Analog Input (A/D)
Contec AD12-16(PCI) Analog Input (A/D) block
Library
Simulink Real-Time Library for Contec
Scaling Input to Output
Hardware Input
Block Output Data Type
Scaling
Volts
Double
1
Block Parameters
Channel vector
Enter a vector of numbers to specify the input channels. For example to use the first
three analog input (A/D) channels, enter
[1, 2, 3]
The channel numbers can occur in arbitrary order. Number them beginning with 1
even if the board manufacturer numbers them beginning with 0.
The maximum allowable channel number for this board is 8 (differential-ended) or 16
(single-ended). If the highest channel number you specify is n, the hardware converts
all the channels between 1 and n, whether or not they occur in your channel vector.
It is more efficient to specify a contiguous range of channels. (Permuting the order of
such a range has little impact on efficiency however.)
Range vector
This board allows the range of each channel to be selected independently. Enter a
scalar, in which case the same value is replicated over the channel vector, or a vector
the same length as the channel vector.
The range vector entries must be range codes selected from the following table:
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
19-5
19
Contec
Input Range (V)
Range Code
Input Range (V)
Range Code
-10 to +10
-10
0 to 10
10
-5 to +5
-5
0 to 5
5
-2.5 to 2.5
-2
0 to 2.5
2
-1.25 to 1.25
-1
0 to 1.25
1
Polarity
Choose single-ended or double-ended (differential-ended). This setting is
replicated over the channel vector.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
PCI slot (-1:autosearch)
If only one board of this type is in the target computer, enter -1 to locate the board.
If two or more boards of this type are in the target computer, enter the bus number
and the PCI slot number of the board associated with this driver block. Use the
format [BusNumber,SlotNumber].
To determine the bus number and the PCI slot number, type:
tg = slrt;
getPCIInfo(tg, 'installed')
19-6
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Contec AD12-16(PCI) Digital Input
Contec AD12-16(PCI) Digital Input
Contec AD12-16(PCI) Digital Input block
Library
Simulink Real-Time Library for Contec
Scaling Input to Output
Hardware Input
Block Output Data Type
Scaling
TTL
Double
TTL low = 0.0
TTL high = 1.0
Block Parameters
Channel vector
Enter a vector of numbers to specify the input channels. For example to use the first
and third digital input channels enter
[1, 3]
The channel numbers can occur in arbitrary order. Number the channels beginning
with 1 even if the board manufacturer numbers them beginning with 0. The
maximum allowable channel number is 4.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
PCI slot (-1:autosearch)
If only one board of this type is in the target computer, enter -1 to locate the board.
If two or more boards of this type are in the target computer, enter the bus number
and the PCI slot number of the board associated with this driver block. Use the
format [BusNumber,SlotNumber].
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
19-7
19
Contec
To determine the bus number and the PCI slot number, type:
tg = slrt;
getPCIInfo(tg, 'installed')
19-8
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Contec AD12-16(PCI) Digital Output
Contec AD12-16(PCI) Digital Output
Contec AD12-16(PCI) Digital Output block
Library
Simulink Real-Time Library for Contec
Scaling Input to Output
Hardware Output
Block Input Data Type
Scaling
TTL
Double
< 0.5 = TTL low
> 0.5 TTL high
Block Parameters
Channel vector
Enter a vector of numbers to specify the output channels. For example, to use the
first and third digital output channels enter
[1, 3]
The channel numbers can occur in arbitrary order. Number the channels beginning
with 1 even if the board manufacturer numbers them beginning with 0. The
maximum allowable channel number is 4.
Reset vector
The reset vector controls the behavior of the channel at model termination. Enter a
scalar or a vector that is the same length as the channel vector. If you specify a scalar
value, that setting is replicated over the channel vector. If you specify a value of 1,
the corresponding channel is reset to the value specified in the initial value vector.
If you specify a value of 0, the channel remains at the last value attained while the
model was running.
Initial value vector
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
19-9
19
Contec
The initial value vector contains the initial values (0 or 1) of the output channels.
Enter a scalar or a vector that is the same length as the channel vector. If you enter
a scalar, that value is replicated as the initial value over the channel vector. The
channels are set to these initial values between the time the model is downloaded
and the time it is started.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
PCI slot (-1:autosearch)
If only one board of this type is in the target computer, enter -1 to locate the board.
If two or more boards of this type are in the target computer, enter the bus number
and the PCI slot number of the board associated with this driver block. Use the
format [BusNumber,SlotNumber].
To determine the bus number and the PCI slot number, type:
tg = slrt;
getPCIInfo(tg, 'installed')
19-10
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Contec AD12-16(PCI)E
Contec AD12-16(PCI)E
Contec AD12-16(PCI)E board
Board
Contec AD12-16(PCI)E
General Description
The Contec AD12-16(PCI)E is an I/O board with 16 single-ended or 8 differential analog
input (A/D) channels (12 bit), one analog output channel (12 bit), 4 digital input lines, 4
digital output lines, and an i8254-compatible counter.
The Simulink Real-Time block library supports this board with these driver blocks:
• Contec AD12-16(PCI)E Analog Input (A/D)
• Contec AD12-16(PCI)E Analog Output (D/A)
The Simulink Real-Time software does not support the digital I/O or Counter/Timer
functionality of the board.
Board Characteristics
Board name
AD12-16(PCI)E
Manufacturer
Contec
Bus type
PCI
Access method
I/O mapped
Multiple block instance support
No
Multiple board support
Yes
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
19-11
19
Contec
Contec AD12-16(PCI)E Analog Input (A/D)
Contec AD12-16(PCI)E Analog Input block
Library
Simulink Real-Time Library for Contec
Scaling Input to Output
Hardware Input
Block Output Data Type
Scaling
Volts
Double
1
Block Parameters
Channel vector
Enter a vector of numbers to specify the input channels. For example, to use the first
three analog input (A/D) channels, enter
[1, 2, 3]
The channel numbers can occur in arbitrary order. Number them beginning with
1 even if the board manufacturer numbers them beginning with 0. The maximum
allowable channel number for this board is 8 (differential-ended) or 16 (single-ended).
Gain vector
To specify the gain, enter 1, 2, 4, or 8 for each of the channels in the channel vector.
The gain vector must be the same length as the channel vector. If you enter a scalar,
the value is replicated over the channel vector.
The gain is applied to the signal prior to sampling the voltage. After the signal
voltage is sampled, the result is divided by the gain to obtain the block output signal
value. To avoid clipping, make sure that the amplified gain falls within the range you
selected.
Range
19-12
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Contec AD12-16(PCI)E Analog Input (A/D)
From the list, select Bipolar -10V to +10V or Unipolar 0V to +10V. This
value is replicated over the channel vector.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
PCI slot (-1:autosearch)
If only one board of this type is in the target computer, enter -1 to locate the board.
If two or more boards of this type are in the target computer, enter the bus number
and the PCI slot number of the board associated with this driver block. Use the
format [BusNumber,SlotNumber].
To determine the bus number and the PCI slot number, type:
tg = slrt;
getPCIInfo(tg, 'installed')
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
19-13
19
Contec
Contec AD12-16(PCI)E Analog Output (D/A)
Contec AD12-16(PCI)E Analog Output block
Library
Simulink Real-Time Library for Contec
Scaling Input to Output
Hardware Output
Block Input Data Type
Scaling
Volts
Double
1
Block Parameters
Range
From the list, select -5V to +5V, -10V to +10V, or 0 to +10V as the output
range for the analog output. This range must correspond to the output range
determined by the jumpers on the board.
Reset
This check box controls the behavior of the output channel at model termination.
If the check box is selected, the output channel is reset to the value specified as the
initial value. If the check box is not selected, the output channel remains at the most
recent value attained while the model was running.
Initial value
Enter the initial voltage value for the output channel. The output channel is set
to this value between the time the model is downloaded and the time the model is
started. Also, if the reset check box is selected, the output channel is reset to the
initial value when the model is stopped.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
PCI slot (-1:autosearch)
19-14
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Contec AD12-16(PCI)E Analog Output (D/A)
If only one board of this type is in the target computer, enter -1 to locate the board.
If two or more boards of this type are in the target computer, enter the bus number
and the PCI slot number of the board associated with this driver block. Use the
format [BusNumber,SlotNumber].
To determine the bus number and the PCI slot number, type:
tg = slrt;
getPCIInfo(tg, 'installed')
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
19-15
19
Contec
Contec AD12-16U(PCI)E
Contec AD12-16U(PCI)E board
Board
Contec AD12-16U(PCI)E
General Description
The Contec AD12-16U(PCI)E is an I/O board with 16 single-ended or 8 differential
analog input (A/D) channels (12 bit), one analog output channel (12 bit), 4 digital input
lines, 4 digital output lines, and an i8254-compatible counter.
The Simulink Real-Time block library supports this board with these driver blocks:
• Contec AD12-16U(PCI)E Analog Input (A/D)
• Contec AD12-16U(PCI)E Analog Output (D/A)
The Simulink Real-Time software does not support the digital I/O or Counter/Timer
functionality of the board.
Board Characteristics
19-16
Board name
AD12-16U(PCI)E
Manufacturer
Contec
Bus type
PCI
Access method
I/O mapped
Multiple block instance support
No
Multiple board support
Yes
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Contec AD12-16U(PCI)E Analog Input (A/D)
Contec AD12-16U(PCI)E Analog Input (A/D)
Contec AD12-16U(PCI)E Analog Input block
Library
Simulink Real-Time Library for Contec
Scaling Input to Output
Hardware Input
Block Output Data Type
Scaling
Volts
Double
1
Block Parameters
Channel vector
Enter a vector of numbers to specify the input channels. For example, to use the first
three analog input (A/D) channels, enter
[1, 2, 3]
The channel numbers can occur in arbitrary order. Number them beginning with
1 even if the board manufacturer numbers them beginning with 0. The maximum
allowable channel number for this board is 8 (differential-ended) or 16 (single-ended).
Range
From the list, select Bipolar -2.5V to +2.5V, Bipolar -5V to +5V, Unipolar
0V to +5V, or Unipolar 0V to +10V. This value is replicated over the channel
vector.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
PCI slot (-1:autosearch)
If only one board of this type is in the target computer, enter -1 to locate the board.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
19-17
19
Contec
If two or more boards of this type are in the target computer, enter the bus number
and the PCI slot number of the board associated with this driver block. Use the
format [BusNumber,SlotNumber].
To determine the bus number and the PCI slot number, type:
tg = slrt;
getPCIInfo(tg, 'installed')
19-18
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Contec AD12-16U(PCI)E Analog Output (D/A)
Contec AD12-16U(PCI)E Analog Output (D/A)
Contec AD12-16U(PCI)E Analog Output block
Library
Simulink Real-Time Library for Contec
Scaling Input to Output
Hardware Output
Block Input Data Type
Scaling
Volts
Double
1
Block Parameters
Range
From the list, select -5V to +5V, -10V to +10V, or 0 to +10V as the output
range for the analog output. This range must correspond to the output range
determined by the jumpers on the board.
Reset
This check box controls the behavior of the output channel at model termination.
If the check box is selected, the output channel is reset to the value specified as the
initial value. If the check box is not selected, the output channel remains at the most
recent value attained while the model was running.
Initial value
Enter the initial voltage value for the output channel. The output channel is set
to this value between the time the model is downloaded and the time the model is
started. Also, if the reset check box is selected, the output channel is reset to the
initial value when the model is stopped.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
PCI slot (-1:autosearch)
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
19-19
19
Contec
If only one board of this type is in the target computer, enter -1 to locate the board.
If two or more boards of this type are in the target computer, enter the bus number
and the PCI slot number of the board associated with this driver block. Use the
format [BusNumber,SlotNumber].
To determine the bus number and the PCI slot number, type:
tg = slrt;
getPCIInfo(tg, 'installed')
19-20
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Contec AD12-64(PCI)
Contec AD12-64(PCI)
Contec AD12-64(PCI) board
Board
Contec AD12-64(PCI)
General Description
The Contec AD12-64(PCI) is an I/O board with 64 single-ended or 32 differential analog
input (A/D) channels (12 bit), 4 digital input lines, and 4 digital output lines.
The Simulink Real-Time block library supports this board with these driver blocks:
• Contec AD12-64(PCI) Analog Input (A/D)
• Contec AD12-64(PCI) Digital Input
• Contec AD12-64(PCI) Digital Output
The Simulink Real-Time software does not support the Counter/Timer functionality of
this board.
Board Characteristics
Board name
AD12-64(PCI)
Manufacturer
Contec
Bus type
PCI
Access method
I/O mapped
Multiple block instance support
No
Multiple board support
Yes
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
19-21
19
Contec
Contec AD12-64(PCI) Analog Input (A/D)
Contec AD12-64(PCI) Analog Input block
Library
Simulink Real-Time Library for Contec
Scaling Input to Output
Hardware Input
Block Output Data Type
Scaling
Volts
Double
1
Block Parameters
Channel vector
Enter a vector of numbers to specify the input channels. For example, to use the first
three analog input (A/D) channels, enter
[1, 2, 3]
The channel numbers can occur in arbitrary order. Number them beginning with 1
even if the board manufacturer numbers them beginning with 0.
The maximum allowable channel number for this board is 32 (differential-ended) or
64 (single-ended). If the highest channel number you specify is n, the hardware will
convert all the channels between 1 and n, whether or not they occur in your channel
vector. It is more efficient to specify a contiguous range of channels. (Permuting the
order of such a range has little impact on efficiency however.)
Range vector
This board allows the range of each channel to be selected independently. If you enter
a scalar, the value is replicated over the channel vector. If you enter a vector, it must
be the same length as the channel vector.
The range vector entries must be range codes selected from the following table:
19-22
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Contec AD12-64(PCI) Analog Input (A/D)
Input Range (V)
Range Code
Input Range (V)
Range Code
-10 to +10
-10
0 to 10
10
-5 to +5
-5
0 to 5
5
-2.5 to 2.5
-2
0 to 2.5
2
-1.25 to 1.25
-1
0 to 1.25
1
Polarity
Choose single-ended or double-ended (differential-ended). This value is
replicated over the channel vector.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
PCI slot (-1:autosearch)
If only one board of this type is in the target computer, enter -1 to locate the board.
If two or more boards of this type are in the target computer, enter the bus number
and the PCI slot number of the board associated with this driver block. Use the
format [BusNumber,SlotNumber].
To determine the bus number and the PCI slot number, type:
tg = slrt;
getPCIInfo(tg, 'installed')
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
19-23
19
Contec
Contec AD12-64(PCI) Digital Input
Contec AD12-64(PCI) Digital Input block
Library
Simulink Real-Time Library for Contec
Scaling Input to Output
Hardware Input
Block Output Data Type
Scaling
TTL
Double
TTL low = 0.0
TTL high = 1.0
Block Parameters
Channel vector
Enter a vector of numbers to specify the input channels. For example, to use the first
and third digital input channels enter
[1, 3]
The channel numbers can occur in arbitrary order. Number the channels beginning
with 1 even if the board manufacturer numbers them beginning with 0. The
maximum allowable channel number is 4.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
PCI slot (-1:autosearch)
If only one board of this type is in the target computer, enter -1 to locate the board.
If two or more boards of this type are in the target computer, enter the bus number
and the PCI slot number of the board associated with this driver block. Use the
format [BusNumber,SlotNumber].
19-24
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Contec AD12-64(PCI) Digital Input
To determine the bus number and the PCI slot number, type:
tg = slrt;
getPCIInfo(tg, 'installed')
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
19-25
19
Contec
Contec AD12-64(PCI) Digital Output
Contec AD12-64(PCI) Digital Output block
Library
Simulink Real-Time Library for Contec
Scaling Input to Output
Hardware Output
Block Input Data Type
Scaling
TTL
Double
< 0.5 = TTL low
> 0.5 TTL high
Block Parameters
Channel vector
Enter a vector of numbers to specify the output channels. For example, to use the
first and third digital output channels enter
[1, 3]
The channel numbers can occur in arbitrary order. Number the channels beginning
with 1 even if the board manufacturer numbers them beginning with 0. The
maximum allowable channel number is 4.
Reset vector
The reset vector controls the behavior of the channel at model termination. Enter a
scalar or a vector that is the same length as the channel vector. If you specify a scalar
value, that setting is replicated over the channel vector. If you specify a value of 1,
the corresponding channel is reset to the value specified in the initial value vector.
If you specify a value of 0, the channel remains at the last value attained while the
model was running.
Initial value vector
19-26
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Contec AD12-64(PCI) Digital Output
The initial value vector contains the initial values (0 or 1) of the output channels.
Enter a scalar or a vector that is the same length as the channel vector. If you enter
a scalar, that value is replicated as the initial value over the channel vector. The
channels are set to these initial values between the time the model is downloaded
and the time it is started.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
PCI slot (-1:autosearch)
If only one board of this type is in the target computer, enter -1 to locate the board.
If two or more boards of this type are in the target computer, enter the bus number
and the PCI slot number of the board associated with this driver block. Use the
format [BusNumber,SlotNumber].
To determine the bus number and the PCI slot number, type:
tg = slrt;
getPCIInfo(tg, 'installed')
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
19-27
19
Contec
Contec AD16-16(PCI)E
Contec AD16-16(PCI)E board
Board
Contec AD16-16(PCI)E
General Description
The Contec AD16-16(PCI)E is an I/O board with 16 single-ended or 8 differential analog
input (A/D) channels (16 bit), one analog output channel (16 bit), 4 digital input lines, 4
digital output lines, and an i8254-compatible counter.
The Simulink Real-Time block library supports this board with these driver blocks:
• Contec AD16-16(PCI)E Analog Input (A/D)
• Contec AD16-16(PCI)E Analog Output (D/A)
The Simulink Real-Time software does not support the digital I/O or Counter/Timer
functionality of the board.
Board Characteristics
19-28
Board name
AD16-16(PCI)E
Manufacturer
Contec
Bus type
PCI
Access method
I/O mapped
Multiple block instance support
No
Multiple board support
Yes
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Contec AD16-16(PCI)E Analog Input (A/D)
Contec AD16-16(PCI)E Analog Input (A/D)
Contec AD16-16(PCI)E Analog Input block
Library
Simulink Real-Time Library for Contec
Scaling Input to Output
Hardware Input
Block Output Data Type
Scaling
Volts
Double
1
Block Parameters
Channel vector
Enter a vector of numbers to specify the input channels. For example, to use the first
three analog input (A/D) channels, enter
[1, 2, 3]
The channel numbers can occur in arbitrary order. Number them beginning with
1 even if the board manufacturer numbers them beginning with 0. The maximum
allowable channel number for this board is 8 (differential-ended) or 16 (single-ended).
Range
From the list, select Bipolar -10V to +10V, Bipolar -5V to +5V, Unipolar
0V to +5V, or Unipolar 0V to +10V. This value is replicated over the channel
vector.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
PCI slot (-1:autosearch)
If only one board of this type is in the target computer, enter -1 to locate the board.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
19-29
19
Contec
If two or more boards of this type are in the target computer, enter the bus number
and the PCI slot number of the board associated with this driver block. Use the
format [BusNumber,SlotNumber].
To determine the bus number and the PCI slot number, type:
tg = slrt;
getPCIInfo(tg, 'installed')
19-30
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Contec AD16-16(PCI)E Analog Output (D/A)
Contec AD16-16(PCI)E Analog Output (D/A)
Contec AD16-16(PCI)E Analog Output block
Library
Simulink Real-Time Library for Contec
Scaling Input to Output
Hardware Output
Block Input Data Type
Scaling
Volts
Double
1
Block Parameters
Range
From the list, select -5V to +5V, -10V to +10V, or 0 to +10V as the output
range for the analog output. This range must correspond to the output range
determined by the jumpers on the board.
Reset
This check box controls the behavior of the output channel at model termination.
If the check box is selected, the output channel is reset to the value specified as the
initial value. If the check box is not selected, the output channel remains at the most
recent value attained while the model was running.
Initial value
Enter the initial voltage value for the output channel. The output channel is set
to this value between the time the model is downloaded and the time the model is
started. Also, if the reset check box is selected, the output channel is reset to the
initial value when the model is stopped.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
PCI slot (-1:autosearch)
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
19-31
19
Contec
If only one board of this type is in the target computer, enter -1 to locate the board.
If two or more boards of this type are in the target computer, enter the bus number
and the PCI slot number of the board associated with this driver block. Use the
format [BusNumber,SlotNumber].
To determine the bus number and the PCI slot number, type:
tg = slrt;
getPCIInfo(tg, 'installed')
19-32
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Contec ADI12-16(PCI)
Contec ADI12-16(PCI)
Contec ADI12-16(PCI) board
Board
Contec ADI12-16(PCI)
General Description
The Contec ADI12-16(PCI) is an I/O board with 16 single-ended or 8 differential analog
input (A/D) channels (12 bit), 4 digital input lines, and 4 digital output lines.
The Simulink Real-Time block library supports this board with these driver block:
• Contec ADI12-16(PCI) Analog Input (A/D)
Board Characteristics
Board name
ADI12-16(PCI)
Manufacturer
Contec
Bus type
PCI
Access method
I/O mapped
Multiple block instance support
No
Multiple board support
Yes
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
19-33
19
Contec
Contec ADI12-16(PCI) Analog Input (A/D)
Contec ADI12-16(PCI) Analog Input block
Library
Simulink Real-Time Library for Contec
Scaling Input to Output
Hardware Output
Block Input Data Type
Scaling
Volts
Double
1
Block Parameters
Channel vector
Enter a vector of numbers to specify the input channels. For example, to use the first
three analog input (A/D) channels, enter
[1, 2, 3]
The channel numbers can occur in arbitrary order. Number them beginning with
1 even if the board manufacturer numbers them beginning with 0. The maximum
allowable channel number for this board is 8 (differential-ended) or 16 (single-ended).
Gain vector
To specify the gain, enter 1, 2, 4, or 8 for each of the channels in the channel vector.
The gain vector must be the same length as the channel vector. If you enter a scalar,
the value is replicated over the channel vector.
The gain is applied to the signal prior to sampling the voltage. After the signal
voltage is sampled, the result is divided by the gain to obtain the block output signal
value. To avoid clipping, make sure that the amplified gain falls within the range you
selected.
Range
19-34
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Contec ADI12-16(PCI) Analog Input (A/D)
From the list, select Bipolar -10V to +10V, Unipolar 0V to +10V, or
Unipolar 4mA to 20mA. Choose a range that is consistent with the jumper settings
on the board. This value is replicated over the channel vector.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
PCI slot (-1:autosearch)
If only one board of this type is in the target computer, enter -1 to locate the board.
If two or more boards of this type are in the target computer, enter the bus number
and the PCI slot number of the board associated with this driver block. Use the
format [BusNumber,SlotNumber].
To determine the bus number and the PCI slot number, type:
tg = slrt;
getPCIInfo(tg, 'installed')
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
19-35
19
Contec
Contec CNT24-4D(PCI)
Contec CNT24-4D(PCI) board
Board
Contec CNT24-4D(PCI)
General Description
The Contec CNT24-4D(PCI) is a 24-bit differential up/down counter board with four
channels. This board typically connects to incremental encoders. Incremental encoders
convert physical motion into electrical pulses than can be used to determine velocity,
direction, and distance.
The Simulink Real-Time block library supports this board with one driver block:
• Contec CNT24-4D(PCI) Incremental Encoder
The Simulink Real-Time software does not support the timer or interrupt functionality of
this board.
Board Characteristics
19-36
Board name
CNT24-4D(PCI)
Manufacturer
Contec
Bus type
PCI
Access method
I/O mapped
Multiple block instance support
No
Multiple board support
Yes
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Contec CNT24-4D(PCI) Incremental Encoder
Contec CNT24-4D(PCI) Incremental Encoder
Contec CNT24-4D(PCI) Incremental Encoder block
Library
Simulink Real-Time Library for Contec
Block Parameters
Note that you can have only one driver block instance for each physical board. If you need
to use multiple channels, select and enable more than channel on the same block.
Channel
From the list, select 1, 2, 3, or 4. This parameter specifies the channel to which
the subsequent parameters refer. The other parameters in this block apply to this
channel. The Enable channel check box number changes to match the selected
channel.
Enable channel
Select this check box to enable the currently selected channel. Click OK after you
select this check box to add an output port for the channel on the driver instance of
your model. This check box also enables you to set a number of operation parameters
for the block, ranging from Input type to Initial count. Whatever operation
parameters are in place when you click OK are preserved for the channel until the
next time you change them.
The following are some additional behavior notes for this check box:
• If you do not select this check box for a channel, an output port for that channel is
not added to the block. You also cannot change the operation parameters for the
channel.
• If you select this check box and save the operation parameters for that channel,
then later deselect this check box, the block preserves the operation parameters
for the channel. The output port is removed from the block.
Input type
From the list, choose either Line receiver or TTL-level input. This parameter
specifies the input type for the current channel.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
19-37
19
Contec
Mode
From the list, select the counter operation mode for the current channel. There
are a number of modes, based on 1-phase or 2-phase pulse inputs. See the Contec
CNT24-4D(PCI) documentation for descriptions of these modes.
Note that of this list of modes, the Multiply by 4 modes are synonyms for quadrature
encoding.
Direction
From the list, select either Clockwise rotation counts down or Clockwise
rotation counts up as the counter direction of the current channel.
Phase Z logic
From the list, select either Active high or Active low for the current channel.
This parameter specifies the state of the phase Z input (reference position signal). If
the phase Z mode parameter has a value of Disable phase Z input, Phase Z
logic does nothing.
Phase Z mode
From the list, select either Disable phase Z input, Enable next phase Z
input only once, or Enable every phase Z input. This parameter specifies
the operation mode of the phase Z input for the current channel.
Digital filter
From the list, select the characteristics of the digital input filter you want to apply to
the current channel's input signal. There are a number of sampling cycles to choose
from, ranging from 0.1 microseconds (1 MHz) to 1056.1 microseconds (94 Hz).
Initial count
Enter a number from 0 to 16777215 (FFFFFF hex, the largest 24-bit number). This
parameter specifies the initial value of the counter for the current channel.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
PCI slot (-1:autosearch)
If only one board of this type is in the target computer, enter -1 to locate the board.
If two or more boards of this type are in the target computer, enter the bus number
and the PCI slot number of the board associated with this driver block. Use the
format [BusNumber,SlotNumber].
19-38
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Contec CNT24-4D(PCI) Incremental Encoder
To determine the bus number and the PCI slot number, type:
tg = slrt;
getPCIInfo(tg, 'installed')
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
19-39
19
Contec
Contec CNT32-8M(PCI)
Contec CNT32-8M(PCI) board
Board
Contec CNT32-8M(PCI)
General Description
The Contec CNT32-8M(PCI) is a 32-bit high-speed up/down counter board with eight
channels. This board typically connects to incremental encoders. Incremental encoders
convert physical motion into electrical pulses than can be used to determine velocity,
direction, and distance. The Simulink Real-Time block library supports this board with
this driver block:
• Contec CNT32-8M(PCI) Incremental Encoder
Board Characteristics
Board name
CNT32-8M(PCI)
Manufacturer
Contec
Bus type
PCI
Multiple block instance support
Per model — Yes
Per channel — No. To support multiple channels,
use multiple blocks with each block configured to a
different channel.
Multiple board support
19-40
Yes
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Contec CNT32-8M(PCI) Incremental Encoder
Contec CNT32-8M(PCI) Incremental Encoder
Contec CNT32-8M(PCI) Incremental Encoder block
Library
Simulink Real-Time Library for Contec
Note
Each channel of this block has an external input and output signal. You can configure
these channels for hardware events (such as starting the encoder on the rising or falling
edge of an input signal). You can also configure them for general purpose, where the
signals behave like digital I/O signals. The block can have the following ports:
• Output port labeled with the channel number
• Output port labeled din , if you configure the block for digital input
• Input port labeled dout , if you configure the block for digital output
Scaling
Encoder (Input to Output)
Hardware Input
Block Input Data Type
Scaling
TTL or differential (pulse
input)
Double
Counts
Digital Input (Input to Output)
Hardware Input
Block Input Data Type
Scaling
TTL
Double
TTL low = 0.0
TTL high = 1.0
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
19-41
19
Contec
Digital Output (Output to Input)
Hardware Output
Block Output Data Type
Scaling
TTL
Double
TTL low = < 0.5
TTL high = > 0.5
Block Parameters: Main Tab
The Main tab contains parameters that define the operation of the board.
Channel
From the list, select 1 through 8. This parameter specifies the board channel to
which the subsequent parameters refer. Number the channels beginning with 1
even though the board manufacturer numbers them beginning with 0. The other
parameters in this block apply to this channel. The channel you select becomes the
label for the output port of the block.
Operation mode
From the list, select one of the following operation modes:
• 2-phase Input Synchronous Clear Multiply by 1
• 2-phase Input Synchronous Clear Multiply by 2
• 2-phase Input Synchronous Clear Multiply by 4
• 2-phase Input Asynchronous Clear Multiply by 1
• 2-phase Input Asynchronous Clear Multiply by 2
• 2-phase Input Asynchronous Clear Multiply by 4
• Single-phase Input Asynchronous Clear Multiply by 1
• Single-phase Input with Gate Control Attached Asynchronous
Clear Multiply 1
• Single-phase Input with Gate Control Attached Asynchronous
Clear Multiply 2
See the Contec CNT32-8M(PCI) 8-Ch 32-Bit Up/Down High-Speed Counter Board
for PCI documentation for definitions of these modes.
Digital filter
19-42
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Contec CNT32-8M(PCI) Incremental Encoder
From the list, select the desired digital filter time, in microseconds. To disable digital
filtering, select No filtering.
Pulse input
From the list, select one of the following pulse inputs:
• Differential line receiver input
• TTL Level input
You can connect the CNT32-8M(PCI) board to either differential or TTL input
signals. See the Contec CNT32-8M(PCI) 8-Ch 32-Bit Up/Down High-Speed
Counter Board for PCI documentation for connection details.
Direction
From the list, select one of the following count directions:
• Up in the clockwise direction/Down in the counterclockwise
direction
• Down in the clockwise direction/Up in the counterclockwise
direction
The board can count either up or down in the clockwise direction.
Initial value
Enter a number from 0 to the largest 32-bit number. This parameter specifies the
initial value of the counter before the model begins.
Load initial value
Select this check box to load the value from Initial value into the counter,
overwriting the previous count value. If you do not select this check box, the driver
does not load the initial value, preserving the previous count value.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
PCI slot (-1:autosearch)
If only one board of this type is in the target computer, enter -1 to locate the board.
If two or more boards of this type are in the target computer, enter the bus number
and the PCI slot number of the board associated with this driver block. Use the
format [BusNumber,SlotNumber].
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
19-43
19
Contec
To determine the bus number and the PCI slot number, type:
tg = slrt;
getPCIInfo(tg, 'installed')
Block Parameters: Counter Control Tab
The Counter Control tab contains parameters that define
• How to start and stop counting
• How to use the external input signal
• Under what circumstances to reset the counter
Start method
Directs counter to begin counting under one of the following conditions:
• Model Start — Begin counting when model starts.
• External Input Rising — Begin counting when external TTL input rises.
• External Input Falling — Begin counting when external TTL input falls.
• Disable — Do not begin counting.
Stop method
Directs counter to stop counting under one of the following conditions:
• Model Terminate — Stop counting when model stops.
• External Input Rising — Stop counting when external TTL input rises.
• External Input Falling — Stop counting when external TTL input falls.
• Free Running — Do not stop counting.
Zero-clear external input rising
Select this check box to clear the counter upon a rising edge on the external input
signal.
Zero-clear external input falling
Select this check box to clear the counter upon a falling edge on the external input
signal.
Zero-clear match 0
19-44
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Contec CNT32-8M(PCI) Incremental Encoder
Select this check box to clear the counter when the counter has the same value as
that contained in the Match 0 value parameter.
Zero-clear match 1
Select this check box to clear the counter when the counter has the same value as
that contained in the Match 1 value parameter.
Preset external input rising
Select this check box to preset the counter to the value contained in the Preset
value parameter upon a rising edge on the external input signal.
Preset external input falling
Select this check box to preset the counter to the value contained in the Preset
value parameter upon a falling edge on the external input signal.
Preset match 0
Select this check box to preset the counter to the value contained in the Preset
value parameter when the counter value has the same value as that contained in the
Match 0 value parameter.
Preset match 1
Select this check box to preset the counter to the value contained in the Preset
value parameter when the counter value has the same value as that contained in the
Match 1 value parameter.
Preset value
Enter the value that you want the counter to reset when a preset condition occurs.
Match 0 value
Enter the value that you want the counter value to be compared to for the Zeroclear match 0 or Preset match 0 conditions.
Match 1 value
Enter the value that you want the counter value to be compared to for the Zeroclear match 1 or Preset match 1 conditions.
Block Parameters: Signals Tab
The Signals tab contains parameters that
• Control the optional use of the external output signal
• Control the encoder index signal
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
19-45
19
Contec
• Enable the external signals for general purpose
Output signal match 0
Select this check box to strobe the output signal when the counter value has the same
value as the Match 0 parameter.
Output signal match 1
Select this check box to strobe the output signal when the counter value has the same
value as the Match 1 parameter.
Output signal abnormal input error
Select this check box to strobe the output signal when the phase-A and phase-B
signals change at the same time.
Output signal digital filter error
Select this check box to strobe the output signal when a pulse is faster than the
digital filter time setting.
Output signal disconnection alarm error
Select this check box to strobe the output signal when both the positive and negative
differential inputs are high.
One-shot duration
From the list, select the pulse width of the output signal for the one-shot duration, in
microseconds or milliseconds.
Index enable
From the list, select the following to enable or disable the phase-Z/CLR input signal:
• Disable — Disables phase-Z input (select this option if phase-Z does not exist).
• Enable Once — Enables only the next phase-Z input.
• Enable All — Enables all of the phase-Z inputs.
Index logic
From the list, select one of the following to set the logic of the phase-Z input signal.
Setting Index enable to Enable Once or Enable All activates this parameter.
• Positive (Active High)
• Negative (Active Low)
Enable digital input
19-46
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Contec CNT32-8M(PCI) Incremental Encoder
Select this check box to enable the external input signal to be used as a general
purpose digital input. Even if you select an external input signal other than generalpurpose input, the block can still read the input level.
Enable digital output
Select this check box to enable the external output signal to be used as a generalpurpose digital output. If you select an external output signal other than general
purpose, the block cannot write the output level. Selecting this check box enables the
Digital output initial value and Digital output final value parameters.
Digital output initial value
From the list, select how you want to set the initial value of the digital output when
the model starts:
• None — Do not modify the output value.
• Set — Set the bit.
• Clear — Clear the bit.
Digital output final value
From the list, select how you want to set the final value of the digital output when
the model terminates:
• None — Do not modify the output value.
• Set — Set the bit.
• Clear — Clear the bit.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
19-47
19
Contec
Contec DA12-16(PCI)
Contec DA12-16(PCI) block
Board
Contec DA12-16(PCI)
General Description
The Contec DA12-16(PCI) is an I/O board with 16 analog output (D/A) channels (12 bit).
The Simulink Real-Time block library supports this board with this driver block:
• Contec DA12-16(PCI) Analog Output (D/A)
The Simulink Real-Time software does not support the timer, external trigger, or
interrupt functionality of this board.
Board Characteristics
19-48
Board name
DA12-16(PCI)
Manufacturer
Contec
Bus type
PCI
Access method
I/O mapped
Multiple block instance support
No
Multiple board support
Yes
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Contec DA12-16(PCI) Analog Output (D/A)
Contec DA12-16(PCI) Analog Output (D/A)
Contec DA12-16(PCI) Analog Output block
Library
Simulink Real-Time Library for Contec
Scaling Input to Output
Hardware Output
Block Input Data Type
Scaling
Volts
Double
1
Block Parameters
Channel vector
Enter a vector of numbers to specify the output channels. For example, to use the
first and second analog output (D/A) channels enter
[1, 2]
The channel numbers can occur in arbitrary order. Number the channels beginning
with 1 even if the board manufacturer numbers them beginning with 0. The
maximum allowable channel number is 16.
Range
This board allows the range of each channel to be selected independently. Enter a
scalar, in which case the same range is replicated over the analog output channel
vector, or a vector the same length as the channel vector.
The range vector entries must be range codes selected from the following table:
Input Range (V)
Range Code
-10 to +10
-10
-5 to +5
-5
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
19-49
19
Contec
Input Range (V)
Range Code
-2.5 to 2.5
-2
For example, if the first and second channel is -5 to +5 volts, enter [-5,-5]
Reset vector
The reset vector controls the behavior of the channel at model termination. Enter a
scalar or a vector that is the same length as the channel vector. If you specify a scalar
value, that setting is replicated over the channel vector. If you specify a value of 1,
the corresponding channel is reset to the value specified in the initial value vector.
If you specify a value of 0, the channel remains at the last value attained while the
model was running.
Initial value vector
The initial value vector contains the initial voltage values for the output channels.
Enter a scalar or a vector that is the same length as the channel vector. If you specify
a scalar value, that value is replicated as the initial value over the channel vector.
The channels are set to the initial values between the time the model is downloaded
and the time it is started.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
PCI slot (-1:autosearch)
If only one board of this type is in the target computer, enter -1 to locate the board.
If two or more boards of this type are in the target computer, enter the bus number
and the PCI slot number of the board associated with this driver block. Use the
format [BusNumber,SlotNumber].
To determine the bus number and the PCI slot number, type:
tg = slrt;
getPCIInfo(tg, 'installed')
19-50
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Contec DA12-4(PCI)
Contec DA12-4(PCI)
Contec DA12-4(PCI) board
Board
Contec DA12-4(PCI)
General Description
The Contec DA12-4(PCI) is an I/O board with 4 analog output (D/A) channels (12 bit).
The Simulink Real-Time block library supports this board with this driver block:
• Contec DA12-4(PCI) Analog Output (D/A)
The Simulink Real-Time software does not support the timer, external trigger, or
interrupt functionality of this board.
Board Characteristics
Board name
DA12-4(PCI)
Manufacturer
Contec
Bus type
PCI
Access method
I/O mapped
Multiple block instance support
No
Multiple board support
Yes
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
19-51
19
Contec
Contec DA12-4(PCI) Analog Output (D/A)
Contec DA12-4(PCI) Analog Output block
Library
Simulink Real-Time Library for Contec
Scaling Input to Output
Hardware Output
Block Input Data Type
Scaling
Volts
Double
1
Block Parameters
Channel vector
Enter a vector of numbers to specify the output channels. For example, to use the
first and second analog output (D/A) channels enter
[1, 2]
The channel numbers can occur in arbitrary order. Number the channels beginning
with 1 even if the board manufacturer numbers them beginning with 0. The
maximum allowable channel number is 4.
Reset vector
The reset vector controls the behavior of the channel at model termination. Enter a
scalar or a vector that is the same length as the channel vector. If you specify a scalar
value, that setting is replicated over the channel vector. If you specify a value of 1,
the corresponding channel is reset to the value specified in the initial value vector.
If you specify a value of 0, the channel remains at the last value attained while the
model was running.
Initial value vector
The initial value vector contains the initial voltage values for the output channels.
Enter a scalar or a vector that is the same length as the channel vector. If you specify
19-52
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Contec DA12-4(PCI) Analog Output (D/A)
a scalar value, that value is replicated as the initial value over the channel vector.
The channels are set to the initial values between the time the model is downloaded
and the time it is started.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
PCI slot (-1:autosearch)
If only one board of this type is in the target computer, enter -1 to locate the board.
If two or more boards of this type are in the target computer, enter the bus number
and the PCI slot number of the board associated with this driver block. Use the
format [BusNumber,SlotNumber].
To determine the bus number and the PCI slot number, type:
tg = slrt;
getPCIInfo(tg, 'installed')
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
19-53
19
Contec
Contec PI-64L(PCI)H
Contec PI-64L(PCI)H board
Board
Contec PI-64L(PCI)H
General Description
The Contec PI-64L(PCI)H is a digital input board with 64 digital input channels. The
supporting block can control up to 32 bits that you can configure as either a single 32bit port (Single 32-bit Port mode) or up to 32 1-bit channels (32 1-bit Channels
mode).
The Simulink Real-Time block library supports this board with this driver block:
• Contec PI-64L(PCI)H Digital Input
Board Characteristics
19-54
Board name
PI-64L(PCI)H
Manufacturer
Contec
Bus type
PCI
Multiple block instance support
No
Multiple board support
Yes
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Contec PI-64L(PCI)H Digital Input
Contec PI-64L(PCI)H Digital Input
Contec PI-64L(PCI)H Digital Input block
Library
Simulink Real-Time Library for Contec
Scaling Input to Output
Hardware Input
Block Output Data Type
Scaling
TTL
Double (Format:32 1-bit
Channels)
Double:
TTL low = 0.0
TTL high = 1.0
uint32 (Format:Single 32bit Port)
uint32:
TTL low corresponding bit is clear
TTL high corresponding bit is set
Block Parameters
Format
From the list, select either
• 32 1-bit Channels — Indicates that the channel vector specifies the
configuration of the block. Each output is a double with value of 0 or 1. The value
is 0 when the hardware input voltage is low.
• Single 32-bit Port — Indicates that the output from the block is a 32-bit
integer where all 32 bits on the board feed into the single output. The least
significant bit is the lowest numbered bit in the Contec documentation.
If you choose this mode, use the bit packing and unpacking blocks (Digital I/O BitPacking and Digital I/O Bit-Unpacking) to construct the required data frames.
Group
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
19-55
19
Contec
From the list, select either
• A (Bits 0-31) — Selects the 32-bit word from group A to address.
• B (Bits 32-63) — Selects the 32-bit word from group B to address.
Channel vector
(32 1-bit Channels mode only) Enter a vector of numbers to specify the output
channels. For example, to use the first and third digital input channels, enter
[1, 3]
This vector indexes into group A or B channels. For group A, channel vector [1, 3]
specifies channels 0 and 2. For group B, channel vector [1, 3] specifies channels 32
and 34.
The channel numbers can occur in arbitrary order, but the numbers must be in the
range 1 to 32.
Digital Filter
This parameter specifies the digital filter time. From the list, select
• No filtering
• 0.25 usec
• 0.5 usec
• 1 usec
• 2 usec
• 4 usec
• 8 usec
See the Contec documentation for further details on the digital filter time.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
PCI slot (-1:autosearch)
If only one board of this type is in the target computer, enter -1 to locate the board.
If two or more boards of this type are in the target computer, enter the bus number
and the PCI slot number of the board associated with this driver block. Use the
format [BusNumber,SlotNumber].
19-56
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Contec PI-64L(PCI)H Digital Input
To determine the bus number and the PCI slot number, type:
tg = slrt;
getPCIInfo(tg, 'installed')
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
19-57
19
Contec
Contec PIO-32/32F(PCI)
Contec PIO-32/32F(PCI) board
Board
Contec PIO-32/32F(PCI)
General Description
The Contec PIO-32/32F(PCI) is an opto-isolated high-speed I/O board with 32 digital
input channels and 32 output channels.
The Simulink Real-Time block library supports this board with these driver blocks:
• Contec PIO-32/32T(PCI) Digital Input
• Contec PIO-32/32T(PCI) Digital Output
The Simulink Real-Time software does not support the timer, external trigger, or
interrupt functionality of this board.
Board Characteristics
19-58
Board name
PIO-32/32F(PCI)
Manufacturer
Contec
Bus type
PCI
Multiple block instance support
No
Multiple board support
Yes
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Contec PIO-32/32F(PCI) Digital Input
Contec PIO-32/32F(PCI) Digital Input
Contec PIO-32/32F(PCI) Digital Input block
Library
Simulink Real-Time Library for Contec
Scaling Input to Output
Hardware Input
Block Output Data Type
Scaling
TTL
Double
TTL low = 0.0
TTL high = 1.0
Block Parameters
I/O format
Select serial or parallel. If you select serial, the block is configured to accept
up to 32 one-bit input channels. If you select parallel, the block is configured to
accept a single 32-bit input channel and the channel vector parameter is unavailable.
Channel vector
If you selected serial I/O format, enter a vector of numbers to specify the input
channels for serial I/O format. For example, to use the first and third digital input
channels, enter
[1, 3]
The channel numbers can occur in arbitrary order, but the numbers must be in the
range 1 to 32.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
PCI slot (-1:autosearch)
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
19-59
19
Contec
If only one board of this type is in the target computer, enter -1 to locate the board.
If two or more boards of this type are in the target computer, enter the bus number
and the PCI slot number of the board associated with this driver block. Use the
format [BusNumber,SlotNumber].
To determine the bus number and the PCI slot number, type:
tg = slrt;
getPCIInfo(tg, 'installed')
19-60
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Contec PIO-32/32F(PCI) Digital Output
Contec PIO-32/32F(PCI) Digital Output
Contec PIO-32/32F(PCI) Digital Output block
Library
Simulink Real-Time Library for Contec
Scaling Input to Output
Hardware Output
Block Input Data Type
Scaling
TTL
Double
< 0.5 = TTL low
> 0.5 = TTL high
Block Parameters
I/O format
Select serial or parallel. If you select serial, the block is configured to accept
up to 32 one-bit input channels for output. If you select parallel, the block is
configured to accept a single 32-bit channel and the channel vector parameter is
unavailable.
Channel vector
For serial I/O format, enter a vector of numbers to specify the output channels. For
example, to use the first and third digital output channels, enter
[1, 3]
The channel numbers can occur in arbitrary order, but the numbers must be in the
range 1 to 32.
Reset vector
The reset vector controls the behavior of the channel at model termination. Enter a
scalar or a vector that is the same length as the channel vector. If you specify a scalar
value, that setting is replicated over the channel vector. If you specify a value of 1,
the corresponding channel is reset to the value specified in the initial value vector.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
19-61
19
Contec
If you specify a value of 0, the channel remains at the last value attained while the
model was running.
Initial value vector
The initial value vector contains the initial voltage values (0 or 1) for the output
channels. Enter a scalar or a vector that is the same length as the channel vector.
If you specify a scalar value, that value is replicated as the initial value over the
channel vector. The channels are set to the initial values between the time the model
is downloaded and the time it is started. If you selected parallel I/O format, the
values can be in the form [hex2dec('ffffffff')].
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
PCI slot (-1:autosearch)
If only one board of this type is in the target computer, enter -1 to locate the board.
If two or more boards of this type are in the target computer, enter the bus number
and the PCI slot number of the board associated with this driver block. Use the
format [BusNumber,SlotNumber].
To determine the bus number and the PCI slot number, type:
tg = slrt;
getPCIInfo(tg, 'installed')
19-62
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Contec PIO-32/32L(PCI)H
Contec PIO-32/32L(PCI)H
Contec PIO-32/32L(PCI)H board
Board
Contec PIO-32/32L(PCI)H
General Description
The Contec PIO-32/32L(PCI)H is an I/O board with 32 digital input channels and 32
output channels. Each supporting block can control up to 32 bits that you can configure
as either a single 32-bit port (Single 32-bit Port mode) or up to 32 1-bit channels
(32 1-bit Channels mode).
The Simulink Real-Time block library supports this board with these driver blocks:
• Contec PIO-32/32L(PCI)H Digital Input
• Contec PIO-32/32L(PCI)H Digital Output
The Simulink Real-Time software does not support the timer, external trigger, or
interrupt functionality of this board.
Board Characteristics
Board name
PIO-32/32L(PCI)H
Manufacturer
Contec
Bus type
PCI
Multiple block instance support
Yes
Multiple board support
Yes
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
19-63
19
Contec
Contec PIO-32/32L(PCI)H Digital Input
Contec PIO-32/32L(PCI)H Digital Input block
Library
Simulink Real-Time Library for Contec
Scaling Input to Output
Hardware Input
Block Output Data Type
Scaling
TTL
Double (Format:32 1-bit
Channels)
Double:
TTL low = 0.0
uint32 (Format:Single 32bit Port)
TTL high = 1.0
uint32:
TTL low corresponding bit is
clear
TTL high corresponding bit is
set
Block Parameters
Format
From the list, select either
• 32 1-bit Channels — Indicates that the channel vector specifies the
configuration of the block. Each output is a double with value of 0 or 1. The value
is 0 when the hardware input voltage is low.
• Single 32-bit Port — Indicates that the output from the block is a 32-bit
integer where all 32 bits on the board feed into the single output. The least
significant bit is the lowest numbered bit in the Contec user manual.
19-64
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Contec PIO-32/32L(PCI)H Digital Input
If you choose this mode, use the bit packing and unpacking blocks (Digital I/O BitPacking and Digital I/O Bit-Unpacking) to construct the required data frames.
Channel vector
(32 1-bit Channels mode only) Enter a vector of numbers to specify the output
channels. For example, to use the first and third digital output channels, enter
[1, 3]
The channel numbers can occur in arbitrary order, but the numbers must be in the
range 1 to 32.
Digital Filter
This parameter specifies the digital filter time. From the list, select
• No filtering
• 0.25 usec
• 0.5 usec
• 1 usec
• 2 usec
• 4 usec
• 8 usec
See the Contec User Guide for further details on the digital filter time.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
PCI slot (-1:autosearch)
If only one board of this type is in the target computer, enter -1 to locate the board.
If two or more boards of this type are in the target computer, enter the bus number
and the PCI slot number of the board associated with this driver block. Use the
format [BusNumber,SlotNumber].
To determine the bus number and the PCI slot number, type:
tg = slrt;
getPCIInfo(tg, 'installed')
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
19-65
19
Contec
Contec PIO-32/32L(PCI)H Digital Output
Contec PIO-32/32L(PCI)H Digital Output block
Library
Simulink Real-Time Library for Contec
Scaling Input to Output
Hardware Output
Block Input Data Type
TTL
Double (Format:32 1-bit Double:
< 0.5 = TTL low
Channels)
uint32 (Format:Single
32-bit Port)
Scaling
>0.5 = TTL high
uint32:
Bit clear = TTL low
Bit set = TTL high
Block Parameters
Format
From the list, select either
• 32 1-bit Channels — Indicates that the channel vector specifies the
configuration of the block. Each output is a double with value of 0 or 1. The value
is 0 when the hardware input voltage is low.
• Single 32-bit Port — Indicates that the output from the block is a 32-bit
integer where all 32 bits on the board feed into the single output. The least
significant bit is the lowest numbered bit in the Contec user manual.
If you choose this mode, use the bit packing and unpacking blocks (Digital I/O BitPacking and Digital I/O Bit-Unpacking) to construct the required data frames.
19-66
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Contec PIO-32/32L(PCI)H Digital Output
Channel vector
(32 1-bit Channels mode only) Enter a vector of numbers to specify the output
channels. For example, to use the first and third digital output channels, enter
[1, 3]
The channel numbers can occur in arbitrary order, but the numbers must be in the
range 1 to 32.
Initial value vector
The initial value vector contains the initial voltage values for the output channels.
Enter a scalar or a vector that is the same length as the channel vector. If you specify
a scalar value, that value is replicated as the initial value over the channel vector.
The channels are set to the initial values between the time the model is downloaded
and the time it is started.
Final action vector
The final action vector controls the behavior of the channel at model termination.
Enter a scalar or a vector that is the same length as the channel vector. If you specify
a scalar value, that setting is replicated over the channel vector. If you specify a
value of 1, the corresponding channel is reset to the value specified in the initial
value vector. If you specify a value of -1, the block sets the channel to the value
specified in the Final value vector value for that channel. If you specify a value of
0, the channel remains at the last value attained while the model was running.
Final value vector
The final value vector contains the final value for each output channel. Enter a scalar
or a vector that is the same length as the channel vector. If you specify a scalar value,
that setting is replicated over the channel vector. If the Final action vector is -1,
the block sets the channel to this value on model termination.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
PCI slot (-1:autosearch)
If only one board of this type is in the target computer, enter -1 to locate the board.
If two or more boards of this type are in the target computer, enter the bus number
and the PCI slot number of the board associated with this driver block. Use the
format [BusNumber,SlotNumber].
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
19-67
19
Contec
To determine the bus number and the PCI slot number, type:
tg = slrt;
getPCIInfo(tg, 'installed')
19-68
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Contec PIO-32/32T(PCI)
Contec PIO-32/32T(PCI)
Contec PIO-32/32T(PCI) board
Board
Contec PIO-32/32T(PCI)
General Description
The Contec PIO-32/32T(PCI) is an I/O board with 32 digital input channels and 32 output
channels.
The Simulink Real-Time block library supports this board with these driver blocks:
• Contec PIO-32/32T(PCI) Digital Input
• Contec PIO-32/32T(PCI) Digital Output
The Simulink Real-Time software does not support the timer, external trigger, or
interrupt functionality of this board.
Board Characteristics
Board name
PIO-32/32T(PCI)
Manufacturer
Contec
Bus type
PCI
Multiple block instance support
No
Multiple board support
Yes
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
19-69
19
Contec
Contec PIO-32/32T(PCI) Digital Input
Contec PIO-32/32T(PCI) Digital Input block
Library
Simulink Real-Time Library for Contec
Scaling Input to Output
Hardware Input
Block Output Data Type
Scaling
TTL
Double
TTL low = 0.0
TTL high = 1.0
Block Parameters
I/O format
Select serial or parallel. If you select serial, the block is configured to accept
up to 32 one-bit input channels. If you select parallel, the block is configured to
accept a single 32-bit input channel and the channel vector parameter is unavailable.
Channel vector
If you selected serial I/O format, enter a vector of numbers to specify the input
channels for serial I/O format. For example, to use the first and third digital input
channels, enter
[1, 3]
The channel numbers can occur in arbitrary order, but the numbers must be in the
range 1 to 32.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
PCI slot (-1:autosearch)
19-70
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Contec PIO-32/32T(PCI) Digital Input
If only one board of this type is in the target computer, enter -1 to locate the board.
If two or more boards of this type are in the target computer, enter the bus number
and the PCI slot number of the board associated with this driver block. Use the
format [BusNumber,SlotNumber].
To determine the bus number and the PCI slot number, type:
tg = slrt;
getPCIInfo(tg, 'installed')
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
19-71
19
Contec
Contec PIO-32/32T(PCI) Digital Output
Contec PIO-32/32T(PCI) Digital Output block
Library
Simulink Real-Time Library for Contec
Scaling Input to Output
Hardware Output
Block Input Data Type
Scaling
TTL
Double
< 0.5 = TTL low
> 0.5 TTL high
Block Parameters
I/O format
Select serial or parallel. If you select serial, the block is configured to accept
up to 32 one-bit input channels for output. If you select parallel, the block is
configured to accept a single 32-bit channel and the channel vector parameter is
unavailable.
Channel vector
For serial I/O format, enter a vector of numbers to specify the output channels. For
example, to use the first and third digital output channels, enter
[1, 3]
The channel numbers can occur in arbitrary order, but the numbers must be in the
range 1 to 32.
Reset vector
The reset vector controls the behavior of the channel at model termination. Enter a
scalar or a vector that is the same length as the channel vector. If you specify a scalar
value, that setting is replicated over the channel vector. If you specify a value of 1,
the corresponding channel is reset to the value specified in the initial value vector.
19-72
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Contec PIO-32/32T(PCI) Digital Output
If you specify a value of 0, the channel remains at the last value attained while the
model was running.
Initial value vector
The initial value vector contains the initial voltage values (0 or 1) for the output
channels. Enter a scalar or a vector that is the same length as the channel vector.
If you specify a scalar value, that value is replicated as the initial value over the
channel vector. The channels are set to the initial values between the time the model
is downloaded and the time it is started. If you selected parallel I/O format, the
values can be in the form [hex2dec('ffffffff')].
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
PCI slot (-1:autosearch)
If only one board of this type is in the target computer, enter -1 to locate the board.
If two or more boards of this type are in the target computer, enter the bus number
and the PCI slot number of the board associated with this driver block. Use the
format [BusNumber,SlotNumber].
To determine the bus number and the PCI slot number, type:
tg = slrt;
getPCIInfo(tg, 'installed')
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
19-73
19
Contec
Contec PO-64L(PCI)H
Contec PO-64L(PCI)H board
Board
Contec PO-64L(PCI)H
General Description
The Contec PO-64L(PCI)H is a digital output board with 64 digital output channels. The
supporting block can control up to 32 bits that you can configure as either a single 32bit port (Single 32-bit Port mode) or up to 32 1-bit channels (32 1-bit Channels
mode).
The Simulink Real-Time block library supports this board with this driver block:
• Contec PO-64L(PCI)H Digital Output
Board Characteristics
19-74
Board name
PO-64L(PCI)H
Manufacturer
Contec
Bus type
PCI
Multiple block instance support
Yes — for 32 1-bit Channels mode
Multiple board support
Yes
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Contec PO-64L(PCI)H Digital Output
Contec PO-64L(PCI)H Digital Output
Contec PO-64L(PCI)H Digital Output block
Library
Simulink Real-Time Library for Contec
Scaling Input to Output
Hardware Output
Block Input Data Type
Scaling
TTL
Double (Format:32 1-bit
Channels)
Double:
< 0.5 = TTL low
uint32 (Format:Single 32- >0.5 = TTL high
bit Port)
uint32:
Bit clear = TTL low
Bit set = TTL high
Block Parameters
Format
From the list, select either
• 32 1-bit Channels — Indicates that the channel vector specifies the
configuration of the block. Each output is a double with value of 0 or 1. The value
is 0 when the hardware input voltage is low.
With this mode, the block reads, modifies, then writes the data. This enables you
to use multiple instances of this block, with each block addressing a different bit.
However, for efficiency, use a single block for each 32-bit group. Use multiple
block instances only if your application requires multiple accesses.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
19-75
19
Contec
• Single 32-bit Port — Indicates that the output from the block is a 32-bit
integer where all 32 bits on the board feed into the single output. The least
significant bit is the lowest numbered bit in the Contec user manual.
If you choose this mode, use the bit packing and unpacking blocks (Digital I/O BitPacking and Digital I/O Bit-Unpacking) to construct the required data frames.
Group
From the list, select either
• A (Bits 0-31) — Selects the 32-bit word from Group A to address.
• B (Bits 32-63) — Selects the 32-bit word from Group B to address.
Channel vector
(32 1-bit Channels mode only) Enter a vector of numbers to specify the output
channels. For example, to use the first and third digital output channels, enter
[1, 3]
This vector indexes into group A or B channels. For group A, channel vector [1, 3]
specifies channels 0 and 2. For group B, channel vector [1, 3] specifies channels 32
and 34.
The channel numbers can occur in arbitrary order, but the numbers must be in the
range 1 to 32.
Initial value vector
The initial value vector contains the initial voltage values for the output channels.
Enter a scalar or a vector that is the same length as the channel vector. If you specify
a scalar value, that value is replicated as the initial value over the channel vector.
The channels are set to the initial values between the time the model is downloaded
and the time it is started.
Final action vector
The final action vector controls the behavior of the channel at model termination.
Enter a scalar or a vector that is the same length as the channel vector. If you specify
a scalar value, that setting is replicated over the channel vector. If you specify a
value of 1, the corresponding channel is reset to the value specified in the initial
value vector. If you specify a value of -1, the block sets the channel to the value
specified in the Final value vector value for that channel. If you specify a value of
0, the channel remains at the last value attained while the model was running.
19-76
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Contec PO-64L(PCI)H Digital Output
Final value vector
The final value vector contains the final value for each output channel. Enter a scalar
or a vector that is the same length as the channel vector. If you specify a scalar value,
that setting is replicated over the channel vector. If the Final action vector is -1,
the block sets the channel to this value on model termination.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
PCI slot (-1:autosearch)
If only one board of this type is in the target computer, enter -1 to locate the board.
If two or more boards of this type are in the target computer, enter the bus number
and the PCI slot number of the board associated with this driver block. Use the
format [BusNumber,SlotNumber].
To determine the bus number and the PCI slot number, type:
tg = slrt;
getPCIInfo(tg, 'installed')
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
19-77
‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ | ‪www.MatlabSite.com‬‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
20
Curtiss-Wright Electronic Systems
Simulink Real-Time supports reflective (shared) memory boards manufactured by
Curtiss-Wright Electronic Systems (formerly Systran). The use of these boards is
described in “Curtiss-Wright Electronic Systems Shared Memory”.
Systran SCRAMNet+ SC150
PCI
A real-time reflective PCI memory board that can
generate/broadcast interrupts.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
20
Curtiss-Wright Electronic Systems
Board and Blocks — Alphabetical List
Systran SCRAMNet+ SC150 PCI
Systran SC150 init
Systran SC150 read
Systran SC150 rearm
Systran SC150 write
20-2
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Systran SCRAMNet+ SC150 PCI
Systran SCRAMNet+ SC150 PCI
Support for Systran SCRAMNet+ SC150 PCI real-time reflective memory board
Board
Systran SCRAMNet+ SC150 PCI
General Description
The SCRAMNet+ SC150 PCI board is a real-time reflective PCI memory board. It can
also generate/broadcast interrupts. The Simulink Real-Time software uses this board as
part of the shared memory network that you can use to exchange data between computer
nodes.
The Systran block library supports this board with these driver blocks:
• Systran SC150 init
• Systran SC150 read
• Systran SC150 write
• Systran SC150 rearm
For information about the Change endianess block, see Byte Reversal/Change Endianess.
Board Characteristics
Board name
SCRAMNet+ SC150
Manufacturer
Curtiss-Wright Electronic Systems
(formerly Systran)
Bus type
PCI
Access method
Memory mapped
Multiple block instance support
Yes
Multiple board support
Yes
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
20-3
20
Curtiss-Wright Electronic Systems
Systran SC150 init
SystranSC150 init block
Library
Simulink Real-Time Library for Systran
Note
Before you begin to configure these block parameters, be sure that you have a predefined
node initialization structure. See “Initialize Curtiss-Wright Shared Nodes”.
Block Parameters
Each model that uses shared memory must have one SC150 init block for every
SCRAMNet+ SC150 board in the system.
Node struct
Enter the name of the predefined node initialization structure.
PCI slot (-1:autosearch)
If only one board of this type is in the target computer, enter -1 to locate the board.
If two or more boards of this type are in the target computer, enter the bus number
and the PCI slot number of the board associated with this driver block. Use the
format [BusNumber,SlotNumber].
To determine the bus number and the PCI slot number, type:
tg = slrt;
getPCIInfo(tg, 'installed')
20-4
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Systran SC150 read
Systran SC150 read
Systran SC150 read block
Library
Simulink Real-Time Library for Systran
Note
Before you begin to configure this block, be sure that you have a predefined shared
memory partition structure. The SC150 read block requires this structure to specify how
Simulink signal values are mapped in the shared memory. It also uses this structure to
determine the total size and address of the shared memory. See “Create Curtiss-Wright
Shared Partitions”.
Block Parameters
Partition struct
Enter the name of the predefined shared memory partition structure. The block uses
this structure to specify how Simulink signal values map into shared memory.
Error port
Select this check box to monitor the status of the Systran Scramnet board CSR1
register modes. The enabled port is of type uint16.
Sampletime
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited)
PCI slot (-1:autosearch)
If only one board of this type is in the target computer, enter -1 to locate the board.
If two or more boards of this type are in the target computer, enter the bus number
and the PCI slot number of the board associated with this driver block. Use the
format [BusNumber,SlotNumber].
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
20-5
20
Curtiss-Wright Electronic Systems
To determine the bus number and the PCI slot number, type:
tg = slrt;
getPCIInfo(tg, 'installed')
20-6
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Systran SC150 rearm
Systran SC150 rearm
Systran SC150 rearm block
Library
Simulink Real-Time Library for Systran
Note
Before you begin to configure this block, be sure that you have a predefined shared
memory partition structure. The SC150 rearm block requires this structure to specify
how Simulink signal values are mapped in the shared memory. It also uses this structure
to determine the total size and address of the shared memory. See “Create CurtissWright Shared Partitions”.
Block Parameters
Partition struct
Enter the name of the predefined shared memory partition structure. The block uses
this structure to specify how Simulink signal values map into shared memory.
Sampletime
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited)
PCI slot (-1:autosearch)
If only one board of this type is in the target computer, enter -1 to locate the board.
If two or more boards of this type are in the target computer, enter the bus number
and the PCI slot number of the board associated with this driver block. Use the
format [BusNumber,SlotNumber].
To determine the bus number and the PCI slot number, type:
tg = slrt;
getPCIInfo(tg, 'installed')
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
20-7
20
Curtiss-Wright Electronic Systems
Systran SC150 write
Systran SC150 write block
Library
Simulink Real-Time Library for Systran
Note
Before you begin to configure this block, be sure that you have a predefined shared
memory partition structure. The SC150 write block requires this structure to specify how
Simulink signal values are mapped in the shared memory. It also uses this structure to
determine the total size and address of the shared memory. See “Create Curtiss-Wright
Shared Partitions”.
Block Parameters
Partition struct
Enter the name of the predefined shared memory partition structure. The block uses
this structure to specify how Simulink signal values map into shared memory.
Error port
Select this check box to monitor the status of the Systran Scramnet board CSR1
register modes. The enabled port is of type uint16.
Sampletime
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited)
PCI slot (-1:autosearch)
If only one board of this type is in the target computer, enter -1 to locate the board.
If two or more boards of this type are in the target computer, enter the bus number
and the PCI slot number of the board associated with this driver block. Use the
format [BusNumber,SlotNumber].
20-8
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Systran SC150 write
To determine the bus number and the PCI slot number, type:
tg = slrt;
getPCIInfo(tg, 'installed')
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
20-9
‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ | ‪www.MatlabSite.com‬‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
‫‪Diamond, FlexRay, GE‬‬
‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ | ‪www.MatlabSite.com‬‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ | ‪www.MatlabSite.com‬‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
21
Diamond
This topic describes Diamond Systems I/O boards supported by the Simulink Real-Time
product (http://www.diamondsystems.com). To read about the Diamond Systems serial
communications boards supported by Simulink Real-Time, see “RS-232/422/485 Drivers
(Composite)”.
Diamond Diamond-MM
DAS16-compatible I/O board with 16
single or 8 differential analog input (A/D)
channels, 2 analog output (D/A) channels,
8 digital input lines, and 8 digital output
lines.
Diamond Diamond-MM-16-AT
PC/104 I/O board with 16 single-ended or
8 differential analog input (A/D) channels
(16-bit), 4 optional analog output (D/A)
channels (12-bit), and 8 digital input and
output lines.
Diamond Diamond-MM-32-AT
PC/104 I/O board with 32 single or 16
differential analog input (A/D) channels,
4 analog output (D/A) channels, and 24
digital input and output lines.
Diamond Garnet-MM
I/O board with 24 or 48 high current digital
I/O lines that can be configured in groups of
8 for either digital input or digital output.
Diamond Onyx-MM
I/O board with 48 digital I/O lines that
can be configured in groups of 8 for either
digital input or digital output, counters,
and timers.
Diamond Onyx-MM-DIO
I/O board with 48 digital I/O lines that
can be configured in groups of 8 for either
digital input or digital output.
Diamond Prometheus, Athena, and Athena • Diamond Prometheus — Intel 486-based
II
embedded PC/104 CPU board with 4
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
21
Diamond
serial ports, 2 USB ports, 1 parallel
port, keyboard and mouse ports, floppy
and IDE drive connectors, a 100BaseT
Ethernet connector, and provision for
solid-state flashdisk modules.
The Simulink Real-Time product
supports Model PR-Z32-EA of
Prometheus. In addition to the above
functionality, Model PR-Z32-EA also
contains a data acquisition subsystem.
This subsystem supports 16 singleended or 8 differential 16-bit A/D, 4 12bit analog outputs, 24 programmable
digital I/O channels, and a 16-bit
counter/timer.
• Diamond Athena — Pentium III class
VIA Eden processor-based embedded
PC/104 CPU with 4 serial ports, 4 USB
ports, 1 parallel port, keyboard and
mouse ports, floppy and IDE drive
connectors, a 100BaseT Ethernet
connector, and a 16-bit data acquisition
circuit.
• Diamond Athena II — Single board
computer (SBC). Pentium III class VIA
Mark CoreFusion™ processor based
embedded PC/104 CPU with 4 serial
ports, 4 USB ports, 1 parallel port,
keyboard and mouse ports, floppy and
IDE drive connectors, a 10/100 Mbps
Ethernet connector, and a 16-bit data
acquisition circuit.
21-2
Diamond Quartz-MM-5
8 digital input lines and 8 digital output
lines.
Diamond Quartz-MM-10
8 digital input line and 8 digital output
lines.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Diamond
Diamond Ruby-MM
PC/104 I/O board with 4 or 8 single analog
output (D/A) channels, unipolar and bipolar
operation, ± 10V, ± 5V, 0-10V, 0-5V fixed
ranges, ± 2.5V, 0-2.5V user-adjustable
ranges, and 24 digital input and output
lines.
Diamond Ruby-MM-416
Four 16-bit analog output (D/A) channels,
and 24 digital I/O lines that can be
configured in groups of 8 for either input or
output.
Diamond Ruby-MM-1612
Sixteen 12-bit analog output (D/A)
channels, and 24 digital I/O lines which can
be configured in groups of 8 for either input
or output.
“Boards and Blocks — Alphabetical List” on Description of block parameters for
Diamond Systems driver blocks.
page 21-4
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
21-3
21
Diamond
Boards and Blocks — Alphabetical List
21-4
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Diamond Diamond-MM
Diamond Diamond-MM
Diamond Diamond-MM board
Board
Diamond Diamond-MM
General Description
The Diamond-MM is a DAS16 compatible I/O board with 16 single or 8 differential
analog input (A/D) channels (12-bit) with a maximum sample rate or 100 kHz, 2 analog
output (D/A) channels (12-bit), 8 digital input lines, and 8 digital output lines.
The Simulink Real-Time block library supports this board with these driver blocks:
• Diamond MM Analog Input (A/D)
• Diamond MM Analog Output (D/A)
• Diamond MM Digital Input
• Diamond MM Digital Output
Board Characteristics
Board name
Diamond-MM
Manufacturer
Diamond Systems Corporation
Bus type
PC/104
Access method
I/O mapped
Multiple block instance support
No
Multiple board support
Yes
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
21-5
21
Diamond
Diamond MM Analog Input (A/D)
MM Analog Input block
Library
Simulink Real-Time Library for Diamond
Scaling Input to Output
Hardware Input
Block Output Data Type
Scaling
Volts
Double
1
Block Parameters
Number of channels
If you select 16 channels (Coupling parameter set to 16 single-ended
channels) enter a number between 1 and 16 to select the number of single A/
D channels used. If you select eight channels (Coupling parameter set to 8
differential channels) enter a number between 1 and 8.
Number the lines beginning with 1 even if the board manufacturer starts numbering
the lines with 0.
Note, you cannot select the starting channel for this block, you can only select the
number of channels. This block works differently from the Diamond-MM-32-AT A/D
block, where you can specify the starting channel.
Range
Enter an input range code for the A/D channels. This driver does not allow the
selection of a different range for each channel. The input range is the same for all A/
D channels.
The following table is a list of the ranges for this driver and the corresponding range
codes.
21-6
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Diamond MM Analog Input (A/D)
Input Range (V)
Range Code
Input Range (V)
Range Code
-10 to +10
-10
0 to +10
10
-5 to +5
-5
0 to +5
5
-2.5 to + 2.5
-2.5
0 to +2
2
-1 to +1
-1
0 to +1
1
-0.5 to +0.5
-5
The gain jumpers on the board have to be set for the required range. The bipolar
jumper on the board has to be in the bipolar position, if a bipolar range is used or in
the unipolar position, when a unipolar range is used.
Coupling
From the list, select one from the following list of input modes:
• 16 single-ended channels
• 8 differential channels
This choice must correspond to the jumper setting in block J6 on the board.
Show error status output (E)
Select this check box to add a port labeled E to the block and to display (the contents
of) that special port. This output has a value of 0 unless a problem is detected while
attempting an A/D conversion. In the unlikely event that an error occurs, the port
has a nonzero value. This nonzero value takes the form of a real number whose
binary representation of 1's and 0's (true and false) indicates which channels have
errors.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
Base address
Enter the base address of the board. This entry must correspond to the DIP switch
setting on the board. For example, if the DIP switch setting is 300 (hexadecimal),
enter 0x300.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
21-7
21
Diamond
Diamond MM Analog Output (D/A)
MM Analog Output block
Library
Simulink Real-Time Library for Diamond
Scaling Input to Output
Hardware Output
Block Input Data Type
Scaling
Volts
Double
1
Block Parameters
Channel vector
This parameter is a combined Channel vector and Range vector. The number of
elements defines the number of D/A channels used.
Range vector
Enter a range code for each of the D/A channels used. This driver allows a different
range for each channel with a maximum of 2 channels.
The following table is a list of the ranges for this driver and the corresponding range
codes. The D/A specific jumpers on the board have to be set as required for the ranges
entered.
Input Range (V)
Range Code
0 to +10
10
0 to +5
5
For example, if the first channel is 0 to + 10 volts and the second channel is 0 to +5
volts, enter
[10,5]
21-8
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Diamond MM Analog Output (D/A)
Reset vector
The reset vector controls the behavior of the channel at model termination. Enter a
scalar or a vector that is the same length as the channel vector. If you specify a scalar
value, that setting is replicated over the channel vector. If you specify a value of 1,
the corresponding channel is reset to the value specified in the initial value vector.
If you specify a value of 0, the channel remains at the last value attained while the
model was running.
Initial value vector
The initial value vector contains the initial voltage values for the input channels.
Enter a scalar or a vector that is the same length as the channel vector. If you specify
a scalar value, that value is replicated as initial value over the channel vector. The
channels are set to the initial values between the time the model is downloaded and
the time it is started. If you provide an out-of-range value for a channel, that value is
adjusted to be within the range defined by the parameter Range.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
Base address
Enter the base address of the board. This entry must correspond to the DIP switch
setting on the board. For example, if the DIP switch setting is 300 (hexadecimal),
enter 0x300.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
21-9
21
Diamond
Diamond MM Digital Input
MM Digital Input block
Library
Simulink Real-Time Library for Diamond
Scaling Input to Output
Hardware Input
Block Output Data Type
Scaling
TTL
Double
TTL low = 0.0
TTL high = 1.0
Block Parameters
Channel vector
Enter numbers between 1 and 8. This driver allows the selection of individual digital
input channels in arbitrary order. The number of elements defines the number of
digital input channels you use. For example, to use all the digital input channels,
enter
[1:8]
Number the channels beginning with 1 even if the board manufacturer starts
numbering the channels with 0.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
Base address
Enter the base address of the board. This entry must correspond to the DIP switch
setting on the board. For example, if the DIP switch setting is 300 (hexadecimal),
enter 0x300.
21-10
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Diamond MM Digital Output
Diamond MM Digital Output
MM Digital Output block
Library
Simulink Real-Time Library for Diamond
Scaling Input to Output
Hardware Output
Block Input Data Type
Scaling
TTL
Double
< 0.5 = TTL low
≥ 0.5 = TTL high
Block Parameters
Channel vector
Enter numbers between 1 and 8. This driver allows the selection of individual digital
input channels in arbitrary order. The number of elements defines the number of
digital input channels you use. For example, to use all the digital output channels,
enter
[1:8]
Number the channels beginning with 1 even if the board manufacturer starts
numbering the channels with 0.
Reset vector
The reset vector controls the behavior of the channel at model termination. Enter a
scalar or a vector that is the same length as the channel vector. If you specify a scalar
value, that setting is replicated over the channel vector. If you specify a value of 1,
the corresponding channel is reset to the value specified in the initial value vector.
If you specify a value of 0, the channel remains at the last value attained while the
model was running.
Initial value vector
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
21-11
21
Diamond
The initial value vector contains the initial voltage values for the input channels.
Enter a scalar or a vector that is the same length as the channel vector. If you specify
a scalar value, that value is replicated as initial value over the channel vector. The
channels are set to the initial values between the time the model is downloaded and
the time it is started. If you provide an out-of-range value for a channel, that value is
adjusted to be within the range defined by the parameter Range.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
Base address
Enter the base address of the board. This entry must correspond to the DIP switch
setting on the board. For example, if the DIP switch setting is 300 (hexadecimal),
enter 0x300.
21-12
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Diamond Diamond-MM-16-AT
Diamond Diamond-MM-16-AT
Diamond Diamond-MM-16-AT board
Board
Diamond Diamond-MM-16-AT
General Description
The Diamond MM-AT is a PC104 I/O board with 16 single-ended or 8 differential analog
input (A/D) channels (16-bit), 4 optional analog output (D/A) channels (12-bit), 8 digital
input and output lines. This board also supports autocalibration and an A/D FIFO.
Diamond-MM-16-AT boards have an 8-bit digital input port and an 8-bit digital output
port.
The Simulink Real-Time block library supports this board with these driver blocks:
• Diamond MM-16-AT Analog Input (A/D)
• Diamond MM-16-AT Analog Output (D/A)
• Diamond MM-16-AT Digital Input
• Diamond MM-16-AT Digital Output
The Simulink Real-Time software does not support the counters/timers on this board.
Board Characteristics
Board name
Diamond-MM-16-AT
Manufacturer
Diamond Systems Corporation
Bus type
PC/104
Access method
I/O mapped
Multiple block instance support
No
Multiple board support
Yes
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
21-13
21
Diamond
Diamond MM-16-AT Analog Input (A/D)
MM-16-AT Analog Input block
Library
Simulink Real-Time Library for Diamond
Scaling Input to Output
Hardware Input
Block Output Data Type
Scaling
Volts
Double
1
Block Parameters
First Channel
Enter the number of the first channel in a set of contiguous analog input channels.
Depending on the channel configuration selected, the first channel number must
be within the range 1 through 8 (Coupling parameter set to 8 differential
channels) or 1 through 16 (Coupling parameter set to 16 single-ended
channels).
Number the lines beginning with 1 even if the board manufacturer starts numbering
the lines with 0.
Number of Channels
Enter the number of input channels you want to use. The maximum number of
channels varies between 1 and 16 and depends on the values of Coupling and the
First channel number.
Range
From the list, choose a voltage range. The input range applies to all channels.
Coupling
From the list, select one from the following list of input modes:
21-14
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Diamond MM-16-AT Analog Input (A/D)
• Single-ended (16 channels)
• Differential (8 channels)
This choice must correspond to the jumper setting in block J4 on the board.
Show error status output (E)
Select this check box to add a port labeled E to the block and to display (the contents
of) that special port. This output has a value of 0 unless a problem is detected while
attempting an A/D conversion. In the unlikely event that an error occurs, the port
has a nonzero value. This nonzero value takes the form of a real number whose
binary representation of 1's and 0's (true and false) indicates which channels have
errors.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
Base address
Enter the base address of the board. This entry must correspond to the DIP switch
setting on the board. For example, if the DIP switch setting is 300 (hexadecimal),
enter 0x300.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
21-15
21
Diamond
Diamond MM-16-AT Analog Output (D/A)
MM-16-AT Analog Output block
Library
Simulink Real-Time Library for Diamond
Scaling Input to Output
Hardware Output
Block Output Data Type
Scaling
Volts
Double
1
Block Parameters
Channel vector
Enter numbers between 1 and 4. This driver allows the selection of individual D/
A channels in arbitrary order. The number of elements defines the number of D/
A channels you use. For example, to use the first and second analog output (D/A)
channels, enter
[1,2]
Number the channels beginning with 1 even if the board manufacturer starts
numbering the channels with 0.
Range
From the list, select 0 to 5V or -5V to 5V as the input voltage range of the board.
The input range applies to all channels.
This choice must correspond to the jumper setting in block J5 on the board.
Reset vector
The reset vector controls the behavior of the channel at model termination. Enter a
scalar or a vector that is the same length as the channel vector. If you specify a scalar
value, that setting is replicated over the channel vector. If you specify a value of 1,
21-16
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Diamond MM-16-AT Analog Output (D/A)
the corresponding channel is reset to the value specified in the initial value vector.
If you specify a value of 0, the channel remains at the last value attained while the
model was running.
Initial value vector
The initial value vector contains the initial voltage values for the input channels.
Enter a scalar or a vector that is the same length as the channel vector. If you specify
a scalar value, that value is replicated as initial value over the channel vector. The
channels are set to the initial values between the time the model is downloaded and
the time it is started. If you provide an out-of-range value for a channel, that value is
adjusted to be within the range defined by the parameter Range.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
Base address
Enter the base address of the board. This entry must correspond to the DIP switch
setting on the board. For example, if the DIP switch setting is 300 (hexadecimal),
enter 0x300.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
21-17
21
Diamond
Diamond MM-16-AT Digital Input
MM-16-AT Digital Input block
Library
Simulink Real-Time Library for Diamond
Scaling Input to Output
Hardware Output
Block Output Data Type
Scaling
TTL
Double
TTL low = 0.0
TTL high = 1.0
Block Parameters
Channel vector
Enter numbers between 1 and 8. This driver allows the selection of individual digital
input channels in arbitrary order. The number of elements defines the number of
digital input channels you use. For example, to use all the digital input channels,
enter
[1:8]
Number the channels beginning with 1 even if the board manufacturer starts
numbering the channels with 0.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
Base address
Enter the base address of the board. This entry must correspond to the DIP switch
setting on the board. For example, if the DIP switch setting is 300 (hexadecimal),
enter 0x300.
21-18
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Diamond MM-16-AT Digital Output
Diamond MM-16-AT Digital Output
MM-16-AT Digital Output block
Library
Simulink Real-Time Library for Diamond
Scaling Input to Output
Hardware Output
Block Output Data Type
Scaling
TTL
Double
TTL low = 0.0
TTL high = 1.0
Block Parameters
Channel vector
Enter numbers between 1 and 8. This driver allows the selection of individual digital
output channels in arbitrary order. The number of elements defines the number
of digital output channels you use. For example, to use all of the digital output
channels, enter
[1:8]
Number the channels beginning with 1 even if the board manufacturer starts
numbering the channels with 0.
Reset vector
The reset vector controls the behavior of the channel at model termination. Enter a
scalar or a vector that is the same length as the channel vector. If you specify a scalar
value, that setting is replicated over the channel vector. If you specify a value of 1,
the corresponding channel is reset to the value specified in the initial value vector.
If you specify a value of 0, the channel remains at the last value attained while the
model was running.
Initial value vector
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
21-19
21
Diamond
The initial value vector contains the initial voltage values for the output channels.
Enter a scalar or a vector that is the same length as the channel vector. If you specify
a scalar value, that value is replicated as initial value over the channel vector. The
channels are set to the initial values between the time the model is downloaded and
the time it is started. If you provide an out-of-range value for a channel, that value is
adjusted to be within the range defined by the parameter Range.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
Base address
Enter the base address of the board. This entry must correspond to the DIP switch
setting on the board. For example, if the DIP switch setting is 300 (hexadecimal),
enter 0x300.
21-20
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Diamond Diamond-MM-32-AT
Diamond Diamond-MM-32-AT
Diamond Diamond-MM-32-AT board
Board
Diamond Diamond-MM-32-AT
General Description
The Diamond-MM-32-AT is a PC104 I/O board with 32 single or 16 differential analog
input (A/D) channels (16-bit) with a maximum sample rate of 200 kHz, 4 analog output
(D/A) channels (12-bit), 24 digital input and output lines.
The Simulink Real-Time block library supports this board with these driver blocks. These
blocks also support the Diamond-MM-32X-AT board.
• Diamond MM-32-AT Analog Input (A/D)
• Diamond MM-32-AT Frame Analog Input (A/D)
• Diamond MM-32-AT Analog Output (D/A)
• Diamond MM-32-AT Digital Input
• Diamond MM-32-AT Digital Output
Board Characteristics
Board name
Diamond-MM-32-AT
Manufacturer
Diamond Systems Corporation
Bus type
PC/104
Access method
I/O mapped
Multiple block instance support
A/D: No
D/A: Yes
DIO: Yes
Multiple board support
Yes
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
21-21
21
Diamond
Diamond MM-32-AT Analog Input (A/D)
MM-32-AT Analog Input block
Library
Simulink Real-Time Library for Diamond
Scaling Input to Output
Hardware Input
Block Output Data Type
Scaling
Volts
Double
1
Block Parameters
Channel configuration
From the list, select the following. Refer to the Diamond-MM-32-AT documentation
for a description of the configuration modes.
• 1-32 SE to select the configuration mode labeled A (32 single-ended input
channels)
• 1-16 DI to select the configuration mode labeled B (16 differential input
channels)
• 1-8SE 9-16 DI 17-24 SE to select the configuration mode labeled D (eight
single-ended input channels labeled 1 through 8, eight differential input channels
labeled 9 through 16, and an additional eight single-ended input channels labeled
17 through 24).
Note that the selected channel configuration must match the configuration set by
the jumpers in block J5. This driver does not support mode C.
First channel number
Enter the number of the first channel in a set of contiguous channels. Depending on
the value of the Channel Configuration parameter, the first channel number must
be within the range 1 through 32, 1 through 16, or 1 through 24.
21-22
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Diamond MM-32-AT Analog Input (A/D)
Number of channels
Enter the number of input channels you want to use. The maximum number of
channels varies between 1 and 32 and depends on Channel configuration and the
First channel number.
Range
From the list, choose a voltage range. The input range applies to all channels.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
Base address
Enter the base address of the board. This entry must correspond to the DIP switch
setting on the board. For example, if the DIP switch setting is 300 (hexadecimal),
enter 0x300.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
21-23
21
Diamond
Diamond MM-32-AT Frame Analog Input (A/D)
MM-32-AT Frame Analog Input block
Library
Simulink Real-Time Library for Diamond
Note
The Diamond-MM-32-AT Frame Analog Input block is a frame-based one. A frame
consists of a fixed number of samples (defined by the Number of scans per frame
parameter) for each of a specified set of channels. A scan is a group of samples, one for
each channel.
Normally, the system timer controls a Simulink Real-Time model at intervals specified
by the block Sample Time parameter. In contrast, the Diamond-MM-32-AT Frame
Analog Input block executes the model in which it occurs each time it converts a new
frame of data. You control this rate with the parameter values Interval between scans
and Number of scans per frame:
Rate = (Interval between scans) x (Number of scans per frame)
You control the frame size with the parameter values Number of channels and
Number of scans per frame:
frameSize = (Number of channels) x (Number of scans per frame)
After the block assembles a frame of data, it generates an interrupt, which triggers the
next iteration of the model.
Note, after you add this block to a model and are ready to configure the model, edit the
Simulink Real-Time code generation options.
21-24
1
From the model, select Simulation > Model Configuration Parameters.
2
Select the Code Generation node.
3
In the Target selection section, from the System target file list, browse to and
select slrt.tlc.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Diamond MM-32-AT Frame Analog Input (A/D)
4
In the Simulink Real-Time Options node, from the I/O board generating the
interrupt list, select the value Diamond-MM-32. This specifies that the DiamondMM-32-AT board generates the interrupt.
5
In the same node, from the Real-time interrupt source list, select the IRQ number
you have jumpered on the board.
6
In the same node, for the PCI slot (-1: autosearch) or ISA base address
parameter, enter the same ISA address as for the Diamond-MM-32-AT Frame block
Base address parameter.
7
Click OK and save the model.
Note: To enable the interrupt for the frame-based block, the 16-bit bus jumper must be
present in the board J7 jumper block. For further details, see the section labeled "16-Bit
Bus" in the Diamond-MM-32-AT documentation (http://www.diamondsystems.com/
files/binaries/DMM32v2.64.pdf).
Scaling Input to Output
Hardware Input
Block Output Data Type
Scaling
Volts
Double
1
Block Parameters
Channel configuration
From the list, select the following. Refer to the Diamond-MM-32-AT documentation
for a description of the configuration modes.
• 1-32 Single-Ended to select the configuration mode labeled A (32 single-ended
input channels)
• 1-16 Differential to select the configuration mode labeled B (16 differential
input channels)
• 1-8 and 7-24 Single-Ended; 9-16 Differential to select the
configuration mode labeled D (eight single-ended input channels labeled 1 through
8, eight differential input channels labeled 9 through 16, and an additional eight
single-ended input channels labeled 17 through 24).
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
21-25
21
Diamond
Note that the selected channel configuration must match the configuration set by
the jumpers in block J5. This driver does not support mode C.
Output Signal Type
From the list, select either Vector or Frame:
• Vector — Select Vector if you expect the output signal from this block to be the
input signal for a Simulink Real-Time scope or some other block that requires
vector input.
• Frame — Select Frame if you expect the output signal from this block to be the
input signal for a block that requires a frame. For example, a Signal Processing
block.
Range
From the list, select a voltage range. The input range applies to all channels.
First channel number
Enter the number of the first channel in a set of contiguous channels. Depending on
the value of the Channel Configuration parameter, the first channel number must
be within the range 1 through 32, 1 through 16, or 1 through 24.
Number the channels starting from 1 even if Diamond Systems numbers them
starting from 0.
Number of channels
Enter the number of input channels you want to use. The maximum number of
channels varies between 1 and 32 and depends on Channel configuration and
the First channel number. Note that hardware limitations require that either
the Number of channels or Number of scans per frame value be even. If your
application requires that both quantities be odd, add 1 to one of them and ignore the
resulting additional data.
Number of scans per frame
Enter the number of scans per frame. For a value of N, each output port of the block
will have a signal width of N and contain N samples of the corresponding channel.
Note that hardware limitations require that either the Number of channels or
Number of scans per frame value be even. If your application requires that both
quantities be odd, add 1 to one of them and ignore the resulting additional data.
Interval between conversions within a scan
From the list, select the interval, in microseconds, between conversions within a scan.
21-26
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Diamond MM-32-AT Frame Analog Input (A/D)
Interval between scans
Enter the interval, in seconds, between successive scans.
Base address
Enter the base address of the board. This entry must correspond to the DIP switch
setting on the board. For example, if the DIP switch setting is 300 (hexadecimal),
enter 0x300.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
21-27
21
Diamond
Diamond MM-32-AT Analog Output (D/A)
MM-32-AT Analog Output block
Library
Simulink Real-Time Library for Diamond
Scaling Input to Output
Hardware Output
Block Input Data Type
Scaling
Volts
Double
1
Block Parameters
Channel vector
Enter numbers between 1 and 4. This driver allows the selection of individual D/
A channels in arbitrary order. The number of elements defines the number of D/
A channels you use. For example, to use the first and second analog output (D/A)
channels, enter
[1,2]
Number the channels beginning with 1 even if the board manufacturer starts
numbering the channels with 0.
Range
From the list, choose a range code. This driver does not allow a different range for
each of the four channels. This selection must correspond to the range and bipolar/
unipolar jumper settings on the board.
The following table is a list of the ranges for this driver and the corresponding range
codes. The D/A specific jumpers on the board must be set as required by the ranges
entered.
21-28
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Diamond MM-32-AT Analog Output (D/A)
Input Range (V)
Range Code
-10 to +10
-10
-5 to +5
-5
0 to +10
10
0 to +5
5
For example, if the first and second channel range is 0 to +10 volts, enter
[10,10]
Reset vector
The reset vector controls the behavior of the channel at model termination. Enter a
scalar or a vector that is the same length as the channel vector. If you specify a scalar
value, that setting is replicated over the channel vector. If you specify a value of 1,
the corresponding channel is reset to the value specified in the initial value vector.
If you specify a value of 0, the channel remains at the last value attained while the
model was running.
Initial value vector
The initial value vector contains the initial voltage values for the output channels.
Enter a scalar or a vector that is the same length as the channel vector. If you specify
a scalar value, that value is replicated as the initial value over the channel vector.
The channels are set to the initial values between the time the model is downloaded
and the time it is started.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
Base address
Enter the base address of the board. This entry must correspond to the DIP switch
setting on the board. For example, if the DIP switch setting is 300 (hexadecimal),
enter 0x300.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
21-29
21
Diamond
Diamond MM-32-AT Digital Input
MM-32-AT Digital Input block
Library
Simulink Real-Time Library for Diamond
Note
The Diamond-MM-32-AT has one 8255 chip with three ports (A,B,C). Each port has a
maximum of 8 digital I/O lines that can be configured as inputs or outputs.
Use a separate driver block for each port. By selecting the digital input driver block, you
configure the port as input.
Scaling Input to Output
Hardware Input
Block Output Data Type
Scaling
TTL
Double
TTL low = 0.0
TTL high = 1.0
Block Parameters
Channel vector
Enter numbers between 1 and 8 to select the digital input lines used with this port.
This driver allows the selection of individual digital input lines in arbitrary order.
The number of elements defines the number of digital lines used.
For example, to use all the digital inputs for one port, enter
[1,2,3,4,5,6,7,8]
Number the lines beginning with 1 even if the board manufacturer starts numbering
the lines with 0.
21-30
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Diamond MM-32-AT Digital Input
Port
From the list choose A, B, or C. The I/O board has an 8255 chip with three ports. The
Port parameter defines which port of the 8255 chip is used for this driver block. Each
port has a maximum of eight digital lines that you can configure as inputs or outputs
depending on which driver block is chosen. One block is required for each port used.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
Base address
Enter the base address of the board. This entry must correspond to the DIP switch
setting on the board. For example, if the DIP switch setting is 300 (hexadecimal),
enter 0x300.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
21-31
21
Diamond
Diamond MM-32-AT Digital Output
MM-32-AT Digital Output block
Library
Simulink Real-Time Library for Diamond
Note
The Diamond-MM-32-AT has one 8255 chip with three ports (A,B,C). Each port has a
maximum of eight digital I/O lines that you can configure as inputs or outputs.
Use a separate driver block for each port. By selecting the digital output driver block, you
can configure the port as output.
Scaling Input to Output
Hardware Output
Block Input Data Type
Scaling
TTL
Double
< 0.5 = TTL low
≥ 0.5 = TTL high
Block Parameters
Channel vector
Enter numbers between 1 and 8 to select the digital output lines used with this port.
This driver allows the selection of individual digital output lines in arbitrary order.
The number of elements defines the number of digital lines used.
For example, to use all the digital outputs for one port, enter
[1,2,3,4,5,6,7,8]
Number the lines beginning with 1 even if the board manufacturer starts numbering
the lines with 0.
21-32
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Diamond MM-32-AT Digital Output
Port
From the list choose either A, B, or C. The I/O board has an 8255 chip with three
ports. The Port parameter defines which port of the 8255 chip is used for this driver
block. Each port has a maximum or eight digital lines that can be configured as
inputs or outputs depending on which driver block is chosen. One block is required
for each port used.
Reset vector
The reset vector controls the behavior of the channel at model termination. Enter a
scalar or a vector that is the same length as the channel vector. If you specify a scalar
value, that setting is replicated over the channel vector. If you specify a value of 1,
the corresponding channel is reset to the value specified in the initial value vector.
If you specify a value of 0, the channel remains at the last value attained while the
model was running.
Initial value vector
The initial value vector contains the initial values (0 or 1) of the output channels.
Enter a scalar or a vector that is the same length as the channel vector. If you enter
a scalar, that value is replicated as the initial value over the channel vector. The
channels are set to these initial values between the time the model is downloaded
and the time it is started.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
Base address
Enter the base address of the board. This entry must correspond to the DIP switch
setting on the board. For example, if the DIP switch setting is 300 (hexadecimal),
enter 0x300.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
21-33
21
Diamond
Diamond Garnet-MM
Diamond Garnet-MM board
Board
Diamond Garnet-MM
General Description
The Garnet-MM is an I/O board with 24 or 48 high current digital I/O lines that can
be configured in groups of eight for either digital input or digital output. There are two
versions of this board, 24 (GMM-24) or 48 (GMM-48) digital I/O lines. The 48 line version
has two 82C55 chips. Each chip has three 8-bit I/O ports for a total of 48 lines. The 24
line version has one 82C55 chip with three 8-bit I/O ports for a total of 24 lines.
The Simulink Real-Time block library supports this board with these driver blocks:
• Diamond Garnet-MM Digital Input
• Diamond Garnet-MM Digital Output
Board Characteristics
21-34
Board name
Garnet-MM
Manufacturer
Diamond Systems Corporation
Bus type
PC/104
Access method
I/O mapped
Multiple block instance support
DIO: Yes
Multiple board support
Yes
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Diamond Garnet-MM Digital Input
Diamond Garnet-MM Digital Input
Garnet-MM Digital Input block
Library
Simulink Real-Time Library for Diamond
Note
Each chip port of the Garnet-MM board can be configured independently for either input
or output. Use a separate driver block for each port. Select the digital output driver block
for a given port to configure the port for output.
Scaling Input to Output
Hardware Input
Block Output Data Type
Scaling
TTL
Double
TTL low = 0.0
TTL high = 1.0
Block Parameters
Channel vector
Enter numbers between 1 and 8 to select the digital input lines used with this port.
This driver allows the selection of individual digital input lines in arbitrary order.
The number of elements defines the number of digital lines used.
For example, to use all the digital inputs for the current port, enter
[1,2,3,4,5,6,7,8]
Number the lines beginning with 1 even if the board manufacturer starts numbering
the lines with 0.
Port
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
21-35
21
Diamond
From the list choose A, B, or C.
Chip
From the list choose 1 or 2. Note, only select 1 for the 24 line version of the GarnetMM board. Selecting 2 for the 24 line board does nothing. You can select either 1 or 2
for the 48 line version of the board.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
Base address
Enter the base address of the board. This entry must correspond to the DIP switch
setting on the board. For example, if the DIP switch setting is 300 (hexadecimal),
enter 0x300.
21-36
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Diamond Garnet-MM Digital Output
Diamond Garnet-MM Digital Output
Garnet-MM Digital Output block
Library
Simulink Real-Time Library for Diamond
Note
Each chip port of the Garnet-MM board can be configured independently for either input
or output. Use a separate driver block for each port. Select the digital input driver block
for a given port to configure the port for input.
Scaling Input to Output
Hardware Input
Block Output Data Type
Scaling
TTL
Double
TTL low = 0.0
TTL high = 1.0
Block Parameters
Channel vector
Enter numbers between 1 and 8 to select the digital output lines used with this port.
This driver allows the selection of individual digital output lines in arbitrary order.
The number of elements defines the number of digital lines used.
For example, to use all the digital outputs for the current port, enter
[1,2,3,4,5,6,7,8]
Number the lines beginning with 1 even if the board manufacturer starts numbering
the lines with 0.
Port
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
21-37
21
Diamond
From the list choose A, B, or C.
Reset vector
The reset vector controls the behavior of the channel at model termination. Enter a
scalar or a vector that is the same length as the channel vector. If you specify a scalar
value, that setting is replicated over the channel vector. If you specify a value of 1,
the corresponding channel is reset to the value specified in the initial value vector.
If you specify a value of 0, the channel remains at the last value attained while the
model was running.
Initial value vector
The initial value vector contains the initial values (0 or 1) of the output channels.
Enter a scalar or a vector that is the same length as the channel vector. If you enter
a scalar, that value is replicated as the initial value over the channel vector. The
channels are set to these initial values between the time the model is downloaded
and the time it is started.
Chip
From the list choose 1 or 2. Note, only select 1 for the 24 line version of the GarnetMM board. Selecting 2 for the 24 line board does nothing. You can select either 1 or 2
for the 48 line version of the board.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
Base address
Enter the base address of the board. This entry must correspond to the DIP switch
setting on the board. For example, if the DIP switch setting is 300 (hexadecimal),
enter 0x300.
21-38
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Diamond Onyx-MM
Diamond Onyx-MM
Diamond Onyx-MM board
Board
Diamond Onyx-MM
General Description
The Onyx-MM is an I/O board with 48 digital I/O lines that can be configured in groups
of eight for either input or output. The Simulink Real-Time software does not support the
Counter/Timer functionality of this board.
The Simulink Real-Time block library supports this board with these driver blocks:
• Diamond Onyx-MM Digital Input
• Diamond Garnet-MM Digital Output
Board Characteristics
Board name
Onyx-MM
Manufacturer
Diamond Systems Corporation
Bus type
PC/104
Access method
I/O mapped
Multiple block instance support
DIO: Yes
Multiple board support
Yes
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
21-39
21
Diamond
Diamond Onyx-MM Digital Input
Onyx-MM Digital Input block
Library
Simulink Real-Time Library for Diamond
Note
Onyx-MM boards have two digital I/O chips, each with three 8-bit digital I/O ports, for a
total of 48 I/O lines. Each port can be configured independently for either input or output.
Use a separate driver block for each port. Select the digital input driver block for a given
port to configure the port for input.
Scaling Input to Output
Hardware Input
Block Output Data Type
Scaling
TTL
Double
TTL low = 0.0
TTL high = 1.0
Block Parameters
Channel vector
Enter numbers between 1 and 8 to select the digital input lines used with this port.
This driver allows the selection of individual digital input lines in arbitrary order.
The number of elements defines the number of digital lines used.
For example, to use all the digital inputs for the current port, enter
[1,2,3,4,5,6,7,8]
Number the lines beginning with 1 even if the board manufacturer starts numbering
the lines with 0.
21-40
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Diamond Onyx-MM Digital Input
Port
From the list choose A, B, or C.
Chip
From the list choose 1 or 2.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
Base address
Enter the base address of the board. This entry must correspond to the DIP switch
setting on the board. For example, if the DIP switch setting is 300 (hexadecimal),
enter 0x300.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
21-41
21
Diamond
Diamond Onyx-MM Digital Output
Onyx-MM Digital Output block
Library
Simulink Real-Time Library for Diamond
Note
Onyx-MM boards have two digital I/O chips, each with three 8-bit digital I/O ports, for a
total of 48 I/O lines. Each port can be configured independently for either input or output.
Use a separate driver block for each port. Select the digital output driver block for a
given port to configure a port for output.
Scaling Input to Output
Hardware Input
Block Output Data Type
Scaling
TTL
Double
TTL low = 0.0
TTL high = 1.0
Block Parameters
Channel vector
Enter numbers between 1 and 8 to select the digital output lines used with this port.
This driver allows the selection of individual digital output lines in arbitrary order.
The number of elements defines the number of digital lines used.
For example, to use all the digital outputs for the current port, enter
[1,2,3,4,5,6,7,8]
Number the lines beginning with 1 even if the board manufacturer starts numbering
the lines with 0.
21-42
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Diamond Onyx-MM Digital Output
Port
From the list choose A, B, or C.
Reset vector
The reset vector controls the behavior of the channel at model termination. Enter a
scalar or a vector that is the same length as the channel vector. If you specify a scalar
value, that setting is replicated over the channel vector. If you specify a value of 1,
the corresponding channel is reset to the value specified in the initial value vector.
If you specify a value of 0, the channel remains at the last value attained while the
model was running.
Initial value vector
The initial value vector contains the initial values (0 or 1) of the output channels.
Enter a scalar or a vector that is the same length as the channel vector. If you enter
a scalar, that value is replicated as the initial value over the channel vector. The
channels are set to these initial values between the time the model is downloaded
and the time it is started.
Chip
From the list choose 1 or 2.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
Base address
Enter the base address of the board. This entry must correspond to the DIP switch
setting on the board. For example, if the DIP switch setting is 300 (hexadecimal),
enter 0x300.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
21-43
21
Diamond
Diamond Onyx-MM-DIO
Diamond Onyx-MM-DIO board
Board
Diamond Onyx-MM-DIO
General Description
The Onyx-MM is an I/O board with 48 digital I/O lines that can be configured in groups
of eight for either digital input or digital output.
The Simulink Real-Time block library supports this board with these driver blocks:
• Diamond Onyx-MM Digital Input
• Diamond Onyx-MM Digital Output
Board Characteristics
21-44
Board name
Onyx-MM-DIO
Manufacturer
Diamond Systems Corporation
Bus type
PC/104
Access method
I/O mapped
Multiple block instance support
DIO: Yes
Multiple board support
Yes
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Diamond Onyx-MM-DIO Digital Input
Diamond Onyx-MM-DIO Digital Input
Onyx-MM-DIO Digital Input block
Library
Simulink Real-Time Library for Diamond
Note
Onyx-MM-DIO boards have two digital I/O chips, each with three 8-bit digital I/O ports,
for a total of 48 I/O lines. Each port can be configured independently for either input or
output. Use a separate driver block for each port. Select the digital input driver block for
a given port to configure the port for input.
Scaling Input to Output
Hardware Input
Block Output Data Type
Scaling
TTL
Double
TTL low = 0.0
TTL high = 1.0
Block Parameters
Channel vector
Enter numbers between 1 and 8 to select the digital input lines used with this port.
This driver allows the selection of individual digital input lines in arbitrary order.
The number of elements defines the number of digital lines used.
For example, to use all the digital inputs for the current port, enter
[1,2,3,4,5,6,7,8]
Number the lines beginning with 1 even if the board manufacturer starts numbering
the lines with 0.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
21-45
21
Diamond
Port
From the list choose A, B, or C.
Chip
From the list choose 1 or 2.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
Base address
Enter the base address of the board. This entry must correspond to the DIP switch
setting on the board. For example, if the DIP switch setting is 300 (hexadecimal),
enter 0x300.
21-46
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Diamond Onyx-MM-DIO Digital Output
Diamond Onyx-MM-DIO Digital Output
Onyx-MM-DIO Digital Output block
Library
Simulink Real-Time Library for Diamond
Note
Onyx-MM-DIO boards have two digital I/O chips, each with three 8-bit digital I/O ports,
for a total of 48 I/O lines. Each port can be configured independently for either input or
output. Use a separate driver block for each port. Select the digital output driver block
for a given port to configure a port for output.
Scaling Input to Output
Hardware Input
Block Output Data Type
Scaling
TTL
Double
TTL low = 0.0
TTL high = 1.0
Block Parameters
Channel vector
Enter numbers between 1 and 8 to select the digital output lines used with this port.
This driver allows the selection of individual digital output lines in arbitrary order.
The number of elements defines the number of digital lines used.
For example, to use all the digital outputs for the current port, enter
[1,2,3,4,5,6,7,8]
Number the lines beginning with 1 even if the board manufacturer starts numbering
the lines with 0.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
21-47
21
Diamond
Port
From the list choose A, B, or C.
Reset vector
The reset vector controls the behavior of the channel at model termination. Enter a
scalar or a vector that is the same length as the channel vector. If you specify a scalar
value, that setting is replicated over the channel vector. If you specify a value of 1,
the corresponding channel is reset to the value specified in the initial value vector.
If you specify a value of 0, the channel remains at the last value attained while the
model was running.
Initial value vector
The initial value vector contains the initial values (0 or 1) of the output channels.
Enter a scalar or a vector that is the same length as the channel vector. If you enter
a scalar, that value is replicated as the initial value over the channel vector. The
channels are set to these initial values between the time the model is downloaded
and the time it is started.
Chip
From the list choose 1 or 2.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
Base address
Enter the base address of the board. This entry must correspond to the DIP switch
setting on the board. For example, if the DIP switch setting is 300 (hexadecimal),
enter 0x300.
21-48
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Diamond Prometheus, Athena, and Athena II
Diamond Prometheus, Athena, and Athena II
Diamond Prometheus, Athena, and Athena II boards
Board
Diamond Prometheus, Athena, Athena II
General Description
The Simulink Real-Time product supports the Diamond Prometheus, Athena, and
Athena II boards.
• Diamond Prometheus — Intel 486-based embedded PC/104 CPU board with 4 serial
ports, 2 USB ports, 1 parallel port, keyboard and mouse ports, floppy and IDE drive
connectors, a 100BaseT Ethernet connector, and provision for solid-state flashdisk
modules.
The Simulink Real-Time product supports Model PR-Z32-EA of Prometheus. In
addition to the above functionality, Model PR-Z32-EA also contains a data acquisition
subsystem. This subsystem supports 16 single-ended or 8 differential 16-bit A/D, 4 12bit analog outputs, 24 programmable digital I/O channels, and a 16-bit counter/timer.
• Diamond Athena — Pentium III class VIA Eden processor-based embedded PC/104
CPU with 4 serial ports, 4 USB ports, 1 parallel port, keyboard and mouse ports,
floppy and IDE drive connectors, a 100BaseT Ethernet connector, and a 16-bit data
acquisition circuit.
• Diamond Athena II — Single board computer (SBC). Pentium III class VIA Mark
CoreFusion processor based embedded PC/104 CPU with 4 serial ports, 4 USB ports,
1 parallel port, keyboard and mouse ports, floppy and IDE drive connectors, a 10/100
Mbps Ethernet connector, and a 16-bit data acquisition circuit.
The Simulink Real-Time block library supports the Prometheus Model PR-Z32-EA and
Athena with four driver blocks:
• Diamond Prometheus/Athena/Athena II Analog Input (A/D)
• Diamond Prometheus/Athena/Athena II Analog Output (D/A)
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
21-49
21
Diamond
• Diamond Prometheus/Athena/Athena II Digital Input
• Diamond Prometheus/Athena/Athena II Digital Output
The Simulink Real-Time software does not support the counter/timer on this board.
Board Characteristics
21-50
Board names
Prometheus, Athena, and Athena II
Manufacturer
Diamond Systems
Bus type
PC/104
Multiple block instance support
A/D: No, D/A: No, Digital I/O: Yes
Multiple board support
No
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Diamond Prometheus/Athena/Athena II Analog Input (A/D)
Diamond Prometheus/Athena/Athena II Analog
Input (A/D)
Prometheus/Athena Analog Input block
Library
Simulink Real-Time Library for Diamond
Scaling Input to Output
Hardware Input
Block Output Data Type
Scaling
Volts
Double
1
Block Parameters
First channel
Enter the number of the first channel in a set of contiguous channels. Depending
on the channel configuration selected, the first channel number must be within the
range:
• 1 through 8, if the input coupling is differential
• 1 through 16, if the input coupling is single-ended
Number the channels beginning with 1 even if the board manufacturer starts
numbering the channels with 0.
Number of channels
Enter the number of input channels you want to use. The maximum number of
channels varies between 1 and 16 and depends on the values of First channel
and Input coupling. For example, if the value of First channel is 1 and Input
coupling is Single-ended, the maximum value for Number of channels is 16.
Range (J13 setting)
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
21-51
21
Diamond
From the list, choose a voltage range. The input range applies to all channels. This
range must agree with jumper settings in block J13 on the board.
Input coupling (J13 setting)
From the list, select one from the following list of input modes:
• Single-ended (16 channels)
• Differential (8 channels)
This choice must correspond to the jumper setting in block J13 on the board.
Show error status output port
Select this check box to display real-time error information. This check box displays
an output port labeled E. As long as the driver does not detect an error on the
channels currently in use, this signal has a value of 0. Values of 1, 2, 4, 8, and so
forth respectively indicate problems on channels 1, 2, 3, 4, and so forth. To use one
signal to indicate errors on multiple channels, the driver combines these values. For
example, the E value 1 + 2 = 3 encodes the concurrent errors on channels 1 and 2, the
value 2 + 4 = 6 encodes the concurrent errors on channels 2 and 3, and so on.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
Base address
Enter the base address of the board. This entry must correspond to the DIP switch
setting on the board. For example, if the DIP switch setting is 300 (hexadecimal),
enter 0x300.
21-52
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Diamond Prometheus/Athena/Athena II Analog Output (D/A)
Diamond Prometheus/Athena/Athena II Analog
Output (D/A)
Prometheus/Athena Analog Output block
Library
Simulink Real-Time Library for Diamond
Scaling Input to Output
Hardware Output
Block Input Data Type
Scaling
Volts
Double
1
Block Parameters
Channel Vector
Enter a vector of numbers between 1 and 4. This driver allows the selection of
individual D/A channels in arbitrary order. The number of elements defines the
number of D/A channels used. For example, to use the first and second analog output
(D/A) channels, enter
[1,2]
Number the channels beginning with 1 even if the board manufacturer starts
numbering the channels with 0.
Range
From the list, choose a voltage range. The output range applies to all channels. This
range must agree with jumper settings in block J13 on the board.
Reset vector
The reset vector controls the behavior of the channel at model termination. Enter a
scalar or a vector that is the same length as the channel vector. If you specify a scalar
value, that setting is replicated over the channel vector. If you specify a value of 1,
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
21-53
21
Diamond
the corresponding channel is reset to the value specified in the initial value vector.
If you specify a value of 0, the channel remains at the last value attained while the
model was running.
Initial value vector
The initial value vector contains the initial voltage values for the output channels.
Enter a scalar or a vector that is the same length as the channel vector. If you specify
a scalar value, that value is replicated as initial value over the channel vector. The
channels are set to the initial values between the time the model is downloaded and
the time it is started.
If you provide an out-of-range value for a channel, that value is adjusted to be within
the range defined by the parameter Range.
Show error status output port
Select this check box to display real-time error information. This check box displays
an output port labeled E. As long as the driver does not detect an error on the
channels currently in use, this signal has a value of 0. Values of 1, 2, 4, 8, and so
forth respectively indicate problems on channels 1, 2, 3, 4, and so forth. To use one
signal to indicate errors on multiple channels, the driver combines these values. For
example, the E value 1 + 2 = 3 encodes the concurrent errors on channels 1 and 2, the
value 2 + 4 = 6 encodes the concurrent errors on channels 2 and 3, and so on.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
Base address
Enter the base address of the board. This entry must correspond to the DIP switch
setting on the board. For example, if the DIP switch setting is 300 (hexadecimal),
enter 0x300.
21-54
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Diamond Prometheus/Athena/Athena II Digital Input
Diamond Prometheus/Athena/Athena II Digital Input
Prometheus/Athena Digital Input block
Library
Simulink Real-Time Library for Diamond
Note
Prometheus and Athena boards have three I/O ports, each containing eight digital I/
O lines. You can independently configure these ports for either input or output. Use a
separate driver block for each port. By selecting the digital input driver block for a given
port, that port is configured for input.
Scaling Input to Output
Hardware Input
Block Output Data Type
Scaling
TTL
Double
TTL low = 0.0
TTL high = 1.0
Block Parameters
Channel Vector
Enter a vector of numbers between 1 and 8 to select the digital input lines used from
this port. This driver allows the selection of individual digital input lines in arbitrary
order. The number of elements defines the number of digital lines used. For example,
to use all of the digital inputs for the current port, enter
[1:8]
Number the lines starting with 1 even if the board manufacturer starts numbering
them with 0.
Port
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
21-55
21
Diamond
From the list, choose A, B, or C to choose one of the three I/O ports.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
Base address
Enter the base address of the board. This entry must correspond to the DIP switch
setting on the board. For example, if the DIP switch setting is 300 (hexadecimal),
enter 0x300.
21-56
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Diamond Prometheus/Athena/Athena II Digital Output
Diamond Prometheus/Athena/Athena II Digital
Output
Prometheus/Athena Digital Output block
Library
Simulink Real-Time Library for Diamond
Note
Prometheus and Athena boards have three I/O ports, each containing eight digital I/
O lines. You can independently configure these ports for either input or output. Use a
separate driver block for each port. By selecting the digital output driver block for a given
port, that port is configured for output.
Scaling Input to Output
Hardware Input
Block Output Data Type
Scaling
TTL
Double
TTL low = 0.0
TTL high = 1.0
Block Parameters
Channel Vector
Enter a vector of numbers between 1 and 8 to select the digital output lines used
from this port. This driver allows the selection of individual digital output lines in
arbitrary order. The number of elements defines the number of digital lines used. For
example, to use all of the digital outputs for the current port, enter
[1:8]
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
21-57
21
Diamond
Number the lines starting with 1 even if the board manufacturer starts numbering
them with 0.
Port
From the list, choose A, B, or C to choose one of the three I/O ports.
Reset vector
The reset vector controls the behavior of the channel at model termination. Enter a
scalar or a vector that is the same length as the channel vector. If you specify a scalar
value, that setting is replicated over the channel vector. If you specify a value of 1,
the corresponding channel is reset to the value specified in the initial value vector.
If you specify a value of 0, the channel remains at the last value attained while the
model was running.
Initial value vector
The initial value vector contains the initial voltage values for the output channels.
Enter a scalar or a vector that is the same length as the channel vector. If you specify
a scalar value, that value is replicated as the initial value over the channel vector.
The channels are set to the initial values between the time the model is downloaded
and the time it is started.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
Base address
Enter the base address of the board. This entry must correspond to the DIP switch
setting on the board. For example, if the DIP switch setting is 300 (hexadecimal),
enter 0x300.
21-58
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Diamond Quartz-MM-10
Diamond Quartz-MM-10
Diamond Quartz-MM-10 board
Board
Diamond Quartz-MM-10
General Description
The Quartz-MM 10 has eight digital input line and eight digital output lines.
The Simulink Real-Time block library supports this board with these driver blocks:
• Diamond Quartz-MM-10 Digital Input
• Diamond Quartz-MM-10 Digital Output
Board Characteristics
Board name
Quartz-MM-10
Manufacturer
Diamond Systems Corporation
Bus type
PC/104
Access method
I/O mapped
Multiple block instance support
Yes — a channel can be accessed by at most
one block
Multiple board support
Yes
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
21-59
21
Diamond
Diamond Quartz-MM-10 Digital Input
Quartz-MM-10 Digital Input block
Library
Simulink Real-Time Library for Diamond
Scaling Input to Output
Hardware Input
Block Output Data Type
Scaling
TTL
Double
TTL low = 0.0
TTL high = 1.0
Block Parameters
Channel vector
Enter numbers between 1 and 8 to select the digital input lines used with this port.
This driver allows the selection of individual digital input lines in arbitrary order.
The number of elements defines the number of digital lines used.
For example, to use all the digital inputs for one port, enter
[1,2,3,4,5,6,7,8]
Number the lines beginning with 1 even if the board manufacturer starts numbering
the lines with 0.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
Base address
Enter the base address of the board. This entry must correspond to the DIP switch
setting on the board. For example, if the DIP switch setting is 300 (hexadecimal),
enter 0x300.
21-60
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Diamond Quartz-MM-10 Digital Output
Diamond Quartz-MM-10 Digital Output
Quartz-MM-10 Digital Output block
Library
Simulink Real-Time Library for Diamond
Scaling Input to Output
Hardware Output
Block Input Data Type
Scaling
TTL
Double
< 0.5 = TTL low
≥ 0.5 = TTL high
Block Parameters
Channel vector
Enter numbers between 1 and 8 to select the digital input lines used with this port.
This driver allows the selection of individual digital input lines in arbitrary order.
The number of elements defines the number of digital lines used.
For example, to use all the digital inputs for one port, enter
[1,2,3,4,5,6,7,8]
Number the lines beginning with 1 even if the board manufacturer starts numbering
the lines with 0.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
Base address
Enter the base address of the board. This entry must correspond to the DIP switch
setting on the board. For example, if the DIP switch setting is 300 (hexadecimal),
enter 0x300.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
21-61
21
Diamond
Diamond Quartz-MM-5
Diamond Quartz-MM-5 board
Board
Diamond Quartz-MM-5
General Description
The Quartz-MM 5 has 8 digital input lines, 8 digital output lines.
The Simulink Real-Time block library supports this board with these driver blocks:
• Diamond Quartz-MM-5 Digital Input
• Diamond Quartz-MM-5 Digital Output
Board Characteristics
21-62
Board name
Quartz-MM-5
Manufacturer
Diamond Systems Corporation
Bus type
PC/104
Access method
I/O mapped
Multiple block instance support
Yes — a channel can be accessed by at most
one block
Multiple board support
Yes
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Diamond Quartz-MM-5 Digital Input
Diamond Quartz-MM-5 Digital Input
Quartz-MM-5 Digital Input block
Library
Simulink Real-Time Library for Diamond
Scaling Input to Output
Hardware Input
Block Output Data Type
Scaling
TTL
Double
TTL low = 0.0
TTL high = 1.0
Block Parameters
Channel vector
Enter numbers between 1 and 8 to select the digital input lines used with this port.
This driver allows the selection of individual digital input lines in arbitrary order.
The number of elements defines the number of digital lines used.
For example, to use all of the digital inputs for one port, enter
[1,2,3,4,5,6,7,8]
Number the lines beginning with 1 even if the board manufacturer starts numbering
the lines with 0.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
Base address
Enter the base address of the board. This entry must correspond to the DIP switch
setting on the board. For example, if the DIP switch setting is 300 (hexadecimal),
enter 0x300.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
21-63
21
Diamond
Diamond Quartz-MM-5 Digital Output
Quartz-MM-5 Digital Output block
Library
Simulink Real-Time Library for Diamond
Scaling Input to Output
Hardware Output
Block Input Data Type
Scaling
TTL
Double
< 0.5 = TTL low
≥ 0.5 = TTL high
Block Parameters
Channel vector
Enter numbers between 1 and 8 to select the digital input lines used with this port.
This driver allows the selection of individual digital input lines in arbitrary order.
The number of elements defines the number of digital lines used.
For example, to use all of the digital inputs for one port, enter
[1,2,3,4,5,6,7,8]
Number the lines beginning with 1 even if the board manufacturer starts numbering
the lines with 0.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
Base address
Enter the base address of the board. This entry must correspond to the DIP switch
setting on the board. For example, if the DIP switch setting is 300 (hexadecimal),
enter 0x300.
21-64
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Diamond Ruby-MM
Diamond Ruby-MM
Diamond Ruby-MM board
Board
Diamond Ruby-MM
General Description
The Diamond Ruby-MM is a PC104 I/O board with 4 or 8 single analog output (D/A)
channels (12-bit), unipolar and bipolar operation, ± 10V, ± 5V, 0-10V, 0-5V fixed ranges, ±
2.5V, 0-2.5V user-adjustable ranges, 24 digital input and output lines.
The Simulink Real-Time block library supports this board with these driver blocks:
• Diamond Ruby-MM Analog Output (D/A)
• Diamond Ruby-MM Digital Input
• Diamond Ruby-MM Digital Output
Board Characteristics
Board name
Diamond Ruby-MM
Manufacturer
Diamond Systems Corporation
Bus type
PC/104
Access method
I/O Mapped
Multiple block instance support
D/A: No, DIO: Yes
Multiple board support
Yes
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
21-65
21
Diamond
Diamond Ruby-MM Analog Output (D/A)
Ruby-MM Analog Output block
Library
Simulink Real-Time Library for Diamond
Scaling Input to Output
Hardware Output
Block Input Data Type
Scaling
Volts
Double
1
Block Parameters
Channel vector
List the output channels as a vector. Up to 8 different channels can be listed. To
specify the first three channels, enter
[1,2,3]
The board comes in two different hardware versions. If the 4-channel version of the
hardware is used and the channels 5-8 are listed, the those outputs will not show an
error, but the data will be ignored.
Range
The output range of the board is selected with jumpers on the board. Each group of 4
channels can be jumpered for the available ranges. The range you select in the Block
Parameters must correspond to the range specified by the jumper settings or you will
obtain unexpected results.
Reset vector
The reset vector controls the behavior of the channel at model termination. Enter a
scalar or a vector that is the same length as the channel vector. If you specify a scalar
value, that setting is replicated over the channel vector. If you specify a value of 1,
the corresponding channel is reset to the value specified in the initial value vector.
21-66
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Diamond Ruby-MM Analog Output (D/A)
If you specify a value of 0, the channel remains at the last value attained while the
model was running.
Initial value vector
The initial value vector contains the initial voltage values for the output channels.
Enter a scalar or a vector that is the same length as the channel vector. If you specify
a scalar value, that value is replicated as the initial value over the channel vector.
The channels are set to the initial values between the time the model is downloaded
and the time it is started.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
Base address
Enter the base address of the board. This entry must correspond to the DIP switch
setting on the board. For example, if the DIP switch setting is 300 (hexadecimal),
enter 0x300.
Note: Please consult the Diamond Ruby-MM hardware manuals for more information on
jumper settings and I/O connections.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
21-67
21
Diamond
Diamond Ruby-MM Digital Input
Ruby-MM Digital Input block
Scaling Input to Output
Hardware Input
Block Output Data Type
Scaling
TTL
Double
TTL low = 0.0
TTL high = 1.0
Block Parameters
Channel vector
Enter numbers between 1 and 8 to select the digital input lines to be read. This
driver allows the selection of up to 8 individual digital input lines in arbitrary order.
The number of elements defines the number of digital lines used.
For example, to use all of the digital inputs enter
[1,2,3,4,5,6,7,8]
Number the lines beginning with 1 even though the board manufacturer starts
numbering lines with 0.
Port
From the Port list, choose either A, B, or C. The Port parameter defines which port is
used for this driver block. Each port has a maximum of 8 digital inputs. One block is
required for each port used.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
Base address
Enter the base address of the board. This entry must correspond to the DIP switch
setting on the board. For example, if the DIP switch setting is 300 (hexadecimal),
enter 0x300.
21-68
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Diamond Ruby-MM Digital Input
Note: Please consult the Diamond Ruby-MM hardware manuals for more information on
jumper settings and I/O connections.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
21-69
21
Diamond
Diamond Ruby-MM Digital Output
Ruby-MM Digital Output block
Library
Simulink Real-Time Library for Diamond
Scaling Input to Output
Hardware Output
Block Input Data Type
Scaling
TTL
Double
< 0.5 = TTL low
≥ 0.5 = TTL high
Block Parameters
Channel vector
Enter numbers between 1 and 8 to select the digital output lines to drive. This driver
allows the selection of up to 8 individual digital output lines in arbitrary order. The
number of elements defines the number of digital lines used.
For example, to use all of the digital inputs enter
[1,2,3,4,5,6,7,8]
Number the lines beginning with 1 even though the board manufacturer starts
numbering lines with 0.
Port
From the Port list, choose either A, B, or C. The Port parameter defines which port is
used for this driver block. Each port has a maximum of 8 digital outputs. One block is
required for each port used.
Reset vector
The reset vector controls the behavior of the channel at model termination. Enter a
scalar or a vector that is the same length as the channel vector. If you specify a scalar
21-70
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Diamond Ruby-MM Digital Output
value, that setting is replicated over the channel vector. If you specify a value of 1,
the corresponding channel is reset to the value specified in the initial value vector.
If you specify a value of 0, the channel remains at the last value attained while the
model was running.
Initial value vector
The initial value vector contains the initial values (0 or 1) of the output channels.
Enter a scalar or a vector that is the same length as the channel vector. If you enter
a scalar, that value is replicated as the initial value over the channel vector. The
channels are set to these initial values between the time the model is downloaded
and the time it is started.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
Base address
Enter the base address of the board. This entry must correspond to the DIP switch
setting on the board. For example, if the DIP switch setting is 300 (hexadecimal),
enter 0x300.
Note: Please consult the Diamond Ruby-MM hardware manuals for more information on
jumper settings and I/O connections.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
21-71
21
Diamond
Diamond Ruby-MM-416
Diamond Ruby-MM-416 board
Board
Diamond Ruby-MM-416
General Description
The Ruby-MM-416 is an I/O board with four 16-bit analog output (D/A) channels, and 24
digital I/O lines that can be configured in groups of eight for either input or output.
The Simulink Real-Time block library supports this board with these driver blocks:
• Diamond Ruby-MM-416 Analog Output (D/A)
• Diamond Ruby-MM-416 Digital Input
• Diamond Ruby-MM-416 Digital Output
Board Characteristics
21-72
Board name
Ruby-MM-416
Manufacturer
Diamond Systems Corporation
Bus type
ISA (PCI/104)
Access method
I/O Mapped
Multiple block instance support
D/A: No
DIO: Yes
Multiple board support
Yes
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Diamond Ruby-MM-416 Analog Output (D/A)
Diamond Ruby-MM-416 Analog Output (D/A)
Ruby-MM-416 Analog Output block
Library
Simulink Real-Time Library for Diamond
Scaling Input to Output
Hardware Output
Block Input Data Type
Scaling
Volts
Double
1
Block Parameters
Channel vector
Enter a vector containing channel numbers between 1 and 4. This driver allows the
selection of individual D/A channels in arbitrary order. The number of elements
defines the number of D/A channels used. For example, to use the first and second
analog output (D/A) channels, enter
[1,2]
Number the channels beginning with 1 even if the board manufacturer starts
numbering the channels with 0.
Range vector
The range vector must be a scalar or a vector the same length as the channel vector.
The vector entries must use range codes from the following table
Input Range (V)
Range Code
-10 to +10
-10
-5 to +5
-5
0 to 10
10
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
21-73
21
Diamond
The range codes you enter must be consistent with the jumper settings on the board.
Reset vector
The reset vector controls the behavior of the channel at model termination. Enter a
scalar or a vector that is the same length as the channel vector. If you specify a scalar
value, that setting is replicated over the channel vector. If you specify a value of 1,
the corresponding channel is reset to the value specified in the initial value vector.
If you specify a value of 0, the channel remains at the last value attained while the
model was running.
Initial value vector
The initial value vector contains the initial voltage values for the output channels.
Enter a scalar or a vector that is the same length as the channel vector. If you specify
a scalar value, that value is replicated as initial value over the channel vector. The
channels are set to the initial values between the time the model is downloaded and
the time it is started. If you provide a value that is out of the channel's range, the
value is reset to the lower or upper range value.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
Base address
Enter the base address of the board. This entry must correspond to the DIP switch
setting on the board. For example, if the DIP switch setting is 300 (hexadecimal),
enter 0x300.
21-74
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Diamond Ruby-MM-416 Digital Input
Diamond Ruby-MM-416 Digital Input
Ruby-MM-416 Digital Input block
Library
Simulink Real-Time Library for Diamond
Note
Ruby-MM-416 boards have three I/O ports, each containing eight digital I/O lines. These
ports can be configured independently for either input or output. Use a separate driver
block for each port. By selecting the digital input driver block for a given port, you
configure that port for input.
Scaling Input to Output
Hardware Input
Block Output Data Type
Scaling
TTL
Double
TTL low = 0.0
TTL high = 1.0
Block Parameters
Channel vector
Enter numbers between 1 and 8 to select the digital input lines used with this port.
This driver allows the selection of individual digital input lines in arbitrary order.
The number of elements defines the number of digital lines used.
For example, to use all the digital inputs for the current port, enter
[1,2,3,4,5,6,7,8]
Number the lines beginning with 1 even if the board manufacturer starts numbering
the lines with 0.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
21-75
21
Diamond
Port
From the list choose A, B, or C.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
Base address
Enter the base address of the board. This entry must correspond to the DIP switch
setting on the board. For example, if the DIP switch setting is 300 (hexadecimal),
enter 0x300.
21-76
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Diamond Ruby-MM-416 Digital Output
Diamond Ruby-MM-416 Digital Output
Ruby-MM-416 Digital Output block
Library
Simulink Real-Time Library for Diamond
Note
Ruby-MM-416 boards have three I/O ports, each containing eight digital I/O lines. These
ports can be configured independently for either input or output. Use a separate driver
block for each port. By selecting the digital input driver block for a given port, that port is
configured for input.
Scaling Input to Output
Hardware Input
Block Output Data Type
Scaling
TTL
Double
TTL low = 0.0
TTL high = 1.0
Block Parameters
Channel vector
Enter numbers between 1 and 8 to select the digital output lines used with this port.
This driver allows the selection of individual digital output lines in arbitrary order.
The number of elements defines the number of digital lines used.
For example, to use all the digital outputs for the current port, enter
[1,2,3,4,5,6,7,8]
Number the lines beginning with 1 even if the board manufacturer starts numbering
the lines with 0.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
21-77
21
Diamond
Port
From the list choose A, B, or C.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
Base address
Enter the base address of the board. This entry must correspond to the DIP switch
setting on the board. For example, if the DIP switch setting is 300 (hexadecimal),
enter 0x300.
21-78
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Diamond Ruby-MM-1612
Diamond Ruby-MM-1612
Diamond Ruby-MM-1612 board
Board
Diamond Ruby-MM-1612
General Description
The Ruby-MM-1612 is an I/O board with 16 (12-bit) analog output (D/A) channels, and 24
digital I/O lines that can be configured in groups of eight for either input or output.
The Simulink Real-Time block library supports this board with these driver blocks:
• Diamond Ruby-MM-1612 Analog Output (D/A)
• Diamond Ruby-MM-1612 Digital Input
• Diamond Ruby-MM-1612 Digital Output
Board Characteristics
Board name
Ruby-MM-1612
Manufacturer
Diamond Systems Corporation
Bus type
PC/104
Access method
I/O Mapped
Multiple block instance support
D/A: No
DIO: Yes
Multiple board support
Yes
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
21-79
21
Diamond
Diamond Ruby-MM-1612 Analog Output (D/A)
Ruby-MM-1612 Analog Output block
Library
Simulink Real-Time Library for Diamond
Scaling Input to Output
Hardware Output
Block Input Data Type
Scaling
Volts
Double
1
Block Parameters
Channel vector
Enter a vector containing channel numbers between 1 and 16. This driver allows
the selection of individual D/A channels in arbitrary order. The number of elements
defines the number of D/A channels used. For example, to use the first and second
analog output (D/A) channels, enter
[1,2]
Number the channels beginning with 1 even if the board manufacturer starts
numbering the channels with 0.
Range for bank 1, Range for bank 2
Bank 1 consists of channels 1 to 8 and bank 2 consists of channels 9 to 16. The output
range may be specified on a per-bank basis. These ranges must correspond to the
jumper settings in header R4 on the board. See the board manual for details.
If you select a range of either -5V to +5V or 0 to +5V for one bank, then it is
not possible to select a range of either -10V to +10V or 0 to +10V for the other
bank. This is because jumper 5 in header J4 (On-Board Reference Full-Scale Voltage
Selection) affects all channels, not just those of a single bank. See the board manual
21-80
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Diamond Ruby-MM-1612 Analog Output (D/A)
for details. The following lists the allowed output voltage range combinations for
the two channel banks. B1 is the first bank of channels, B2 is the second bank of
channels.
B1
B2
Configuration
±10 V
±10 V
C11
0-10 V
±10 V
C41
±5 V
±5 V
C22
±2.5
±5 V
C32
0-5 V
±5 V
C52
0-2.5 V
±5 V
C62
±5 V
±2.5 V
C23
±2.5 V
±2.5 V
C33
0-5 V
±2.5 V
C53
0-2.5 V
±2.5 V
C63
±10 V
0-10 V
C14
0-10 V
0-10 V
C44
±5 V
0-5 V
C25
±2.5 V
0-5 V
C35
0-5 V
0-5 V
C55
0-2.5 V
0-5 V
C65
±5 V
0-2.5 V
C26
±2.5 V
0-2.5 V
C36
0-5 V
0-2.5 V
C56
0-2.5 V
0-2.5 V
C66
This driver supports the Adjustable Reference Voltage. You can use this feature with
either output range -2.5V to +2.5V or 0 to +2.5V. If for example you adjust
potentiometer R4 to 2.3 V (instead of the default setting of 2.5), then an input signal
of 1.2 results in an output voltage of (1.2 / 2.5) * 2.3 V = 1.1 V. See the board manual
for details.
Reset vector
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
21-81
21
Diamond
The reset vector controls the behavior of the channel at model termination. Enter a
scalar or a vector that is the same length as the channel vector. If you specify a scalar
value, that setting is replicated over the channel vector. If you specify a value of 1,
the corresponding channel is reset to the value specified in the initial value vector.
If you specify a value of 0, the channel remains at the last value attained while the
model was running.
Initial value vector
The initial value vector contains the initial voltage values for the output channels.
Enter a scalar or a vector that is the same length as the channel vector. If you specify
a scalar value, that value is replicated as initial value over the channel vector. The
channels are set to the initial values between the time the model is downloaded and
the time it is started. If you provide a value that is out of the channel's range, the
value is reset to the lower or upper range value.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
Base address
Enter the base address of the board. This entry must correspond to the DIP switch
setting on the board. For example, if the DIP switch setting is 300 (hexadecimal),
enter 0x300.
21-82
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Diamond Ruby-MM-1612 Digital Input
Diamond Ruby-MM-1612 Digital Input
Ruby-MM-1612 Digital Input block
Library
Simulink Real-Time Library for Diamond
Note
Ruby-MM-1612 boards have three I/O ports, each containing eight digital I/O lines. These
ports can be configured independently for either input or output. Use a separate driver
block for each port. By selecting the digital input driver block for a given port, that port is
configured for input.
Scaling Input to Output
Hardware Input
Block Output Data Type
Scaling
TTL
Double
TTL low = 0.0
TTL high = 1.0
Block Parameters
Channel vector
Enter numbers between 1 and 8 to select the digital input lines used with this port.
This driver allows the selection of individual digital input lines in arbitrary order.
The number of elements defines the number of digital lines used.
For example, to use all the digital inputs for the current port, enter
[1,2,3,4,5,6,7,8]
Number the lines beginning with 1 even if the board manufacturer starts numbering
the lines with 0.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
21-83
21
Diamond
Port
From the list choose A, B, or C.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
Base address
Enter the base address of the board. This entry must correspond to the DIP switch
setting on the board. For example, if the DIP switch setting is 300 (hexadecimal),
enter 0x300.
21-84
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Diamond Ruby-MM-1612 Digital Output
Diamond Ruby-MM-1612 Digital Output
Ruby-MM-1612 Digital Output block
Library
Simulink Real-Time Library for Diamond
Note
Ruby-MM-1612 series boards have three I/O ports, each containing eight digital I/O lines.
These ports can be configured independently for either input or output. Use a separate
driver block for each port. By selecting the digital output driver block for a given port,
you configure that port for output.
Scaling Input to Output
Hardware Input
Block Output Data Type
Scaling
TTL
Double
TTL low = 0.0
TTL high = 1.0
Block Parameters
Channel vector
Enter numbers between 1 and 8 to select the digital output lines used with this port.
This driver allows the selection of individual digital output lines in arbitrary order.
The number of elements defines the number of digital lines used.
For example, to use all the digital outputs for the current port, enter
[1,2,3,4,5,6,7,8]
Number the lines beginning with 1 even if the board manufacturer starts numbering
the lines with 0.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
21-85
21
Diamond
Port
From the list choose A, B, or C.
Reset vector
The reset vector controls the behavior of the channel at model termination. Enter a
scalar or a vector that is the same length as the channel vector. If you specify a scalar
value, that setting is replicated over the channel vector. If you specify a value of 1,
the corresponding channel is reset to the value specified in the initial value vector.
If you specify a value of 0, the channel remains at the last value attained while the
model was running.
Initial value vector
The initial value vector contains the initial voltage values for the output channels.
Enter a scalar or a vector that is the same length as the channel vector. If you specify
a scalar value, that value is replicated as initial value over the channel vector. The
channels are set to the initial values between the time the model is downloaded and
the time it is started. If you provide a value that is out of the channel's range, the
value is reset to the lower or upper range value.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
Base address
Enter the base address of the board. This entry must correspond to the DIP switch
setting on the board. For example, if the DIP switch setting is 300 (hexadecimal),
enter 0x300.
21-86
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22
Model-Based FlexRay
Communications Support
• “Install FlexRay Hardware and Software for Configuration” on page 22-3
• “FlexRay Installation and Setup Requirements” on page 22-4
• “Configure FlexRay Node for Signal Access” on page 22-5
• “Create Busmirror Project for Signal Access” on page 22-6
• “Select FlexRay Node for Signal Access” on page 22-9
• “Refine FlexRay Node for Signal Access” on page 22-10
• “Generate Project Code for Signal Access” on page 22-13
• “Prepare FlexRay Network for Signal Access” on page 22-17
• “Prepare FlexRay Model for Signal Access” on page 22-18
• “Configure FlexRay Config Blocks for Signal Access” on page 22-20
• “Configure FlexRay Write Frame Signals Blocks for Signal Access” on page 22-22
• “Configure FlexRay Read Frame Signals Blocks for Signal Access” on page 22-27
• “Configure FlexRay POC Status Blocks for Signal Access” on page 22-30
• “Configure FlexRay Model Configuration Parameters for Signal Access” on page
22-31
• “Configure FlexRay Node for PDU Access” on page 22-34
• “Create Busmirror Project for PDU Access” on page 22-35
• “Select FlexRay Node for PDU Access” on page 22-38
• “Refine FlexRay Node for PDU Access” on page 22-39
• “Generate Project Code for PDU Access” on page 22-42
• “Prepare FlexRay Network for PDU Access” on page 22-46
• “Prepare FlexRay Model for PDU Access” on page 22-47
• “Configure FlexRay Config Blocks for PDU Access” on page 22-49
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22
Model-Based FlexRay Communications Support
• “Configure FlexRay Pack PDU Blocks” on page 22-51
• “Configure FlexRay Write PDU Blocks” on page 22-55
• “Configure FlexRay Commit Frame Block for PDU Access” on page 22-59
• “Configure FlexRay Read PDU Blocks” on page 22-61
• “Configure FlexRay Unpack PDU Blocks” on page 22-64
• “Configure FlexRay POC Status Blocks for PDU Access” on page 22-66
• “Configure FlexRay Model Configuration Parameters for PDU Access” on page
22-67
• “Configure FlexRay Node for Error Injection” on page 22-70
• “Create Busmirror Project for Error Injection” on page 22-71
• “Select FlexRay Node for Error Injection” on page 22-74
• “Refine FlexRay Node for Error Injection” on page 22-75
• “Generate Project Code for Error Injection” on page 22-77
• “Prepare FlexRay Network for Error Injection” on page 22-81
• “Prepare FlexRay Model for Error Injection” on page 22-82
• “Configure FlexRay Config Blocks for Error Injection” on page 22-84
• “Configure FlexRay Write Frame Signals Blocks for Error Injection” on page 22-86
• “Configure FlexRay Read Frame Signals Blocks for Error Injection” on page 22-91
• “Configure FlexRay Error Injection Blocks” on page 22-94
• “Configure FlexRay POC Status Blocks for Error Injection” on page 22-99
• “Configure FlexRay Model Configuration Parameters for Error Injection” on page
22-100
• “Evaluate Clear from Bus Preconditions” on page 22-103
• “FlexRay Troubleshooting” on page 22-105
• “Blocks — Alphabetical List” on page 22-107
22-2
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Install FlexRay Hardware and Software for Configuration
Install FlexRay Hardware and Software for Configuration
To install FlexRay hardware and software, verify that your hardware meets the
installation requirements. See “FlexRay Installation and Setup Requirements” on page
22-4.
1
Install the EB tresos Busmirror configuration software on the development computer
according to the manufacturer instructions.
2
Install the required FlexRay cards in the target computer according to the
manufacturer instructions.
3
To determine the PCI bus and slot for the FlexRay cards, in the Command Window,
type:
slrtpingtarget
tg=slrt;
getPCIInfo(tg, 'installed')
Record the Bus and Slot numbers for each Elektrobit EB5100 card in the target
computer.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-3
22
Model-Based FlexRay Communications Support
FlexRay Installation and Setup Requirements
Before you install the FlexRay hardware and software, verify the installation
requirements.
To install the required FlexRay boards, the target computer must be a PCI bus computer
with the required free slots.
To install the EB tresos Busmirror software and libraries, the development computer
must meet the following requirements:
• PC compatible workstation with Windows XP SP2/SP3 or Windows 7 installed.
• If the software is using the USB dongle license, a free USB port.
• If the software is using a network license server, an Ethernet connection.
• 800 MB of free disk space.
• 512 MB RAM.
• If you are installing from a CD, a CD ROM drive.
• If you are installing from Download Area EB Austria, an internet connection.
Acquire the workstation, the FlexRay boards, the EB tresos Busmirror software
and libraries, and the required licenses from Speedgoat. See “Speedgoat Target
Configuration”.
22-4
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Configure FlexRay Node for Signal Access
Configure FlexRay Node for Signal Access
To configure a FlexRay node, first install the EB tresos Busmirror configuration software
and one or more FlexRay boards in your target computer. See “Install FlexRay Hardware
and Software for Configuration” on page 22-3.
This procedure configures the FlexRay network for model dFlexRaySimpleExample.
This model consists of two FlexRay nodes, Ramp_ECU and Invert_ECU. A FlexRay node
corresponds to a FlexRay board, so install two FlexRay boards in your target computer.
Create a separate project for each FlexRay node.
The following procedure configures node Ramp_ECU, which has two signals,
RampSignal_ChA and RampSignal_Dyn_ChA.
1
“Create Busmirror Project for Signal Access” on page 22-6
2
“Select FlexRay Node for Signal Access” on page 22-9
3
“Refine FlexRay Node for Signal Access” on page 22-10
4
“Generate Project Code for Signal Access” on page 22-13
Repeat these steps for node Invert_ECU, which has one signal, InvertSignal_ChA.
The next task is “Prepare FlexRay Network for Signal Access” on page 22-17.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-5
22
Model-Based FlexRay Communications Support
Create Busmirror Project for Signal Access
The following procedure uses the Ramp_ECU node of model dFlexRaySimpleExample as
an example.
The required FlexRay configuration file is:
matlab\toolbox\rtw\targets\xpc\xpcdemos\
FlexRayConfigFiles\ClusterConfig\FlexRayRampDemo_Signals.xml
1
Open EB tresos Busmirror in your working folder, for example C:\workdir.
2
To create a Busmirror project for node Ramp_ECU, in the Manage Projects tab, click
New Project.
3
In the Templates list, select GenericRBS.
4
In the Name text box, enter a name for the node, for example ramp_ecu.
5
To fill the Location text box, navigate to C:\workdir.
6
Click Next.
7
To fill the Select file to import text box, navigate to and select the required
FlexRay configuration file.
8
Select the Copy input file to 'cfg_in' directory check box.
9
Click Finish.
The software copies the input file to the 'cfg_in' folder and import FIBEX-format data
from the input file. The Busmirror window looks like this figure.
22-6
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Create Busmirror Project for Signal Access
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-7
22
Model-Based FlexRay Communications Support
10 In the Manage Projects tab, click Save Project.
This procedure uses a configuration file specialized for this example. Template
configuration files in FIBEX format (.xml) and BOR format (.bor) are supplied with the
EB tresos Busmirror installation. They are stored in the Examples folder under the EB
\tresos_Busmirror folder.
To create a custom configuration file, use a separate tool such as SIMTOOLS (available
from www.speedgoat.ch).
If you have a custom configuration file in FIBEX format, open the Import Data tab and
use Import from FIBEX to import the configuration data. This process replaces the
configuration data imported while you created the project with new data from the FIBEX
file.
The next task is “Select FlexRay Node for Signal Access” on page 22-9.
22-8
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Select FlexRay Node for Signal Access
Select FlexRay Node for Signal Access
The following procedure assumes that you have already created an EB tresos Busmirror
project for node Ramp_ECU.
1
Open EB tresos Busmirror in your working folder, C:\workdir.
2
To configure the Ramp_ECU node, in the ECU Configuration tab, select FlexRay
ECU Distribution.
3
In the Real Controllers list, select Ramp_ECU.
For this model, you can configure only one FlexRay node (board) per project file. In
general, you can select and emulate multiple real controllers on one EB5100 FlexRay
board, for example to perform RestBus simulation (RBS).
4
Click the Arrow button >.
5
Click Finish.
6
In the Manage Projects tab, click Save Project.
The next task is optional: “Refine FlexRay Node for Signal Access” on page 22-10.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-9
22
Model-Based FlexRay Communications Support
Refine FlexRay Node for Signal Access
The following procedure assumes that you have already created and saved an EB tresos
Busmirror project for node Ramp_ECU. If you can use the EB tresos Busmirror project for
node Ramp_ECU as it is, you can skip this step.
1
Open EB tresos Busmirror in your working folder, C:\workdir.
2
To configure the Ramp_ECU node, in the BUSMIRROR Refinement tab, select
Signals.
3
In the Signal list, click RampSignal_ChA.
4
In the box for property Transport Data Type, click the Continuation icon
then verify that the value is sint32 in the Transport Data Type - 15 list.
To change this value, select the required value from the list.
5
22-10
Click Apply and then Close in the Transport Data Type dialog box.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
and
Refine FlexRay Node for Signal Access
6
In the box for property Bit Size [bit], verify that the value is 32.
To change this value, type the required value in the box.
7
Click Apply and then Close in the Entity View - Signal dialog box.
8
In the BUSMIRROR Refinement tab, select Frame-Signal Editor.
9
In the Frame - 5 list, select the line containing frame RampFrame_ChA.
10 In the Signal - 4 list, verify that signal RampFrame_ChA is also checked.
To add a signal to a frame, select the signal, select the frame, and then click Add to
Frame.
To remove a signal from a frame, select the signal, select the frame, and then click
Remove from Frame.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-11
22
Model-Based FlexRay Communications Support
11 Click Apply and then Close in the Frame - Signal Editor dialog box.
12 In the Manage Projects tab, click Save Project.
Repeat these steps for signal RampSignal_Dyn_ChA.
The next task is “Generate Project Code for Signal Access” on page 22-13.
22-12
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Generate Project Code for Signal Access
Generate Project Code for Signal Access
The following procedure assumes that you have already selected and configured the EB
tresos Busmirror project Ramp_ECU.
1
Open EB tresos Busmirror in your working folder, C:\workdir.
2
To generate code for the Ramp_ECU node, in the ECU Configuration tab, select
Code Generation.
3
In the Busmirror Generator dialog box, clear the Compile for EB2100 Platform
and Compile for EB6100 Platform check boxes.
Verify that the Generate Code check box is selected and that the Start
communication automatically check box is cleared.
4
Click Start Process.
After code generation is complete, the dialog box looks like this figure.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-13
22
Model-Based FlexRay Communications Support
EB tresos Busmirror generates code in the project folder and subfolders.
To modify the generated code, run Busmirror, change the Busmirror configuration,
and rebuild the project. Do not hand-modify the project files.
5
Click Close.
6
In the Manage Projects tab, click Save Project.
At the end of the build procedure, the Busmirror window looks like this figure.
22-14
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Generate Project Code for Signal Access
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-15
22
Model-Based FlexRay Communications Support
Repeat these steps for node Invert_ECU, which has one signal, InvertSignal_ChA.
The next task is “Prepare FlexRay Network for Signal Access” on page 22-17.
22-16
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Prepare FlexRay Network for Signal Access
Prepare FlexRay Network for Signal Access
To prepare the FlexRay network for execution, as required by your network, do the
following steps.
1
Connect FlexRay cables to the channel A and B connectors on the Elektrobit EB5100
cards.
By default, cables from channel A connectors on one board connect to channel A
connectors on another, and similarly for cables from channel B connectors.
2
Connect bus terminators to both ends of the A and B channels. The A and B channels
together form the FlexRay bus.
3
Connect FlexRay cables to the FlexRay device.
The next task is “Prepare FlexRay Model for Signal Access” on page 22-18.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-17
22
Model-Based FlexRay Communications Support
Prepare FlexRay Model for Signal Access
Before configuring model dFlexRaySimpleExample, record the bus and slot numbers of
the FlexRay boards in the target computer and configure each FlexRay node.
To configure model dFlexRaySimpleExample, perform the following tasks.
1
22-18
“Configure FlexRay Config Blocks for Signal Access” on page 22-20.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Prepare FlexRay Model for Signal Access
2
“Configure FlexRay Write Frame Signals Blocks for Signal Access” on page
22-22.
3
“Configure FlexRay Read Frame Signals Blocks for Signal Access” on page 22-27.
4
“Configure FlexRay POC Status Blocks for Signal Access” on page 22-30.
5
“Configure FlexRay Model Configuration Parameters for Signal Access” on page
22-31.
The next tasks are to build, download, and execute the model.
The FlexRay libraries are licensed. For the first build of a FlexRay model, specify the
folder where the license file resides. If you hold a floating license, specify the address of
the license server.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-19
22
Model-Based FlexRay Communications Support
Configure FlexRay Config Blocks for Signal Access
To configure the FlexRay Config block for signal access in model
dFlexRaySimpleExample, execute the following steps.
22-20
1
Double-click the block labeled EB5100 - Device 1 Config. This block is the block
corresponding to the Ramp_ECU controller.
2
In text box Busmirror project file (.bmprj), navigate to the project folder for the
Ramp_ECU controller and click Project.bmprj.
3
Set the Join network on simulation start check box.
4
Clear the Enable board error codes check box.
5
Set Device index to 1.
6
Type the bus and slot numbers that you recorded while installing the first FlexRay
board in text boxes PCI bus and PCI slot.
7
Set Sample time (-1 for inherited) to -1.
8
Click Refresh config data to propagate the changes to the blocks that have Device
index set to 1.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Configure FlexRay Config Blocks for Signal Access
9
Click OK.
Repeat these steps for the block labeled EB5100 - Device 2 Config. This block is the
block that models the Invert_ECU controller, with Device index 2.
The next task is “Configure FlexRay Write Frame Signals Blocks for Signal Access” on
page 22-22.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-21
22
Model-Based FlexRay Communications Support
Configure FlexRay Write Frame Signals Blocks for Signal Access
To send a message using FlexRay in model dFlexRaySimpleExample, configure the
FlexRay Write Frame Signals blocks.
1
Double-click the block labeled EB5100 - Device 1 Write Frame
'RampFrame_ChA'.
2
Set Device index to 1.
The frame description fills in with information from the FlexRay configuration file
for the Ramp_ECU controller.
3
Set Frame label to RampFrame_ChA.
This frame is a static frame. You can execute it only with a Timing value of cyclic.
The Trigger edge list is disabled.
22-22
4
Set Signals access level to Coded.
5
Set Sample time (-1 for inherited) to -1.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Configure FlexRay Write Frame Signals Blocks for Signal Access
6
Click OK.
7
Double-click the block labeled EB5100 - Device 1 Write Frame
'RampFrame_Dyn_ChA'.
8
Set Device index to 1.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-23
22
Model-Based FlexRay Communications Support
The frame description fills in with information from the FlexRay configuration file
for the Ramp_ECU controller.
9
Set Frame label to RampFrame_Dyn_ChA.
10 Set Signals access level to Coded.
11 Set Trigger edge to Either.
This frame is a dynamic frame. Only dynamic frames can have a Timing value of
event.
12 Set Sample time (-1 for inherited) to -1.
22-24
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Configure FlexRay Write Frame Signals Blocks for Signal Access
13 Click OK.
Repeat these steps for the block labeled EB5100 - Device 2 Write Frame
'InvertFrame_ChA'. This block is associated with the Invert_ECU controller, with
Device index 2.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-25
22
Model-Based FlexRay Communications Support
The next task is “Configure FlexRay Read Frame Signals Blocks for Signal Access” on
page 22-27.
22-26
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Configure FlexRay Read Frame Signals Blocks for Signal Access
Configure FlexRay Read Frame Signals Blocks for Signal Access
To receive a message using FlexRay in model dFlexRaySimpleExample, configure the
FlexRay Read Frame Signals blocks.
1
Double-click the block labeled EB5100 - Device 1 Read Frame
'InvertFrame_ChA'.
2
Set Device index to 1.
The frame description fills in with information from the FlexRay configuration file
for the Ramp_ECU controller.
3
Set Frame label to InvertFrame_ChA.
4
Set Signals access level to Coded.
5
Clear the Enable update status output port and Enable validity output port
check boxes.
6
Set Sample time (-1 for inherited) to -1.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-27
22
Model-Based FlexRay Communications Support
7
22-28
Click OK.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Configure FlexRay Read Frame Signals Blocks for Signal Access
Repeat these steps for the blocks labeled EB5100 - Device 2 Read Frame
'RampFrame_Dyn_ChA' and EB5100 - Device 2 Read Frame 'RampFrame_ChA'.
These blocks are associated with the Invert_ECU controller, with Device index 2.
The next task is “Configure FlexRay POC Status Blocks for Signal Access” on page
22-30.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-29
22
Model-Based FlexRay Communications Support
Configure FlexRay POC Status Blocks for Signal Access
To monitor the functioning of the FlexRay network in model dFlexRaySimpleExample,
configure the FlexRay POC Status blocks.
1
Double-click the block labeled EB5100 - Device 1 Read POC state.
2
Set Device index to 1.
3
Set Sample time (-1 for inherited) to -1.
4
Click OK.
Repeat these steps for the block labeled EB5100 - Device 2 Read POC state. This
block is associated with the Invert_ECU controller, with Device index 2.
The next task is “Configure FlexRay Model Configuration Parameters for Signal Access”
on page 22-31.
22-30
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Configure FlexRay Model Configuration Parameters for Signal Access
Configure FlexRay Model Configuration Parameters for Signal
Access
FlexRay is a time-triggered protocol. To synchronize the model with the FlexRay
communication cycle, in the Configuration Parameters dialog box, specify a time trigger
generated by the FlexRay board. To configure model dFlexRaySimpleExample for
synchronous operation, perform the following steps.
1
In the Configuration Parameters dialog box, expand the Code Generation node and
then the Simulink Real-Time Options node.
2
Clear the Use default communication timeout check box.
3
Calculate 25 seconds * # of FlexRay boards. Type this value into the box
Specify the communication timeout in seconds.
This value is an estimate of the time required to download the configuration data
into the flash memory for the FlexRay boards.
4
In the Execution mode list, select Real-Time.
5
In the Real-time interrupt source list, select Auto (PCI only).
6
In the I/O board generating the interrupt list, select Busmirror EB5100.
7
Take the defaults for the other configuration parameters.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-31
22
Model-Based FlexRay Communications Support
22-32
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Configure FlexRay Model Configuration Parameters for Signal Access
8
Click OK.
The next tasks are to build, download, and execute the model.
The FlexRay libraries are licensed. For the first build of a FlexRay model, specify the
folder where the license file resides. If you hold a floating license, specify the address of
the license server.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-33
22
Model-Based FlexRay Communications Support
Configure FlexRay Node for PDU Access
To configure a FlexRay node, first install the EB tresos Busmirror configuration software
and one or more FlexRay boards in your target computer. See “Install FlexRay Hardware
and Software for Configuration” on page 22-3.
This procedure configures the FlexRay network for model dFlexRaySimpleExample.
This model consists of two FlexRay nodes, Ramp_ECU and Invert_ECU. A FlexRay node
corresponds to a FlexRay board, so install two FlexRay boards in your target computer.
Create a separate project for each FlexRay node.
The following procedure configures node Ramp_ECU.
1
“Create Busmirror Project for PDU Access” on page 22-35
2
“Select FlexRay Node for PDU Access” on page 22-38
3
“Refine FlexRay Node for PDU Access” on page 22-39
4
“Generate Project Code for PDU Access” on page 22-42
Repeat these steps for node Invert_ECU.
The next task is “Prepare FlexRay Network for PDU Access” on page 22-46.
22-34
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Create Busmirror Project for PDU Access
Create Busmirror Project for PDU Access
The following procedure uses the Ramp_ECU node of model
dFlexRaySimpleExample_PDU as an example.
The required FlexRay configuration file is:
matlab\toolbox\rtw\targets\xpc\xpcdemos\
FlexRayConfigFiles\ClusterConfig\FlexRayRampDemo_PDU.xml
1
Open EB tresos Busmirror in your working folder, for example C:\workdir.
2
To create a Busmirror project for node Ramp_ECU, in the Manage Projects tab, click
New Project.
3
In the Templates list, select GenericRBS.
4
In the Name text box, enter a name for the node, for example ramp_ecu.
5
To fill the Location text box, navigate to C:\workdir.
6
Click Next.
7
To fill the Select file to import text box, navigate to and select the required
FlexRay configuration file.
8
Select the Copy input file to 'cfg_in' directory check box.
9
Click Finish.
The software copies the input file to the 'cfg_in' folder and import FIBEX-format data
from the input file. The Busmirror window looks like this figure.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-35
22
Model-Based FlexRay Communications Support
22-36
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Create Busmirror Project for PDU Access
10 In the Manage Projects tab, click Save Project.
This procedure uses a configuration file specialized for this example. Template
configuration files in FIBEX format (.xml) and BOR format (.bor) are supplied with the
EB tresos Busmirror installation. They are stored in the Examples folder under the EB
\tresos_Busmirror folder.
To create a custom configuration file, use a separate tool such as SIMTOOLS (available
from www.speedgoat.ch).
If you have a custom configuration file in FIBEX format, open the Import Data tab and
use Import from FIBEX to import the configuration data. This process replaces the
configuration data imported while you created the project with new data from the FIBEX
file.
The next task is optional: “Select FlexRay Node for PDU Access” on page 22-38.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-37
22
Model-Based FlexRay Communications Support
Select FlexRay Node for PDU Access
The following procedure assumes that you have already created an EB tresos Busmirror
project for node Ramp_ECU.
1
Open EB tresos Busmirror in your working folder, C:\workdir.
2
To configure the Ramp_ECU node, in the ECU Configuration tab, select FlexRay
ECU Distribution.
3
In the Real Controllers list, select Ramp_ECU.
For this model, you can configure only one FlexRay node (board) per project file. In
general, you can select and emulate multiple real controllers on one EB5100 FlexRay
board, for example to perform RestBus simulation (RBS).
4
Click the Arrow button >.
5
Click Finish.
6
In the Manage Projects tab, click Save Project.
The next task is “Refine FlexRay Node for PDU Access” on page 22-39.
22-38
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Refine FlexRay Node for PDU Access
Refine FlexRay Node for PDU Access
The following procedure assumes that you have already created and saved an EB tresos
Busmirror project for node Ramp_ECU. If you can use the EB tresos Busmirror project for
node Ramp_ECU as it is, you can skip this step.
1
Open EB tresos Busmirror in your working folder, C:\workdir.
2
To configure the Ramp_ECU node, in the BUSMIRROR Refinement tab, select
Signal-PDU Editor.
3
In the PDU- 3 list, click Ramp_PDU_ChA.
4
In the Signal - 4 list, verify that signal RampSignal_ChA is also checked.
To add a signal to a PDU, select the signal, select the PDU, and then click Add to
PDU.
To remove a signal from a PDU, select the signal, select the PDU, and then click
Remove from PDU.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-39
22
Model-Based FlexRay Communications Support
5
Click Apply, and then Close.
6
In the BUSMIRROR Refinement tab, select PDU - Frame Editor.
7
In the Frame - 5 list, select the line containing frame RampFrame_ChA.
8
In the PDU - 3 list, verify that PDU Ramp_PDU_ChA is also checked.
To add a PDU to a frame, select the PDU, select the frame, and then click Add to
Frame.
To remove a PDU from a frame, select the PDU, select the frame, and then click
Remove from Frame.
22-40
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Refine FlexRay Node for PDU Access
9
Click Apply and then Close in the Frame - Signal Editor dialog box.
10 In the Manage Projects tab, click Save Project.
Repeat these steps for PDU Ramp_PDU_Dyn_ChA.
The next task is “Generate Project Code for PDU Access” on page 22-42.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-41
22
Model-Based FlexRay Communications Support
Generate Project Code for PDU Access
The following procedure assumes that you have already selected and configured the EB
tresos Busmirror project Ramp_ECU.
1
Open EB tresos Busmirror in your working folder, C:\workdir.
2
To generate code for the Ramp_ECU node, in the ECU Configuration tab, select
Code Generation.
3
In the Busmirror Generator dialog box, clear the Compile for EB2100 Platform
and Compile for EB6100 Platform check boxes.
Verify that the Generate Code check box is selected and that the Start
communication automatically check box is cleared.
4
Click Start Process.
After code generation is complete, the dialog box looks like this figure.
22-42
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Generate Project Code for PDU Access
EB tresos Busmirror generates code in the project folder and subfolders.
To modify the generated code, run Busmirror, change the Busmirror configuration,
and rebuild the project. Do not hand-modify the project files.
5
Click Close.
6
In the Manage Projects tab, click Save Project.
At the end of the build procedure, the Busmirror window looks like this figure.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-43
22
Model-Based FlexRay Communications Support
22-44
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Generate Project Code for PDU Access
Repeat these steps for node Invert_ECU.
The next task is “Prepare FlexRay Network for PDU Access” on page 22-46.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-45
22
Model-Based FlexRay Communications Support
Prepare FlexRay Network for PDU Access
To prepare the FlexRay network for execution, as required by your network, do the
following steps.
1
Connect FlexRay cables to the channel A and B connectors on the Elektrobit EB5100
cards.
By default, cables from channel A connectors on one board connect to channel A
connectors on another, and similarly for cables from channel B connectors.
2
Connect bus terminators to both ends of the A and B channels. The A and B channels
together form the FlexRay bus.
3
Connect FlexRay cables to the FlexRay device.
The next task is “Prepare FlexRay Model for PDU Access” on page 22-47.
22-46
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Prepare FlexRay Model for PDU Access
Prepare FlexRay Model for PDU Access
Before configuring model dFlexRaySimpleExample_PDU, record the bus and slot
numbers of the FlexRay boards in the target computer and configure each FlexRay node.
To configure model dFlexRaySimpleExample_PDU, perform the following tasks.
1
“Configure FlexRay Config Blocks for PDU Access” on page 22-49.
2
“Configure FlexRay Pack PDU Blocks” on page 22-51
3
“Configure FlexRay Write PDU Blocks” on page 22-55.
4
“Configure FlexRay Commit Frame Block for PDU Access” on page 22-59
5
“Configure FlexRay Read PDU Blocks” on page 22-61.
6
“Configure FlexRay Unpack PDU Blocks” on page 22-64
7
“Configure FlexRay POC Status Blocks for PDU Access” on page 22-66.
8
“Configure FlexRay Model Configuration Parameters for PDU Access” on page
22-67.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-47
22
Model-Based FlexRay Communications Support
The next tasks are to build, download, and execute the model.
The FlexRay libraries are licensed. For the first build of a FlexRay model, specify the
folder where the license file resides. If you hold a floating license, specify the address of
the license server.
22-48
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Configure FlexRay Config Blocks for PDU Access
Configure FlexRay Config Blocks for PDU Access
To configure the FlexRay Config block for PDU access in model
dFlexRaySimpleExample_PDU, execute the following steps.
1
Double-click the block labeled EB5100 - Device 1 Config. This block is the block
corresponding to the Ramp_ECU controller.
2
In text box Busmirror project file (.bmprj), navigate to the project folder for the
Ramp_ECU controller and click Project.bmprj.
3
Set the Join network on simulation start check box.
4
Clear the Enable board error codes check box.
5
Set Device index to 1.
6
Type the bus and slot numbers that you recorded while installing the first FlexRay
board in text boxes PCI bus and PCI slot.
7
Set Sample time (-1 for inherited) to -1.
8
Click Refresh config data to propagate the changes to the blocks that have Device
index set to 1.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-49
22
Model-Based FlexRay Communications Support
9
Click OK.
Repeat these steps for the block labeled EB5100 - Device 2 Config. This block is the
block that models the Invert_ECU controller, with Device index 2.
The next task is “Configure FlexRay Pack PDU Blocks” on page 22-51.
22-50
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Configure FlexRay Pack PDU Blocks
Configure FlexRay Pack PDU Blocks
To pack signals into FlexRay Protocol Data Units (PDUs) in model
dFlexRaySimpleExample_PDU, configure the FlexRay Pack PDU blocks.
1
Double-click the block labeled EB5100 - Device 1 Pack PDU 'Ramp_PDU_ChA'.
2
Set Device index to 1.
3
Set PDU label to Ramp_PDU_ChA.
The PDU description fills in with information from the FlexRay configuration file for
the Ramp_ECU controller.
4
Set Sample time (-1 for inherited) to -1.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-51
22
Model-Based FlexRay Communications Support
5
Click OK.
6
Double-click the block labeled EB5100 - Device 1 Pack PDU
'Ramp_PDU_Dyn_ChA'.
7
Set Device index to 1.
The PDU description fills in with information from the FlexRay configuration file for
the Ramp_ECU controller.
22-52
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Configure FlexRay Pack PDU Blocks
8
Set PDU label to Ramp_PDU_Dyn_ChA.
9
Set Sample time (-1 for inherited) to -1.
10 Click OK.
Repeat these steps for the block labeled EB5100 - Device 2 Pack PDU
'Invert_PDU_ChA'. This block is associated with the Invert_ECU controller, with
Device index 2.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-53
22
Model-Based FlexRay Communications Support
The next task is “Configure FlexRay Write PDU Blocks” on page 22-55.
22-54
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Configure FlexRay Write PDU Blocks
Configure FlexRay Write PDU Blocks
To send a message using FlexRay in model dFlexRaySimpleExample_PDU, configure
the FlexRay Write PDU blocks.
1
Double-click the block labeled EB5100 - Device 1 Write PDU
'Ramp_PDU_ChA'.
2
Set Device index to 1.
The PDU description fills in with information from the FlexRay configuration file for
the Ramp_ECU controller.
3
Set PDU label to Ramp_PDU_ChA.
4
Set Sample time (-1 for inherited) to -1.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-55
22
Model-Based FlexRay Communications Support
22-56
5
Click OK.
6
Double-click the block labeled EB5100 - Device 1 Write PDU
'Ramp_PDU_Dyn_chA'.
7
Set Device index to 1.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Configure FlexRay Write PDU Blocks
The PDU description fills in with information from the FlexRay configuration file for
the Ramp_ECU controller.
8
Set PDU label to Ramp_PDU_Dyn_ChA.
9
Set Sample time (-1 for inherited) to -1.
10 Click OK.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-57
22
Model-Based FlexRay Communications Support
Repeat these steps for the block labeled EB5100 - Device 2 Write PDU
'Invert_PDU_ChA'. This block is associated with the Invert_ECU controller, with
Device index 2.
The next task is “Configure FlexRay Commit Frame Block for PDU Access” on page
22-59.
22-58
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Configure FlexRay Commit Frame Block for PDU Access
Configure FlexRay Commit Frame Block for PDU Access
To commit a frame containing Protocol Data Units (PDUs) in model
dFlexRaySimpleExample_PDU, configure the FlexRay Commit Frame block.
1
Double-click the block labeled EB5100 - Device 1 Commit Frame
'RampFrame_Dyn_ChA'.
2
Set Device index to 1.
The frame description fills in with information from the FlexRay configuration file
for the Ramp_ECU controller.
3
Set Frame label to RampFrame_Dyn_ChA.
4
Set Trigger edge to Either.
This frame is a dynamic frame. Only dynamic frames can have a Timing value of
event.
5
Set Sample time (-1 for inherited) to -1.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-59
22
Model-Based FlexRay Communications Support
6
Click OK.
The next task is “Configure FlexRay Read PDU Blocks” on page 22-61.
22-60
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Configure FlexRay Read PDU Blocks
Configure FlexRay Read PDU Blocks
To receive a message using FlexRay in model dFlexRaySimpleExample_PDU, configure
the FlexRay Read PDU blocks.
1
Double-click the block labeled EB5100 - Device 1 Read PDU
'Invert_PDU_ChA'.
2
Set Device index to 1.
The PDU description fills in with information from the FlexRay configuration file for
the Ramp_ECU controller.
3
Set PDU label to Invert_PDU_ChA.
4
Clear the Enable update status output port and the Enable update bit output
port check boxes.
5
Set Sample time (-1 for inherited) to -1.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-61
22
Model-Based FlexRay Communications Support
6
22-62
Click OK.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Configure FlexRay Read PDU Blocks
Repeat these steps for the blocks labeled EB5100 - Device 2 Read PDU
'Ramp_PDU_ChA' and EB5100 - Device 2 Read PDU 'Ramp_PDU_Dyn_ChA'. These
blocks are associated with the Invert_ECU controller, with Device index 2.
The next task is “Configure FlexRay Unpack PDU Blocks” on page 22-64.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-63
22
Model-Based FlexRay Communications Support
Configure FlexRay Unpack PDU Blocks
To unpack signals from FlexRay Protocol Data Units (PDUs) in model
dFlexRaySimpleExample_PDU, configure the FlexRay Unpack PDU blocks.
1
Double-click the block labeled EB5100 - Device 1 Unpack PDU
'Invert_PDU_ChA'.
2
Set Device index to 1.
The PDU description fills in with information from the FlexRay configuration file for
the Ramp_ECU controller.
22-64
3
Set PDU label to Invert_PDU_ChA.
4
Set Sample time (-1 for inherited) to -1.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Configure FlexRay Unpack PDU Blocks
5
Click OK.
Repeat these steps for the blocks labeled EB5100 - Device 2 Unpack PDU
'Ramp_PDU_ChA' and EB5100 - Device 2 Unpack PDU 'Ramp_PDU_Dyn_ChA'.
These blocks are associated with the Invert_ECU controller, with Device index 2.
The next task is “Configure FlexRay POC Status Blocks for PDU Access” on page
22-66.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-65
22
Model-Based FlexRay Communications Support
Configure FlexRay POC Status Blocks for PDU Access
To monitor the functioning of the FlexRay network in model
dFlexRaySimpleExample_PDU, configure the FlexRay POC Status blocks.
1
Double-click the block labeled EB5100 - Device 1 Read POC state.
2
Set Device index to 1.
3
Set Sample time (-1 for inherited) to -1.
4
Click OK.
Repeat these steps for the block labeled EB5100 - Device 2 Read POC state. This
block is associated with the Invert_ECU controller, with Device index 2.
The next task is “Configure FlexRay Model Configuration Parameters for PDU Access”
on page 22-67.
22-66
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Configure FlexRay Model Configuration Parameters for PDU Access
Configure FlexRay Model Configuration Parameters for PDU
Access
FlexRay is a time-triggered protocol. To synchronize the model with the FlexRay
communication cycle, in the Configuration Parameters dialog box, specify a time trigger
generated by the FlexRay board. To configure model dFlexRaySimpleExample_PDU for
synchronous operation, perform the following steps.
1
In the Configuration Parameters dialog box, expand the Code Generation node and
then the Simulink Real-Time Options node.
2
Clear the Use default communication timeout check box.
3
Calculate 25 seconds * # of FlexRay boards. Type this value into the box
Specify the communication timeout in seconds.
This value is an estimate of the time required to download the configuration data
into the flash memory for the FlexRay boards.
4
In the Execution mode list, select Real-Time.
5
In the Real-time interrupt source list, select Auto (PCI only).
6
In the I/O board generating the interrupt list, select Busmirror EB5100.
7
Take the defaults for the other configuration parameters.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-67
22
Model-Based FlexRay Communications Support
22-68
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Configure FlexRay Model Configuration Parameters for PDU Access
8
Click OK.
The next tasks are to build, download, and execute the model.
The FlexRay libraries are licensed. For the first build of a FlexRay model, specify the
folder where the license file resides. If you hold a floating license, specify the address of
the license server.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-69
22
Model-Based FlexRay Communications Support
Configure FlexRay Node for Error Injection
To configure a FlexRay node, first install the EB tresos Busmirror configuration software
and one or more FlexRay boards in your target computer. See “Install FlexRay Hardware
and Software for Configuration” on page 22-3.
This procedure configures the FlexRay network for model
dFlexRaySimpleExample_ErrorInjection. This model consists of two FlexRay
nodes, Ramp_ECU and Invert_ECU. A FlexRay node corresponds to a FlexRay board, so
install two FlexRay boards in your target computer. Create a separate project for each
FlexRay node.
The following procedure configures node Ramp_ECU.
1
“Create Busmirror Project for Error Injection” on page 22-71
2
“Select FlexRay Node for Error Injection” on page 22-74
3
“Refine FlexRay Node for Error Injection” on page 22-75
4
“Generate Project Code for Error Injection” on page 22-77
Repeat these steps for node Invert_ECU.
The next task is “Prepare FlexRay Network for Error Injection” on page 22-81.
22-70
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Create Busmirror Project for Error Injection
Create Busmirror Project for Error Injection
The following procedure uses the Ramp_ECU node of model
dFlexRaySimpleExample_ErrorInjection as an example. The required FlexRay
configuration file is:
matlab\toolbox\rtw\targets\xpc\xpcdemos\
FlexRayConfigFiles\ClusterConfig\FlexRayRampDemo_Signals.xml
1
Open EB tresos Busmirror in your working folder, for example C:\workdir.
2
To create a Busmirror project for node Ramp_ECU, in the Manage Projects tab, click
New Project.
3
In the Templates list, select GenericRBS.
4
In the Name text box, enter a name for the node, for example ramp_ecu.
5
To fill the Location text box, navigate to C:\workdir.
6
Click Next.
7
To fill the Select file to import text box, navigate to and select the required
FlexRay configuration file.
8
Select the Copy input file to 'cfg_in' directory check box.
9
Click Finish.
The software copies the input file to the 'cfg_in' folder and import FIBEX-format data
from the input file. The Busmirror window looks like this figure.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-71
22
Model-Based FlexRay Communications Support
22-72
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Create Busmirror Project for Error Injection
10 In the Manage Projects tab, click Save Project.
This procedure uses a configuration file specialized for this example. Template
configuration files in FIBEX format (.xml) and BOR format (.bor) are supplied with the
EB tresos Busmirror installation. They are stored in the Examples folder under the EB
\tresos_Busmirror folder.
To create a custom configuration file, use a separate tool such as SIMTOOLS (available
from www.speedgoat.ch).
If you have a custom configuration file in FIBEX format, open the Import Data tab and
use Import from FIBEX to import the configuration data. This process replaces the
configuration data imported while you created the project with new data from the FIBEX
file.
The next task is “Select FlexRay Node for Error Injection” on page 22-74.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-73
22
Model-Based FlexRay Communications Support
Select FlexRay Node for Error Injection
The following procedure assumes that you have already created an EB tresos Busmirror
project for node Ramp_ECU.
1
Open EB tresos Busmirror in your working folder, C:\workdir.
2
To configure the Ramp_ECU node, in the ECU Configuration tab, select FlexRay
ECU Distribution.
3
In the Real Controllers list, select Ramp_ECU.
For this model, you can configure only one FlexRay node (board) per project file. In
general, you can select and emulate multiple real controllers on one EB5100 FlexRay
board, for example to perform RestBus simulation (RBS).
4
Click the Arrow button >.
5
Click Finish.
6
In the Manage Projects tab, click Save Project.
The next task is optional: “Refine FlexRay Node for Error Injection” on page 22-75.
22-74
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Refine FlexRay Node for Error Injection
Refine FlexRay Node for Error Injection
The following procedure assumes that you have already created and saved an EB tresos
Busmirror project for node Ramp_ECU. If you can use the EB tresos Busmirror project for
node Ramp_ECU as it is, you can skip this step.
1
Open EB tresos Busmirror in your working folder, C:\workdir.
2
To configure the Ramp_ECU node, in the BUSMIRROR Refinement tab, select
Signals.
3
In the Signal list, click RampSignal_Dyn_ChA.
4
In the box for property InvalidValue, check that the value is -1000.
To change this value, type the required value into the box.
5
Click Apply and then Close.
6
In the Manage Projects tab, click Save Project.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-75
22
Model-Based FlexRay Communications Support
The next task is “Generate Project Code for Error Injection” on page 22-77.
22-76
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Generate Project Code for Error Injection
Generate Project Code for Error Injection
The following procedure assumes that you have already selected and configured the EB
tresos Busmirror project Ramp_ECU.
1
Open EB tresos Busmirror in your working folder, C:\workdir.
2
To generate code for the Ramp_ECU node, in the ECU Configuration tab, select
Code Generation.
3
In the Busmirror Generator dialog box, clear the Compile for EB2100 Platform
and Compile for EB6100 Platform check boxes.
Verify that the Generate Code check box is selected and that the Start
communication automatically check box is cleared.
4
Click Start Process.
After code generation is complete, the dialog box looks like this figure.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-77
22
Model-Based FlexRay Communications Support
EB tresos Busmirror generates code in the project folder and subfolders.
To modify the generated code, run Busmirror, change the Busmirror configuration,
and rebuild the project. Do not hand-modify the project files.
5
Click Close.
6
In the Manage Projects tab, click Save Project.
At the end of the build procedure, the Busmirror window looks like this figure.
22-78
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Generate Project Code for Error Injection
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-79
22
Model-Based FlexRay Communications Support
Repeat these steps for node Invert_ECU.
The next task is “Prepare FlexRay Network for Error Injection” on page 22-81.
22-80
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Prepare FlexRay Network for Error Injection
Prepare FlexRay Network for Error Injection
To prepare the FlexRay network for execution, as required by your network, do the
following steps.
1
Connect FlexRay cables to the channel A and B connectors on the Elektrobit EB5100
cards.
By default, cables from channel A connectors on one board connect to channel A
connectors on another, and similarly for cables from channel B connectors.
2
Connect bus terminators to both ends of the A and B channels. The A and B channels
together form the FlexRay bus.
3
Connect FlexRay cables to the FlexRay device.
The next task is “Prepare FlexRay Model for Error Injection” on page 22-82.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-81
22
Model-Based FlexRay Communications Support
Prepare FlexRay Model for Error Injection
Before configuring model dFlexRaySimpleExample_ErrorInjection, record the
bus and slot numbers of the FlexRay boards in the target computer and configure each
FlexRay node.
22-82
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Prepare FlexRay Model for Error Injection
To configure model dFlexRaySimpleExample_ErrorInjection, perform the following
tasks.
1
“Configure FlexRay Config Blocks for Error Injection” on page 22-84.
2
“Configure FlexRay Write Frame Signals Blocks for Error Injection” on page
22-86.
3
“Configure FlexRay Read Frame Signals Blocks for Error Injection” on page
22-91.
4
“Configure FlexRay Error Injection Blocks” on page 22-94.
5
“Configure FlexRay POC Status Blocks for Error Injection” on page 22-99.
6
“Configure FlexRay Model Configuration Parameters for Error Injection” on page
22-100.
The next tasks are to build, download, and execute the model.
The FlexRay libraries are licensed. For the first build of a FlexRay model, specify the
folder where the license file resides. If you hold a floating license, specify the address of
the license server.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-83
22
Model-Based FlexRay Communications Support
Configure FlexRay Config Blocks for Error Injection
To configure the FlexRay Config block for error injection in model
dFlexRaySimpleExample_ErrorInjection, execute the following steps.
22-84
1
Double-click the block labeled EB5100 - Device 1 Config. This block is the block
corresponding to the Ramp_ECU controller.
2
In text box Busmirror project file (.bmprj), navigate to the project folder for the
Ramp_ECU controller and click Project.bmprj.
3
Set the Join network on simulation start check box.
4
Clear the Enable board error codes check box.
5
Set Device index to 1.
6
Type the bus and slot numbers that you recorded while installing the first FlexRay
board in text boxes PCI bus and PCI slot.
7
Set Sample time (-1 for inherited) to -1.
8
Click Refresh config data to propagate the changes to the blocks that have Device
index set to 1.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Configure FlexRay Config Blocks for Error Injection
9
Click OK.
Repeat these steps for the block labeled EB5100 - Device 2 Config. This block is the
block that models the Invert_ECU controller, with Device index 2.
The next task is “Configure FlexRay Write Frame Signals Blocks for Error Injection” on
page 22-86.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-85
22
Model-Based FlexRay Communications Support
Configure FlexRay Write Frame Signals Blocks for Error Injection
To send a message using FlexRay in model
dFlexRaySimpleExample_ErrorInjection, configure the FlexRay Write Frame
Signals blocks.
1
Double-click the block labeled EB5100 - Device 1 Write Frame
'RampFrame_ChA'.
2
Set Device index to 1.
The frame description fills in with information from the FlexRay configuration file
for the Ramp_ECU controller.
3
Set Frame label to RampFrame_ChA.
This frame is a static frame. You can execute it only with a Timing value of cyclic.
The Trigger edge list is disabled.
22-86
4
Set Signals access level to Coded.
5
Set Sample time (-1 for inherited) to -1.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Configure FlexRay Write Frame Signals Blocks for Error Injection
6
Click OK.
7
Double-click the block labeled EB5100 - Device 1 Write Frame
'RampFrame_Dyn_ChA'.
8
Set Device index to 1.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-87
22
Model-Based FlexRay Communications Support
The frame description fills in with information from the FlexRay configuration file
for the Ramp_ECU controller.
9
Set Frame label to RampFrame_Dyn_ChA.
10 Set Signals access level to Coded.
11 Set Trigger edge to Either.
This frame is a dynamic frame. Only dynamic frames can have a Timing value of
event.
12 Set Sample time (-1 for inherited) to -1.
22-88
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Configure FlexRay Write Frame Signals Blocks for Error Injection
13 Click OK.
Repeat these steps for the block labeled EB5100 - Device 2 Write Frame
'InvertFrame_ChA'. This block is associated with the Invert_ECU controller, with
Device index 2.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-89
22
Model-Based FlexRay Communications Support
The next task is “Configure FlexRay Read Frame Signals Blocks for Error Injection” on
page 22-91.
22-90
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Configure FlexRay Read Frame Signals Blocks for Error Injection
Configure FlexRay Read Frame Signals Blocks for Error Injection
To receive a message using FlexRay in model
dFlexRaySimpleExample_ErrorInjection, configure the FlexRay Read Frame
Signals blocks.
1
Double-click the block labeled EB5100 - Device 1 Read Frame
'InvertFrame_ChA'.
2
Set Device index to 1.
The frame description fills in with information from the FlexRay configuration file
for the Ramp_ECU controller.
3
Set Frame label to InvertFrame_ChA.
4
Set Signals access level to Coded.
5
Clear the Enable update status output port and Enable validity output port
check boxes.
6
Set Sample time (-1 for inherited) to -1.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-91
22
Model-Based FlexRay Communications Support
7
22-92
Click OK.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Configure FlexRay Read Frame Signals Blocks for Error Injection
Repeat these steps for the blocks labeled EB5100 - Device 2 Read Frame
'RampFrame_Dyn_ChA' and EB5100 - Device 2 Read Frame 'RampFrame_ChA'.
These blocks are associated with the Invert_ECU controller, with Device index 2.
The next task is “Configure FlexRay Error Injection Blocks” on page 22-94.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-93
22
Model-Based FlexRay Communications Support
Configure FlexRay Error Injection Blocks
To inject errors into the FlexRay network in model
dFlexRaySimpleExample_ErrorInjection, configure the FlexRay Error Injection
blocks.
1
Double-click the block labeled EB5100 - Device 1 Invalidate signals of
'RampFrame_Dyn_ChA'.
2
Set Device index to 1.
The frame description fills in with information from the FlexRay configuration file
for the Ramp_ECU controller.
22-94
3
Set Frame label to RampFrame_Dyn_ChA.
4
Set Action to perform to Invalidate signals.
5
Set Sample time (-1 for inherited) to -1.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Configure FlexRay Error Injection Blocks
6
Click OK.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-95
22
Model-Based FlexRay Communications Support
7
Double-click the block labeled EB5100 - Device 1 Disable Frame
'RampFrame_ChA'.
8
Set Device index to 1.
The frame description fills in with information from the FlexRay configuration file
for the Ramp_ECU controller.
9
Set Frame label to RampFrame_ChA.
10 Set Action to perform to Disable frame.
11 Set Disabled frame behavior to Null frame.
12 Set Sample time (-1 for inherited) to -1.
22-96
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Configure FlexRay Error Injection Blocks
13 Click OK.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-97
22
Model-Based FlexRay Communications Support
The next task is “Configure FlexRay POC Status Blocks for Error Injection” on page
22-99.
22-98
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Configure FlexRay POC Status Blocks for Error Injection
Configure FlexRay POC Status Blocks for Error Injection
To monitor the functioning of the FlexRay network in model
dFlexRaySimpleExample_ErrorInjection, configure the FlexRay POC Status
blocks.
1
Double-click the block labeled EB5100 - Device 1 Read POC state.
2
Set Device index to 1.
3
Set Sample time (-1 for inherited) to -1.
4
Click OK.
Repeat these steps for the block labeled EB5100 - Device 2 Read POC state. This
block is associated with the Invert_ECU controller, with Device index 2.
The next task is “Configure FlexRay Model Configuration Parameters for Error Injection”
on page 22-100.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-99
22
Model-Based FlexRay Communications Support
Configure FlexRay Model Configuration Parameters for Error
Injection
FlexRay is a time-triggered protocol. To synchronize the model with the
FlexRay communication cycle, in the Configuration Parameters dialog box,
specify a time trigger generated by the FlexRay board. To configure model
dFlexRaySimpleExample_ErrorInjection for synchronous operation, perform the
following steps.
1
In the Configuration Parameters dialog box, expand the Code Generation node and
then the Simulink Real-Time Options node.
2
Clear the Use default communication timeout check box.
3
Calculate 25 seconds * # of FlexRay boards. Type this value into the box
Specify the communication timeout in seconds.
This value is an estimate of the time required to download the configuration data
into the flash memory for the FlexRay boards.
22-100
4
In the Execution mode list, select Real-Time.
5
In the Real-time interrupt source list, select Auto (PCI only).
6
In the I/O board generating the interrupt list, select Busmirror EB5100.
7
Take the defaults for the other configuration parameters.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Configure FlexRay Model Configuration Parameters for Error Injection
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-101
22
Model-Based FlexRay Communications Support
8
Click OK.
The next tasks are to build, download, and execute the model.
The FlexRay libraries are licensed. For the first build of a FlexRay model, specify the
folder where the license file resides. If you hold a floating license, specify the address of
the license server.
22-102
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Evaluate Clear from Bus Preconditions
Evaluate Clear from Bus Preconditions
You can inject FlexRay disabled-frame errors in two ways: Clear from bus and NULL
frame. You can use Clear from bus only if the following preconditions are true:
• You assign the frame triggering to a nonsync slot.
• You assign the frame triggering to a nonzero buffer of the communication controller.
If either precondition is false, use NULL frame.
Frame Triggering Assigned to Nonsynchronization Slot
To verify that FlexRay frame triggering is assigned to a nonsynchronization slot:
1
2
3
Open the EB tresos Busmirror project.
Expand the Busmirror Refinement tab.
Select FlexRay Controller Parameters.
4
In the left pane of the Entity view, select the FlexRay controller that sends
the frame. If you already built the Busmirror project, the two controllers:
BM_ECU_TSL_CC0 and BM_ECU_TSL_CC1 represent the currently emulated nodes.
5
In the communication controller parameters list in the left pane of the Entity view,
find the parameters pKeySlotUsedForSync and pKeySlotId. If the value of
pKeySlotUsedForSync is 1, then slot pKeySlotId is a synchronization slot. You
cannot disable frame triggering assigned to that slot with Clear from bus.
6
Close the Entity view.
7
8
In the Busmirror Refinement tab, select Frame Scheduler.
Select Frame Triggering in the static segment section for the frame that
you want to disable. If Slot is the same as the pKeySlotId for which
pKeySlotUsedForSync is 1, then the frame triggering is assigned to a
synchronization slot. Modify the frame triggering slot to a nonsynchronization slot
and rebuild the project.
Do these steps for every node in your FlexRay model.
Frame Triggering Assigned to Nonzero Buffer
By default, EB tresos Busmirror assigns one frame to buffer 0, generally the frame with
index 0. You cannot use Busmirror to view or change the communication controller buffer
to which the frame triggering is assigned.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-103
22
Model-Based FlexRay Communications Support
To change the frame triggering assignment to a nonzero buffer, use SIMTOOLS to
manage the communication controller buffers pool. For more information, see the EB
Designer Pro documentation that is part of SIMTOOLS, available from Speedgoat
(www.speedgoat.ch).
22-104
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
FlexRay Troubleshooting
FlexRay Troubleshooting
FlexRay models have specific troubleshooting requirements during model configuration,
build, download, and execution
Model Configuration
• If the EB tresos Busmirror build fails, consult the Busmirror documentation to
address the underlying issue. Then, restart the build.
• If a Simulink Real-Time block displays the error message Block xxx holds
an invalid configuration, verify that you specified the required path in the
Busmirror project file (.bmprj) text box in the FlexRay Config block dialog box. If
the file exists at the specified location, in the FlexRay Config block dialog box, click
Refresh Config Data. This action propagates the configuration data to the other
blocks with this device index.
Build and Download
• If you see a license checkout error during model build, verify that you properly
installed the dongle driver. Also, verify that the license file matches the dongle ID.
• If you see a message similar to this message during model build:
'Configuration Parameters > Model Referencing >
Total number of instances allowed per top model'
is set to 'Multiple' for model XXX. . . .
open the Configuration Parameters dialog box for the FlexRay reference model and
expand the Model Referencing node. In the Total number of instances allowed
per top model box, select the value One.
If your top-level Simulink model contains more than one reference to the same
FlexRay model, restructure the model so that only one reference remains.
• During download, the kernel loads firmware into the FlexRay bus controller, a
lengthy process. If you see the error message Invalid port number, or if the two
computers unexpectedly disconnect, the communication between the computers could
be timing out. Check the setting of the Specify the communication timeout in
seconds text box in the Simulink Real-Time Options pane in the Configuration
Parameters dialog box.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-105
22
Model-Based FlexRay Communications Support
Try multiplying 25 seconds by the number of FlexRay boards in the model and using
that value as the timeout value.
Execution
• If a synchronous FlexRay model runs at a radically different rate from the FlexRay
board cycle rate, move the board to another PCI slot. If this action does not resolve the
issue, type slrtexplr, open Target settings, and clear the Multicore CPU check
box.
• During error injection, if you cannot disable a frame using the Clear from bus
option, verify that you have met the preconditions described in “Evaluate Clear from
Bus Preconditions”.
• When a FlexRay Write PDU block is triggered and an update bit is defined for the
PDU, the PDU is sent with the update bit set. If the PDU frame is scheduled before
the next block trigger, the PDU is sent with the update bit cleared until the next block
trigger.
• You can use both a FlexRay Write Frame Signals block and a FlexRay Write PDU
block to write the same signal data into the same frame. However, only the content of
the PDU is transmitted.
• During error injection, you can use the Invalidate signals option to inject an
error into a signal that is written using a FlexRay Write PDU block. However, the
invalid value is not transmitted. To transmit an invalid value, explicitly pack the
invalid value into the PDU using the FlexRay Pack PDU block.
• You can use the FlexRay Read PDU block and the FlexRay Read Frame Signals
block in the same model to read the signals of the frame that contains the PDU.
However, the value of the Enable update status output port for the two blocks can
be inconsistent from model build to model build. The software indicates the update
status by setting the update status port output value for the block that executes
first in built execution order. The port output value for the block that executes last
remains false. The built execution order can change from model build to build.
If you need a consistent result, send the output of both blocks into an OR Logical
Operator block.
22-106
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Blocks — Alphabetical List
Blocks — Alphabetical List
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-107
22
Model-Based FlexRay Communications Support
FlexRay Config
Configure model using data imported from Busmirror configuration file
Library
Simulink Real-Time Library for FlexRay
Description
FlexRay Config imports data from the EB tresos Busmirror configuration file. It
initializes the model with the information.
Block Outputs
Name
Description
E
A vector containing three values:
[IsErr ErrNum ErrOut]
The error vector persists until the board explicitly changes it, even if the board returned
the vector in the previous sample time.
IsErr value 0 denotes normal operation. A nonzero IsErr value denotes an error. The
remaining values have meaning only when IsErr is nonzero.
The ErrNum and ErrOut values and the resulting error output are shown in this table.
22-108
ErrNum
ErrOut
Error Output
0
0
Unknown error
1
0
Error Queue overrun
2
# (task)
Task # exceeded its time slot
3
# (task)
Task # violated its deadline
4
# (TUM)
Wrong parameters in registering TUM #
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
FlexRay Config
ErrNum
ErrOut
Error Output
5
# (TUM)
TUM id # duplicated
6
# (error)
Fatal error occurred on board: #
7
# (task)
FlexRay task at # violated its deadline
8
# (cycles)
Detected a communication cycle shift of #
cycles
10
# (index)
Invalid id #
12
# (error)
Target returned error #
14
# (frame)
Cannot send timed FlexRay frame (id #): table
full
15
# (packets)
Lost # packets from target device due to
overload
• ErrNum values 4 and 5 occur only if the customer added a custom TUM to the
firmware.
• ErrNum value 7 occurs when a FlexRay task (Rx or Tx) misses its deadline. The
deadline for a Tx task is its slot. The deadline for an Rx task is its slot in the next
cycle minus a configurable delay.
• ErrNum value 8 occurs when the FlexRay dispatcher is not called in time.
• ErrNum value 10 occurs when the Target Access Library (TAL) on the target
computer tries to process an index representing a nonexistent signal, PDU, or frame.
• ErrNum value 12 occurs when the board returns a value of type TAL_ReturnType
other than TAL_Success.
• ErrNum value 14 occurs when the table used to store FlexRay frames is full.
• ErrNum value 15 occurs when the Tx TAL queue to the target computer overflows
Block Parameters
Busmirror project file (.bmprj)
Type or browse to the location of the Busmirror project file for this network. You can
specify either a full path or a relative path to the Busmirror project file.
Enter a value in this parameter. To update the blocks in the model with the updated
data, click Refresh config data.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-109
22
Model-Based FlexRay Communications Support
Join network on simulation start
If selected, the board joins the FlexRay network when the model starts executing.
If not selected, use a FlexRay Join/Leave Network block to join the network.
Enable board error codes output port
If selected, the block reveals the Error output.
Device index
Unique value representing this network node.
PCI bus
Bus number of the FlexRay board in the target computer.
PCI slot
Slot number of the FlexRay board in the target computer.
If only one board of this type is in the target computer, enter -1 to locate the board.
Sample time (-1 for inherited)
Enter the base sample time or a multiple of the base sample time.
22-110
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
FlexRay Commit Frame
FlexRay Commit Frame
Trigger event-triggered frame transmission on board
Library
Simulink Real-Time Library for FlexRay
Description
When you trigger the block, the selected event-triggered frame is transmitted on the bus
in the next available communication cycle.
Block Inputs
Name
Description
T
Trigger for committing the frame.
Block Parameters
Device index
Unique value representing this network node.
Frame label
Selects a particular frame defined in the EB tresos Busmirror configuration file.
Trigger edge
Event trigger edge. Possible values are Rising, Falling, and Either.
Sample time (-1 for inherited)
Enter the base sample time or a multiple of the base sample time.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-111
22
Model-Based FlexRay Communications Support
FlexRay Join/Leave Network
Define board behavior when join/leave trigger event occurs
Library
Simulink Real-Time Library for FlexRay
Description
This block causes the board to join or leave the network on a trigger event.
When the block is triggered, there are three cases:
• If the board is connected to a physical network that has already started, the board can
join or leave the network.
• If the board is connected to a physical network that has not started, there are two
cases:
• If the board is a cold-start node in the network, the board can start and join the
network.
• Otherwise, the board can wait for the network to start.
• If the board is emulating a network, the board can start or stop the network.
Block Inputs
Name
Description
Trigger
Provides trigger event for joining and
leaving the network.
Block Parameters
Device index
22-112
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
FlexRay Join/Leave Network
Unique value representing this network node.
Perform action
Action to take on receiving the trigger event. Possible values are Join network and
Leave network.
Trigger edge
Event trigger edge. Possible values are Rising, Falling, and Either.
Sample time (-1 for inherited)
Enter the base sample time or a multiple of the base sample time.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-113
22
Model-Based FlexRay Communications Support
FlexRay POC Status
Output Protocol Operation Control (POC) state of board
Library
Simulink Real-Time Library for FlexRay
Description
Propagates the FlexRay Protocol Operation Control (POC) state from the board to the
output.
The board sends an update of the current POC state to the real-time application every
100 ms.
Block Outputs
Name
Description
POC ST
Number (uint8) that maps to one of the
POC states.
The mapping from values to POC states is shown in the following table.
22-114
Value
POC State
0
Config — Board is configuring the
FlexRay controller with the configuration
data provided.
1
Default Config — Board just turned on.
2
Halt — Board has stopped due to a
significant error or a request to leave the
network. Recovery from this state requires
reinitializing the board,
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
FlexRay POC Status
Value
POC State
3
Normal Active — Board is synchronized
with the network and sending and
receiving data.
4
Normal Passive — Board is handling an
error. The board is not synchronized with
the network. It can receive data from the
bus, but it cannot transmit data to the bus.
5
Ready — Board has finished its
initialization sequence and is ready
to start a network or join an actively
communicating network.
6
Startup — Board is starting the network.
Only entered if the board is a cold-start
node for the network.
7
Wakeup — Board is initializing and
connecting to the network.
Block Parameters
Device index
Unique value representing this network node.
Sample time (-1 for inherited)
Enter the base sample time or a multiple of the base sample time.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-115
22
Model-Based FlexRay Communications Support
FlexRay Error Injection
Inject errors into network
Library
Simulink Real-Time Library for FlexRay
Description
This block injects errors into the network by disabling the sending of a frame or sending
invalid signal values to signals in the frame.
To disable sending a frame in the static segment, either send nothing or send a null
frame in place of the configured frame.
To send invalid signal values, in the FlexRay configuration file, define an invalid value
for each signal in the frame.
Block Inputs
Name
Description
Trigger
Event that starts error injection. When the
input signal value is 1, the specified error
type is injected into the network. When
the input signal value is 0, the error is not
injected.
Block Parameters
Device index
Unique value representing this network node.
Frame label
22-116
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
FlexRay Error Injection
Selects a particular frame defined in the EB tresos Busmirror configuration file. Each
frame defines frame attributes and signal attributes, displayed in the section Frame
description from configuration (read only). These attributes cannot be changed
except by selecting a different frame.
The frame attributes are:
• Index — Unique number that identifies the frame.
• Timing — Frame timing specification, one of cyclic (for time-triggered frames)
and event (for event-triggered frames).
• Slot ID — Identifier of time slot in communication cycle to which frame is
assigned.
• Base cycle — Cycle counter value at which frame transmission starts, in range 0–
63.
• Cycle repetition — Frame period, in number of cycle units.
The signal attributes are:
• Index — Unique number that identifies the signal.
• Name — Signal name, as specified in Busmirror configuration software.
• Coded data type — Transport-level data type of the signal, as specified in
Busmirror configuration software. Only integer types are supported in Simulink
Real-Time.
• Bit length — Length of the signal, in bits.
• Offset (bits) — Offset of the signal in the frame, in bits.
Action to perform
Error to inject when the trigger occurs. Possible values are Disable frame (the
default) and Invalidate signals.
The Disable frame option is not available if the selected frame is an eventtriggered frame.
The Invalidate signals option cannot be used if the signal is being transmitted
via a PDU.
Disabled frame behavior
Select Clear from bus to transmit no frame on the bus and NULL frame to
transmit a frame with an empty payload (a null frame) on the bus.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-117
22
Model-Based FlexRay Communications Support
When Action to perform is set to Invalidate signals, this parameter is
disabled.
You can use Clear from bus only if the following preconditions are both true:
• You assign the frame triggering to a nonsync slot.
• You assign the frame triggering to a nonzero buffer of the communication
controller.
Sample time (-1 for inherited)
Enter the base sample time or a multiple of the base sample time.
See Also
“Evaluate Clear from Bus Preconditions” | “FlexRay Troubleshooting”
22-118
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
FlexRay Pack PDU
FlexRay Pack PDU
Pack Protocol Data Unit (PDU) data with signal values
Library
Simulink Real-Time Library for FlexRay
Description
Packs protocol data unit (PDU) with signal values passed in through the input ports.
When a PDU is selected, the number of input ports is set to the number of signals in the
PDU. Each input port is labeled with the corresponding signal index, and its data type is
set to the transport data type of the signal.
Block Inputs
Name
Description
#
Input labeled with number # is input port
for signal with index #.
Block Outputs
Name
Description
#
uint8 vector of length equal to the
configured PDU length in EB tresos
Busmirror. The label # is the PDU index
generated by Busmirror.
Block Parameters
Device index
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-119
22
Model-Based FlexRay Communications Support
Unique value representing this network node.
PDU label
Selects a particular PDU defined in the EB tresos Busmirror configuration file. Each
PDU defines PDU attributes and signal attributes, displayed in the section PDU
description from configuration (read only). These attributes cannot be changed
except by selecting a different PDU.
The PDU attributes are:
• Frame label — Label of the frame that contains the PDU.
The configuration file can allocate a PDU to more than one frame. This field
contains the label of the first frame encountered by the software in processing the
configuration file.
• PDU index — Unique number that identifies the PDU.
• PDU length (bytes) — Number of bytes in the PDU.
Some bytes in the PDU might not be used. Unused bytes have the value 0.
• PDU offset (bytes) — Offset of the PDU in the frame, in bytes.
• PDU update bit — Offset of the update bit in the frame, in bits.
The PDU update bit is not part of the PDU allocation. It can appear anywhere in
the frame.
The signal attributes are:
• Index — Unique number that identifies the signal.
• Name — Signal name, as specified in Busmirror configuration software.
• Coded data type — Transport-level data type of the signal, as specified in
Busmirror configuration software. Only integer types are supported in Simulink
Real-Time.
• Bit length — Length of the signal, in bits.
• Offset (bits) — Offset of the signal in the PDU, in bits.
Sample time (-1 for inherited)
Enter the base sample time or a multiple of the base sample time.
22-120
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
FlexRay Read Cycle Counter
FlexRay Read Cycle Counter
Output value of board communication cycle counter
Library
Simulink Real-Time Library for FlexRay
Description
Reads the communication cycle counter on the board and sends it to output CC.
Block Outputs
Name
Description
CC
Value of cycle counter.
Block Parameters
Device index
Unique value representing this network node.
Sample time (-1 for inherited)
Enter the base sample time or a multiple of the base sample time.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-121
22
Model-Based FlexRay Communications Support
FlexRay Read Frame Signals
Receive frame signal values from board
Library
Simulink Real-Time Library for FlexRay
Description
Reads signal values from the board.
If you enable the update status output port, when all signals are updated, the update
status port output value becomes true.
If you enable the validity output port, if an invalid value is received from at least one
signal, the validity port output value becomes true.
Block Outputs
Name
Description
#
Output labeled with number # is output
port for signal with index #.
U
Becomes true when all signals have been
updated.
V
Becomes true when at least one signal
receives an invalid value.
Block Parameters
Device index
Unique value representing this network node.
Frame label
22-122
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
FlexRay Read Frame Signals
Selects a particular frame defined in the EB tresos Busmirror configuration file. Each
frame defines frame attributes and signal attributes, displayed in the section Frame
description from configuration (read only). These attributes cannot be changed
except by selecting a different frame.
The frame attributes are:
• Index — Unique number that identifies the frame.
• Timing — Frame timing specification, one of cyclic (for time-triggered frames)
and event (for event-triggered frames).
• Slot ID — Identifier of time slot in communication cycle to which frame is
assigned.
• Base cycle — Cycle counter value at which frame transmission starts, in range 0–
63.
• Cycle repetition — Frame period, in number of cycle units.
The signal attributes are:
• Index — Unique number that identifies the signal.
• Name — Signal name, as specified in Busmirror configuration software.
• Coded data type — Transport-level data type of the signal, as specified in
Busmirror configuration software. Only integer types are supported in Simulink
Real-Time.
• Bit length — Length of the signal, in bits.
• Offset (bits) — Offset of the signal in the frame, in bits.
Signals access level
Type specification of ports used to access signals. Possible values are Coded and
Physical.
Coded — Type of every signal input port is set to the configured transport data type
in EB tresos Busmirror.
Physical — Type of every signal input port is set to Double.
Enable update status output port
Select this check box to make the update status port U visible. The value of port
U becomes true when all of the signals in the frame have been updated with new
values received from the network.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-123
22
Model-Based FlexRay Communications Support
Enable validity output port
Select this check box to make the validity port V visible. The value of port V becomes
true if an invalid value has been received from at least one signal of the frame.
When an invalid value is received, the output port of the signal keeps its current
value.
Sample time (-1 for inherited)
Enter the base sample time or a multiple of the base sample time.
22-124
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
FlexRay Read PDU
FlexRay Read PDU
Receive Protocol Data Unit (PDU) data from board
Library
Simulink Real-Time Library for FlexRay
Description
This block reads PDU values from the board. If your model requires signal values from
the PDU, connect the output of the FlexRay Read PDU to the input of the FlexRay
Unpack PDU block
Block Outputs
Name
Description
#
uint8 vector of length equal to the
configured PDU length in EB tresos
Busmirror. The label # is the PDU index
generated by Busmirror.
U
Becomes true when new PDU content is
received from the network.
B
Becomes true when the update bit is set
for the PDU in the frame.
Block Parameters
Device index
Unique value representing this network node.
PDU label
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-125
22
Model-Based FlexRay Communications Support
Selects a particular PDU defined in the EB tresos Busmirror configuration file. Each
PDU defines PDU attributes and signal attributes, displayed in the section PDU
description from configuration (read only). These attributes cannot be changed
except by selecting a different PDU.
The PDU attributes are:
• Frame label — Label of the frame that contains the PDU.
The configuration file can allocate a PDU to more than one frame. This field
contains the label of the first frame encountered by the software in processing the
configuration file.
• PDU index — Unique number that identifies the PDU.
• PDU length (bytes) — Number of bytes in the PDU.
Some bytes in the PDU might not be used. Unused bytes have the value 0.
• PDU offset (bytes) — Offset of the PDU in the frame, in bytes.
• PDU update bit — Offset of the update bit in the frame, in bits.
The PDU update bit is not part of the PDU allocation. It can appear anywhere in
the frame.
The signal attributes are:
• Index — Unique number that identifies the signal.
• Name — Signal name, as specified in Busmirror configuration software.
• Coded data type — Transport-level data type of the signal, as specified in
Busmirror configuration software. Only integer types are supported in Simulink
Real-Time.
• Bit length — Length of the signal, in bits.
• Offset (bits) — Offset of the signal in the PDU, in bits.
Enable update status output port
Select this check box to make the update status port U visible. Port U becomes true
when the PDU has been updated with a new value received from the network.
Enable update bit output port
Select this check box to make the update bit output port B visible. Port B becomes
true when the update bit is set within the PDU in the frame.
22-126
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
FlexRay Read PDU
This option is enabled only if the FlexRay configuration file defines an update bit for
the PDU.
Reading the PDU does not clear the update bit. Once set, the update bit is cleared
only if new PDU content that has the update bit cleared is received from the network.
Sample time (-1 for inherited)
Enter the base sample time or a multiple of the base sample time.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-127
22
Model-Based FlexRay Communications Support
FlexRay Unpack PDU
Unpack Protocol Data Unit (PDU) data into signal values
Library
Simulink Real-Time Library for FlexRay
Description
Unpacks protocol data unit (PDU) into signal values.
Block Inputs
Name
Description
#
uint8 vector of length equal to the
configured PDU length in EB tresos
Busmirror. The label is the PDU index
generated by Busmirror.
Block Outputs
Name
Description
#
Output labeled with number # is output
port for signal with index #.
Block Parameters
Device index
Unique value representing this network node.
PDU label
22-128
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
FlexRay Unpack PDU
Selects a particular PDU defined in the EB tresos Busmirror configuration file. Each
PDU defines PDU attributes and signal attributes, displayed in the section PDU
description from configuration (read only). These attributes cannot be changed
except by selecting a different PDU.
The PDU attributes are:
• Frame label — Label of the frame that contains the PDU.
The configuration file can allocate a PDU to more than one frame. This field
contains the label of the first frame encountered by the software in processing the
configuration file.
• PDU index — Unique number that identifies the PDU.
• PDU length (bytes) — Number of bytes in the PDU.
Some bytes in the PDU might not be used. Unused bytes have the value 0.
• PDU offset (bytes) — Offset of the PDU in the frame, in bytes.
• PDU update bit — Offset of the update bit in the frame, in bits.
The PDU update bit is not part of the PDU allocation. It can appear anywhere in
the frame.
The signal attributes are:
• Index — Unique number that identifies the signal.
• Name — Signal name, as specified in Busmirror configuration software.
• Coded data type — Transport-level data type of the signal, as specified in
Busmirror configuration software. Only integer types are supported in Simulink
Real-Time.
• Bit length — Length of the signal, in bits.
• Offset (bits) — Offset of the signal in the PDU, in bits.
Sample time (-1 for inherited)
Enter the base sample time or a multiple of the base sample time.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-129
22
Model-Based FlexRay Communications Support
FlexRay Write Frame Signals
Write frame signal values to board for transmission on FlexRay bus
Library
Simulink Real-Time Library for FlexRay
Description
When triggered, writes signal values to the board for transmission on the FlexRay bus.
When you select a frame, the number of input ports is set to the number of signals
associated with the frame. When that frame is event-triggered, an additional trigger
input port is available. Use this port to trigger sending the frame.
Block Inputs
Name
Description
#
Input labeled with number # is input port
for signal with index #.
T
Trigger for writing signal values. This
input port is revealed if the selected frame
is an event-triggered frame.
Block Parameters
Device index
Unique value representing this network node.
Frame label
Selects a particular frame defined in the EB tresos Busmirror configuration file. Each
frame defines frame attributes and signal attributes, displayed in the section Frame
22-130
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
FlexRay Write Frame Signals
description from configuration (read only). These attributes cannot be changed
except by selecting a different frame.
The frame attributes are:
• Index — Unique number that identifies the frame.
• Timing — Frame timing specification, one of cyclic (for time-triggered frames)
and event (for event-triggered frames).
• Slot ID — Identifier of time slot in communication cycle to which frame is
assigned.
• Base cycle — Cycle counter value at which frame transmission starts, in range 0–
63.
• Cycle repetition — Frame period, in number of cycle units.
The signal attributes are:
• Index — Unique number that identifies the signal.
• Name — Signal name, as specified in Busmirror configuration software.
• Coded data type — Transport-level data type of the signal, as specified in
Busmirror configuration software. Only integer types are supported in Simulink
Real-Time.
• Bit length — Length of the signal, in bits.
• Offset (bits) — Offset of the signal in the frame, in bits.
Signals access level
Type specification of ports used to access signals. Possible values are Coded and
Physical.
Coded — Type of every signal input port is set to the configured transport data type
in EB tresos Busmirror.
Physical — Type of every signal input port is set to Double.
Trigger edge
Event trigger edge. Possible values are Rising, Falling, and Either.
Sample time (-1 for inherited)
Enter the base sample time or a multiple of the base sample time.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-131
22
Model-Based FlexRay Communications Support
FlexRay Write PDU
Write Protocol Data Unit (PDU) data to board for transmission on FlexRay bus
Library
Simulink Real-Time Library for FlexRay
Description
When triggered, writes protocol data to the board for transmission on the FlexRay bus.
This block does not have a dedicated trigger input. If you transmit the PDU in an eventtriggered frame, use a FlexRay Commit Frame block to trigger the transmission of the
frame.
Block Inputs
Name
Description
#
uint vector of length equal to the
configured PDU length in EB tresos
Busmirror. Use a FlexRay Pack PDU block
to pack the PDU with signal values.
Block Parameters
Device index
Unique value representing this network node.
PDU label
Selects a particular PDU defined in the EB tresos Busmirror configuration file. Each
PDU defines PDU attributes and signal attributes, displayed in the section PDU
description from configuration (read only). These attributes cannot be changed
except by selecting a different PDU.
22-132
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
FlexRay Write PDU
The PDU attributes are:
• Frame label — Label of the frame that contains the PDU.
The configuration file can allocate a PDU to more than one frame. This field
contains the label of the first frame encountered by the software in processing the
configuration file.
• PDU index — Unique number that identifies the PDU.
• PDU length (bytes) — Number of bytes in the PDU.
Some bytes in the PDU might not be used. Unused bytes have the value 0.
• PDU offset (bytes) — Offset of the PDU in the frame, in bytes.
• PDU update bit — Offset of the update bit in the frame, in bits.
The PDU update bit is not part of the PDU allocation. It can appear anywhere in
the frame.
The signal attributes are:
• Index — Unique number that identifies the signal.
• Name — Signal name, as specified in Busmirror configuration software.
• Coded data type — Transport-level data type of the signal, as specified in
Busmirror configuration software. Only integer types are supported in Simulink
Real-Time.
• Bit length — Length of the signal, in bits.
• Offset (bits) — Offset of the signal in the PDU, in bits.
Sample time (-1 for inherited)
Enter the base sample time or a multiple of the base sample time.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
22-133
‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ | ‪www.MatlabSite.com‬‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
23
GE Intelligent Platforms
• “ARINC 429 Support” on page 23-2
• “MIL-STD-1553 Support” on page 23-3
• “MIL-STD-1553 Initialization” on page 23-5
• “Remote Terminal Operation” on page 23-6
• “Bus Controller Operation” on page 23-8
• “Remote Terminal and Bus Controller Operation” on page 23-10
• “Bus Monitor Operation” on page 23-12
• “Boards and Blocks” on page 23-14
• “SBS Technologies Support” on page 23-17
• “Boards and Blocks — Alphabetical List” on page 23-19
Simulink Real-Time supports boards manufactured by GE Intelligent Platforms (http://
defense.ge-ip.com/products/family/avionics). This company, formerly known as GE Fanuc,
acquired Condor Engineering, SBS Technologies, and VMIC with their products. For
more about these boards and blocks, see:
• Condor Engineering
• “ARINC 429 Support” on page 23-2
• “MIL-STD-1553 Support” on page 23-3
• SBS Technologies
• “GE Intelligent Platforms Shared Memory”
• “SBS Technologies Support” on page 23-17
• VMIC
• “GE Fanuc Embedded Systems Shared Memory”
• “Boards and Blocks — Alphabetical List” on page 23-19
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
23
GE Intelligent Platforms
ARINC 429 Support
Simulink Real-Time supports the ARINC 429 bus via the CEI-520A, RCEI-530, CEI-530,
CEI-830, and RCEI-830A series boards manufactured by GE Intelligent Platforms (http://
defense.ge-ip.com/products/family/avionics) – formerly Condor Engineering.
23-2
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
MIL-STD-1553 Support
MIL-STD-1553 Support
Simulink Real-Time supports the MIL-STD-1553 bus via the PCI-1553, QPCI-1553,
QPCX-1553, and Q104 series boards. These boards are manufactured by GE Intelligent
Platforms (http://defense.ge-ip.com/products/family/avionics) – formerly Condor
Engineering. Simulink Real-Time uses the MIL-STD-1553 blocks provided by the MILSTD-1553 sublibrary of the Simulink Real-Time I/O block library. The sublibrary consists
of the following groupings:
• 1553 Utilities — Use these general utility blocks to:
• Set up Bus Monitor and Bus Controller messages.
• Create Bus Controller message lists.
• Encode and decode bus controller messages and status.
• PCI-1553, QPCI-1553, QPCX-1553 — Use these blocks to communicate with the
PCI-1553, QPCI-1553, and QPCX-1553 boards, respectively. These blocks enable you
to:
• Initialize a board for Remote Terminal, Bus Controller, and/or Bus Monitor
operation.
• Configure a board for Remote Terminal operation, including Remote Terminal
initialization and sending/receiving messages.
• Configure a board to send Bus Controller messages.
In basic functionality, these board types are the same. The QPC*-1553 boards have
additional functionality, such as internal loopback connections and voltage settings.
• Q104-1553 — Use these blocks to communicate with the Q104-1553 boards. These
blocks enable you to:
• Initialize a board for Remote Terminal, Bus Controller, and/or Bus Monitor
operation.
• Configure a board for Remote Terminal operation, including Remote Terminal
initialization and sending/receiving messages.
• Configure a board to send Bus Controller messages.
The QPC* and Q104 boards have almost the same functionality. The Q104 does not
support loopback connections and is addressed by PC104 base address instead of by
PCI slot.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
23-3
23
GE Intelligent Platforms
Regardless of the operation, initialize your board with the Initialize block for the board
type you are using—PCI, QPCI, QPCX, or Q104.
23-4
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
MIL-STD-1553 Initialization
MIL-STD-1553 Initialization
The Initialize block allows you to specify the board operation: Remote Terminal, Bus
Controller, or Bus Monitor. The mask dialog box for this block changes depending on the
operation that you select.
• Select the Initialize for Bus Controller operation check box for the Bus
Controller.
• Select the Initialize for Bus Monitor operation check box for the Bus Monitor.
• Select the Initialize for Remote Terminal operation check box for the Remote
Terminal.
By default, these check boxes are selected. If you clear an operation check box, the block
makes the associated parameters unavailable.
The following is a sample model of how to use the QPCI-1553 Initialize block to initialize
channel 1 of a board for Remote Terminal operation. This example and other examples
are located in the xpcdemos folder. This model:
• Configures two QPCI-1553 Remote Terminal Initialize blocks, one for Remote
Terminal 1 and Remote Terminal 5 on that channel.
• Initializes each Remote Terminal with legal sub addresses and legal message lengths
for each sub address.
You can configure each sub address for transmit, receive, or both. Configure the sub
addresses that you plan to use.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
23-5
23
GE Intelligent Platforms
Remote Terminal Operation
The following example uses QPCI-1553 blocks to illustrate how you can configure a
Remote Terminal from a Simulink Real-Time model. For standard initialization use the
QPCI Initialize block. Use the QPCI RT Initialize block to set up the board for Remote
Terminal operation.
Run this example on a target computer that has a QPCI-1553 board. Replace the
hardware specific blocks with the blocks for your hardware configuration.
The QPCI-1553 Initialize block configures the board for Remote Terminal operation
on channel 1 of the board. The QPCI-1553 RT Initialize block configures the Remote
Terminal 1 to monitor buses A and B for incoming messages and configure the active
transmit and receive sub addresses. The QPCI-1553 Receive and Send blocks use sub
address 3 for both transmit and receive. Note the message parameters notation 1-R-3-1
on the QPCI-1553 Receive and Send blocks. This notation has the format:
remote terminal-R/T-subaddress-number of words
Remote terminal — Indicates the particular Remote Terminal.
R/T — Indicates that the command is for receive (R) or transmit (T).
23-6
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Remote Terminal Operation
Subaddress — Indicates the sub address for the message.
Number of words — Indicates the number of 16-bit integers to receive as the data part
of a message.
This notation is shorthand that indicates that Remote Terminal 1 is to receive messages
on sub address 3 with a length of 1 word. The incoming message consists of one 16-bit
integer with a value of 1 or 2. The Multiport Switch block uses this input to select either
clock or sine wave data.
A QPCI-1553 board has a processor that handles the actual transmission and reception
of messages. The QPCI-1553 Receive block reads the board receive message buffer for the
specified Remote Terminal and sub address. The QPCI-1553 Send block writes data to
the board transmit buffer.
Note: When the board receives a transmit or receive message, it must respond quickly
because the default timeout is 14 microseconds. This timeout is much quicker than the
ability of the Simulink Real-Time software to reliably execute a model. This situation
might cause the board to transmit data from the last time the model executed. Design
your model accordingly.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
23-7
23
GE Intelligent Platforms
Bus Controller Operation
The example in this topic uses PCI-1553 blocks. It describes how you can use a Bus
Controller in a model. This model is a simple example of how to set up a short sequence
of two messages, send them, and collect the response data.
Run this example on a target computer that has a PCI-1553 board. Replace the hardware
specific blocks with the blocks for your hardware configuration.
The PCI-1553 Initialize block configures a Bus Controller on channel 1 of the board. This
block also tells the board to reserve five message buffers. This number must be at least
as large as the longest list of messages that you will send.
The Create BC Message List block allocates an empty list of five message buffers in
Simulink Real-Time memory. Each time this block executes, it sets the entire list of
message buffers to no-op messages. The Encode BC Message block fills each message for
the time step during which the message must be sent. You can also use the Encode BC
Message block in an enabled subsystem to send only that message at the specific time
that you want the message sent.
The L signal is the message list, a custom data type consisting of a pointer, message
length, and special marker. The model passes the L signal through the Encode BC
23-8
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Bus Controller Operation
Message blocks. From there, the signal goes to the Bus Controller Send block, executing
the Encode blocks before the Send block.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
23-9
23
GE Intelligent Platforms
Remote Terminal and Bus Controller Operation
The following example uses PCI blocks. It describes how you can use a Remote Terminal
and Bus Controller in a model. This model combines the three models, RTInit,
RTSample and BCSample.
RTBCSample runs on a target computer with a multifunction board. It shows how to
configure and use a single board as a Bus Controller and Remote Terminal. You can also
run this model in one target computer with two different PCI-1553 boards.
In this example, the two Encode BC Message blocks each create a message, for a total of
two, in the list. The message created in the first Encode BC Message block is a receive
message. The direction of a message is defined from the point of view of the Remote
Terminal. The Direction parameter of the block has a value of R (BC->RT). The 1553
Encode BC Message block creates message 1, one 16-bit word, to be sent to Remote
Terminal 1, sub address 3. This word has a value of either 1 or 2. This is because the
Pulse Generator outputs either 0 or 1, to which a constant value 1 is added.
23-10
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Remote Terminal and Bus Controller Operation
Message 2 of Bus Controller message list is a command for Remote Terminal 1, sub
address 3, to send one word. From the RTSample model, that data word comes back
containing either the clock or the sine wave data.
The PCI-1553 Bus Controller Send block takes a fully formed list of message buffers
and sends it. It waits for the messages to be sent and the response to be received. The
PCI-1553 Bus Controller Send block has a programmable maximum wait time parameter
(Maximum wait time (microseconds)). In this model, the maximum wait time is 1000
microseconds.
The response message list from the PCI-1553 Bus Controller Send block has the same
length as the list that was sent. The responses are found in the same position in the list
as the corresponding command. In this case, the command to the Remote Terminal to
send data is message number 2. The data that is returned is also message number 2 in
the response list. In this example, the Decode BC Message block check message 2 only.
Decode BC Message blocks can be in arbitrary order on the list. To avoid confusion, put
them in numerical order. This example does not check message 1. You can add another
Decode BC Message block to check message 1. In this case, only the status is useful
because the data is exactly what was sent.
The Decode BC Message block has the following outputs.
• L — Message list passed to other Decode BC Message blocks. If this is the only Decode
BC Message block in your model, connect the signal to a terminator or ground.
• S — Status information. The Decode BC Status block extracts individual status bits
from this status. To get multiple status bits, use multiple Decode BC Status blocks
and feed, in parallel, the same signal to the S ports.
• D — A vector of 32 short integers with the data from that message. Output from the
Decode BC Message block has the maximum message width of 32 uint16 values. The
actual message determines how many of these are significant. In this example, only
the first value is significant. The block sends the last 31 values to a terminator.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
23-11
23
GE Intelligent Platforms
Bus Monitor Operation
The following example uses PCI-1553 blocks. It describes how you can use a Bus Monitor
in a model. The Bus Monitor operation outputs a list containing the messages seen on the
specified bus since the last time it was called. The BMSample model show how to set up
a simple bus monitor that looks for the messages in the preceding examples (RTSample,
BCSample, and RTBCSample).
Run this example on a target computer that has a PCI-1553 board. Replace the hardware
specific blocks with the blocks for your hardware configuration.
The PCI-1553 Initialize block configures a Bus Monitor on channel 1 of the board. This
block also instructs the board to monitor bus A.
The PCI-1553 Bus Monitor block specifies a maximum of 10 messages to receive in a list.
The Select BM Message block picks a message with specified properties out of this list.
The Message selection mode parameter of the block provides a finite list of message
properties. In this model, the selected property is BC->RT or RT->BC.
The Select BM Message block has the following outputs:
L — Message list passed to other Select BM Message blocks. If this block is the only
Select BM Message block in your model, connect the signal to a terminator or ground.
T — Time that the board believes that the message was received on the bus. This time is
the time, in microseconds, since the board was started, presented as a double. The clock
23-12
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Bus Monitor Operation
might run at a slightly different rate than the model execution timer. This implies that
this time is likely different from the Simulink Real-Time execution time.
S — Status information. This information contains seven uint32 entries with status and
command information.
D — A vector of 32 uint16 entries with the data from that message. This vector outputs
32 entries, even if only some of the entries are defined.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
23-13
23
GE Intelligent Platforms
Boards and Blocks
Condor 1553 Create BC Message List
Condor 1553 Decode BC Message
Condor 1553 Decode BC Status
Condor 1553 Encode BC Message
Condor 1553 Select BM Message
Condor PCI-1553
Condor 1553 Decode BC Message block for
bus controller
Condor 1553 Decode BC Status block for
bus controller
Condor 1553 Encode BC Message block for
bus controller
Condor Select 1553 BM Message block for
bus monitor
Support for MIL-STD-1553 PCI boards
Condor PCI-1553 Bus Controller Send
Condor PCI-1553 Bus Monitor
Condor PCI-1553 Initialize
Condor PCI-1553 RT Initialize
Condor PCI-1553 RT Receive
Condor PCI-1553 RT Send
23-14
Condor Create BC Message List block for
bus controller
Condor PCI-1553 BC Send block for bus
controller
Condor PCI-1553 Bus Monitor (BM) block
Condor PCI-1553 Initialize block
Condor PCI-1553 RT Initialize block
Condor PCI-1553 RT Receive block for
remote terminal
Condor PCI-1553 RT Send block for remote
terminal
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Boards and Blocks
Condor Q104-1553
Support for MIL-STD-1553 PC104 boards
Condor Q104-1553 Bus Controller Send
Condor Q104-1553 Bus Monitor
Condor Q104-1553 Initialize
Condor Q104-1553 RT Initialize
Condor Q104-1553 RT Receive
Condor Q104-1553 RT Send
Condor QPCI-1553
Condor Q104-1553 BC Send block for bus
controller
Condor Q104-1553 Bus Monitor (BM) block
Condor Q104-1553 Initialize block
Condor Q104-1553 RT Initialize block
Condor Q104-1553 RT Receive block for
remote terminal
Condor Q104-1553 RT Send block for
remote terminal
Support for MIL-STD-1553 QPCI boards
Condor QPCI-1553 Bus Controller Send
Condor QPCI-1553 Bus Monitor
Condor QPCI-1553 Initialize
Condor QPCI-1553 RT Initialize
Condor QPCI-1553 RT Receive
Condor QPCI-1553 RT Send
Condor QPCI-1553 BC Send block for bus
controller
Condor QPCI-1553 Bus Monitor (BM) block
Condor QPCI-1553 Initialize block
Condor QPCI-1553 RT Initialize block
Condor QPCI-1553 RT Receive block for
remote terminal
Condor QPCI-1553 RT Send block for
remote terminal
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
23-15
23
GE Intelligent Platforms
Condor QPCX-1553
Support for MIL-STD-1553 QPCX boards
Condor QPCX-1553 Bus Controller Send
Condor QPCX-1553 Bus Monitor
Condor QPCX-1553 Initialize
Condor QPCX-1553 RT Initialize
Condor QPCX-1553 RT Receive
Condor QPCX-1553 RT Send
23-16
Condor QPCX-1553 BC Send block for bus
controller
Condor QPCX-1553 Bus Monitor (BM)
block
Condor QPCX-1553 Initialize block
Condor QPCX-1553 RT Initialize block
Condor QPCX-1553 RT Receive block for
remote terminal
Condor QPCX-1553 RT Send block for
remote terminal
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
SBS Technologies Support
SBS Technologies Support
Simulink Real-Time supports IP carrier, analog and digital I/O, synchro/resolver, and
shared memory boards manufactured by GE Intelligent Platforms (http://defense.geip.com/products/family/avionics) – formerly SBS Technologies.
SBS 2510/2500 Broadcast Memory
SBS25x0 init
Support for the SBS 2510/2500 Broadcast
Memory board
SBS25x0 init block
SBS25x0 read
SBS25x0 read block
SBS25x0 write
SBS25x0 write block
SBS IP-DAC
Support for the SBS IP-DAC I/O board
SBS IP-DAC Analog Output (D/A)
SBS IP-Digital 24
IP-DAC Analog Output block
Support for the SBS IP-Digital 24 I/O board
SBS IP-Digital 24 Digital Input
SBS IP-Digital 24 Digital Output
SBS IP-UD-IHV-16I80
SBS IP-UD-IHV-16I80 Digital Input
SBS IP-UD-IHV-16I80 Digital Output
SBS IP-UD-IHV-8I160
IP-Digital 24 Digital Input block
IP-Digital 24 Digital Output block
Support for the SBS IP-UD-IHV–16I80
board
SBS IP-UD-IHV-16I80 Digital Input block
SBS IP-UD-IHV-16I80 Digital Output block
Support for the SBS IP-UD-IHV-8I160
board
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
23-17
23
GE Intelligent Platforms
SBS IP-UD-IHV-8I160 Digital Input
SBS IP-UD-IHV-8I160 Digital Output
SBS IP-Unidig-E-48
SBS IP-Unidig-E-48 Digital Output
SBS PCI-40A Carrier Board
SBS PCI-40A
IP-Unidig-E-48 Digital Input block
IP-Unidig-E-48 Digital Output block
Support for the SBS PCI–40A Carrier
board
PCI-40A block
SBS PCI-40B Carrier Board
23-18
SBS IP-UD-IHV-8I160 Digital Output block
Support for the SBS IP-Unidig-E–48 board
SBS IP-Unidig-E-48 Digital Input
SBS PCI-40B
SBS IP-UD-IHV-8I160 Digital Input block
Support for the SBS PCI-40B Carrier board
PCI-40B block
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Boards and Blocks — Alphabetical List
Boards and Blocks — Alphabetical List
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
23-19
23
GE Intelligent Platforms
Condor CEI-520A
Support for ARINC 429 CEI-520A boards.
Board
Condor CEI-520A
General Description
The commercial and aircraft transport industry uses the ARINC 429 protocol. The
ARINC-429 driver library allows Simulink Real-Time applications to connect to an
ARINC bus network to send and receive 32-bit words. This topic assumes that you are
familiar with the ARINC 429 standard.
The Simulink Real-Time software supports the ARINC 429 protocol with the CEI-520A
board. This board interfaces a target computer to an ARINC 429 data bus and supports
the PCI bus.
The Simulink Real-Time block library provides the following driver blocks to support the
CEI-520A board:
• Condor CEI-520A Initialize
• Condor CEI-520A Send
• Condor CEI-520A Receive
Use the following utility blocks to format the data sent to and received from the
CEI-520A Send and Receive blocks:
• Condor Encode ARINC 429 Words for Send
• Condor Decode ARINC 429 Words from Receive
Board Characteristics
Board name
23-20
CEI-520A
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Condor CEI-520A
Manufacturer
GE Fanuc (formerly Condor Engineering)
Bus type
PCI
Access method
Memory mapped
Multiple block instance
support
Yes
Multiple board support
Yes
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
23-21
23
GE Intelligent Platforms
Condor CEI-520A Initialize
Condor CEI-520A Initialize block
Library
Simulink Real-Time Library for Arinc-429
Note
Your model must include a CEI-520A Initialize block for every physical board in the
model. Configure your Send and Receive blocks with the Board ID value from this block
to identify the physical board to which they refer. This block supports up to 16 unique
CEI-520A boards.
Block Parameters
Board ID
From the list, select from 1 to 16 a unique ID for the CEI board. Use the same ID to
identify the CEI board in the Initialize, Send, and Receive blocks in your model.
Wrap each send channel to the corresponding receive channel
Select this check box to enable the hardware loopback feature. If you select this block,
each word sent over the output channel n is received on the input channel n.
Timer tick length
Specify the length of a timer tick in .25 microsecond units. The default value is 4000,
which results in a tick length of one millisecond. If you select time tags from a Decode
ARINC 429 Words from Receive block, the time tags are provided in units of timer
ticks.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
PCI slot (-1:autosearch)
If only one board of this type is in the target computer, enter -1 to locate the board.
23-22
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Condor CEI-520A Initialize
If two or more boards of this type are in the target computer, enter the bus number
and the PCI slot number of the board associated with this driver block. Use the
format [BusNumber,SlotNumber].
To determine the bus number and the PCI slot number, type:
tg = slrt;
getPCIInfo(tg, 'installed')
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
23-23
23
GE Intelligent Platforms
Condor CEI-520A Send
Condor CEI-520A Send block
Library
Simulink Real-Time Library for Arinc-429
Note
Use this block to set up one channel of a board to send 32-bit words. The number of
channels varies depending on the board you have. You can provide multiple Send blocks
for each channel.
Block Parameters
Board ID
From the list, select from 1 to 16 a unique ID for the CEI board. Use the same ID to
identify the CEI board in the Initialize, Send, and Receive blocks in your model.
Channel
From the list, select a channel ID. This number varies depending on the particular
board that you are using. Refer to your board manufacturer documentation for the
number of channels in the board. If you try to select a nonexistent channel, the block
returns an error.
Baud rate
From the list, select:
• 12.5 Kbits/sec
• 100 Kbits/sec
Corresponding Send and Receive blocks must have the same baud rate setting for
this channel.
Parity
From the list, select:
23-24
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Condor CEI-520A Send
• odd
• none
Corresponding Send and Receive blocks must have the same parity setting for this
channel.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
23-25
23
GE Intelligent Platforms
Condor CEI-520A Receive
Condor CEI-520A Receive block
Library
Simulink Real-Time Library for Arinc-429
Note
Use this block to set up one channel of a board to receive 32-bit words. The number of
channels varies depending on the board you have.
The output port of a Receive block is a signal of type double, but the data on this port
is encoded in a nonstandard way. Normally, you should feed this output port into an
ARINC Decode block (which converts the data into standard double output). You can
also feed it into blocks such as MUX blocks which do not interpret the data. However,
before feeding this port into a block such as a Simulink Real-Time Scope block which
does interpret the data, you must first pass it through an ARINC Decode block.
Block Parameters
Board ID
From the list, select from 1 to 16 a unique ID for the CEI board. Use the same ID to
identify the CEI board in the Initialize, Send, and Receive blocks in your model.
Channel
From the list, select a channel ID. This number varies depending on the particular
board that you are using. Refer to your board manufacturer documentation for the
number of channels in the board. If you try to select a nonexistent channel, the block
returns an error.
Max number of words to return
Enter the maximum number of words to extract from the hardware receive buffer.
This number is the maximum number of words for the selected channel at each
sample time.
23-26
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Condor CEI-520A Receive
If you select n, the output port of the block has a signal width of n+1. The first signal
element contains the count of words actually extracted from the buffer during the
current sample time.
Min number of words to return
Enter the minimum number of words to extract from the hardware receive buffer.
This number is the minimum number of words for the selected channel at each
sample time.
If the hardware receive buffer does not contain this minimum number of words for
the selected channel during the current sample time, the block does not extract words
from the hardware receive buffer. The word count associated with the output port is
then 0.
Baud rate
From the list, select:
• 12.5 Kbits/sec
• 100 Kbits/sec
Corresponding Send and Receive blocks must have the same baud rate setting for
this channel.
Parity
From the list, select:
• odd
• none
Corresponding Send and Receive blocks must have the same parity setting for this
channel.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
23-27
23
GE Intelligent Platforms
Condor (GE-IP) RCEI-530
Support for ARINC 429 RCEI-530 and CEI-530 boards
Board
Condor (GE-IP) RCEI-530, Condor (GE-IP) CEI-530
General Description
The commercial and aircraft transport industry uses the ARINC 429 protocol. The
ARINC-429 driver library allows Simulink Real-Time applications to connect to an
ARINC bus network to send and receive 32-bit words. This topic assumes that you are
familiar with the ARINC 429 standard.
The Simulink Real-Time software supports the ARINC 429 protocol with the RCEI-530
and CEI-530 boards. This board type interfaces a target computer to an ARINC 429 data
bus and supports the PCI bus.
The Simulink Real-Time block library provides the following driver blocks to support the
RCEI-530 and CEI-530 boards:
• Condor (GE-IP) RCEI-530 Initialize
• Condor (GE-IP) RCEI-530 Send
• Condor (GE-IP) RCEI-530 Receive
Use the following utility blocks to format the data sent to and received from the
RCEI-530 Send and Receive blocks:
• Condor Encode ARINC 429 Words for Send
• Condor Decode ARINC 429 Words from Receive
Board Characteristics
Board name
23-28
RCEI-530, CEI-530
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Condor (GE-IP) RCEI-530
Manufacturer
GE Fanuc (formerly Condor Engineering)
Bus type
PCI
Access method
Memory mapped
Multiple block instance
support
Yes
Multiple board support
Yes
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
23-29
23
GE Intelligent Platforms
Condor (GE-IP) RCEI-530 Initialize
Condor RCEI-530 Initialize block, Condor CEI-530 Initialize block
Library
Simulink Real-Time Library for Arinc-429
Note
Your model must include a Condor (GE-IP) RCEI-530 Initialize block for every physical
board in the model. Configure your Send and Receive blocks with the Board ID value
from this block to identify the physical board to which they refer.
Block Parameters
Board ID
From the list, select from 1 to 16 a unique ID for the CEI board. Use the same ID to
identify the CEI board in the Initialize, Send, and Receive blocks in your model. This
ID is drawn from a pool shared by the RCEI-530, CEI-530, RCEI-830A, and CEI-830
series boards.
Wrap each send channel to the corresponding receive channel
Select this check box to enable the hardware loopback feature. If you select this block,
each word sent over the output channel n is received on the input channel n.
Timer tick length
Specify the length of a timer tick in .25 microsecond units. The default value is 4000,
which results in a tick length of one millisecond. If you select time tags from a Decode
ARINC 429 Words from Receive block, the time tags are provided in units of timer
ticks.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
PCI slot (-1:autosearch)
23-30
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Condor (GE-IP) RCEI-530 Initialize
If only one board of this type is in the target computer, enter -1 to locate the board.
If two or more boards of this type are in the target computer, enter the bus number
and the PCI slot number of the board associated with this driver block. Use the
format [BusNumber,SlotNumber].
To determine the bus number and the PCI slot number, type:
tg = slrt;
getPCIInfo(tg, 'installed')
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
23-31
23
GE Intelligent Platforms
Condor (GE-IP) RCEI-530 Send
Condor RCEI-530 Send block, Condor CEI-530 Send block
Library
Simulink Real-Time Library for Arinc-429
Note
Use this block to set up one channel of a board to send 32-bit words. The number of
channels varies depending on the board you have. You can provide multiple Send blocks
for each channel.
Block Parameters
Board ID
From the list, select from 1 to 16 a unique ID for the CEI board. Use the same ID to
identify the CEI board in the Initialize, Send, and Receive blocks in your model. This
ID is drawn from a pool shared by the RCEI-530, CEI-530, RCEI-830A, and CEI-830
series boards.
Channel
From the list, select a channel ID. This number varies depending on the particular
board that you are using. Refer to your board manufacturer documentation for the
number of channels in the board. If you try to select a nonexistent channel, the block
returns an error.
Baud rate
From the list, select:
• 12.5 Kbits/sec
• 100 Kbits/sec
Corresponding Send and Receive blocks must have the same baud rate setting for
this channel.
23-32
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Condor (GE-IP) RCEI-530 Send
Parity
From the list, select:
• odd
• none
Corresponding Send and Receive blocks must have the same parity setting for this
channel.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
23-33
23
GE Intelligent Platforms
Condor (GE-IP) RCEI-530 Receive
Condor RCEI-530 Receive block, Condor CEI-530 Receive block
Library
Simulink Real-Time Library for Arinc-429
Note
Use this block to set up one channel of a board to receive 32-bit words. The number of
channels varies depending on the board you have.
The output port of a Receive block is a signal of type double, but the data on this port
is encoded in a nonstandard way. Normally, you should feed this output port into an
ARINC Decode block (which converts the data into standard double output). You can
also feed it into blocks such as MUX blocks which do not interpret the data. However,
before feeding this port into a block such as a Simulink Real-Time Scope block which
does interpret the data, you must first pass it through an ARINC Decode block.
Block Parameters
Board ID
From the list, select from 1 to 16 a unique ID for the CEI board. Use the same ID to
identify the CEI board in the Initialize, Send, and Receive blocks in your model. This
ID is drawn from a pool shared by the RCEI-530, CEI-530, RCEI-830A, and CEI-830
series boards.
Channel
From the list, select a channel ID. This number varies depending on the particular
board that you are using. Refer to your board manufacturer documentation for the
number of channels in the board. If you try to select a nonexistent channel, the block
returns an error.
Max number of words to return
23-34
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Condor (GE-IP) RCEI-530 Receive
Enter the maximum number of words to extract from the hardware receive buffer.
This number is the maximum number of words for the selected channel at each
sample time.
If you select n, the output port of the block has a signal width of n+1. The first signal
element contains the count of words actually extracted from the buffer during the
current sample time.
Min number of words to return
Enter the minimum number of words to extract from the hardware receive buffer.
This number is the minimum number of words for the selected channel at each
sample time.
If the hardware receive buffer does not contain this minimum number of words for
the selected channel during the current sample time, the block does not extract words
from the hardware receive buffer. The word count associated with the output port is
then 0.
Baud rate
From the list, select:
• 12.5 Kbits/sec
• 100 Kbits/sec
Corresponding Send and Receive blocks must have the same baud rate setting for
this channel.
Parity
From the list, select:
• odd
• none
Corresponding Send and Receive blocks must have the same parity setting for this
channel.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
23-35
23
GE Intelligent Platforms
Condor (GE-IP) RCEI-830A
Support for ARINC 429 RCEI-830A and CEI-830 boards
Board
Condor (GE-IP) RCEI-830A, Condor (GE-IP) CEI-830
General Description
The commercial and aircraft transport industry uses the ARINC 429 protocol. The
ARINC-429 driver library allows Simulink Real-Time applications to connect to an
ARINC bus network to send and receive 32-bit words. This topic assumes that you are
familiar with the ARINC 429 standard.
The Simulink Real-Time software supports the ARINC 429 protocol with the RCEI-830A
and CEI-830 boards. This board type interfaces a target computer to an ARINC 429 data
bus and supports the PCI bus.
The Simulink Real-Time block library provides the following driver blocks to support the
RCEI-830A and CEI-830 boards:
• Condor (GE-IP) RCEI-830A Initialize
• Condor (GE-IP) RCEI-830A Send
• Condor (GE-IP) RCEI-830A Receive
Use the following utility blocks to format the data sent to and received from the CEI-830
Send and Receive blocks:
• Condor Encode ARINC 429 Words for Send
• Condor Decode ARINC 429 Words from Receive
Board Characteristics
Board name
23-36
RCEI-830A, CEI-830
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Condor (GE-IP) RCEI-830A
Manufacturer
GE Fanuc (formerly Condor Engineering)
Bus type
PCI
Access method
Memory mapped
Multiple block instance
support
Yes
Multiple board support
Yes
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
23-37
23
GE Intelligent Platforms
Condor (GE-IP) RCEI-830A Initialize
Condor RCEI-830A Initialize block, Condor CEI-830 Initialize block
Library
Simulink Real-Time Library for Arinc-429
Note
Your model must include a Condor (GE-IP) RCEI-830A Initialize block for every physical
board in the model. Configure your Send and Receive blocks with the Board ID value
from this block to identify the physical board to which they refer.
Block Parameters
Board ID
From the list, select from 1 to 16 a unique ID for the CEI board. Use the same ID to
identify the CEI board in the Initialize, Send, and Receive blocks in your model. This
ID is drawn from a pool shared by the RCEI-530, CEI-530, RCEI-830A, and CEI-830
series boards.
Wrap each send channel to the corresponding receive channel
Select this check box to enable the hardware loopback feature. If you select this block,
each word sent over the output channel n is received on the input channel n.
Timer tick length
Specify the length of a timer tick in .25 microsecond units. The default value is 4000,
which results in a tick length of one millisecond. If you select time tags from a Decode
ARINC 429 Words from Receive block, the time tags are provided in units of timer
ticks.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
PCI slot (-1:autosearch)
23-38
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Condor (GE-IP) RCEI-830A Initialize
If only one board of this type is in the target computer, enter -1 to locate the board.
If two or more boards of this type are in the target computer, enter the bus number
and the PCI slot number of the board associated with this driver block. Use the
format [BusNumber,SlotNumber].
To determine the bus number and the PCI slot number, type:
tg = slrt;
getPCIInfo(tg, 'installed')
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
23-39
23
GE Intelligent Platforms
Condor (GE-IP) RCEI-830A Send
Condor RCEI-830A Send block,Condor CEI-830 Send block
Library
Simulink Real-Time Library for Arinc-429
Note
Use this block to set up one channel of a board to send 32-bit words. The number of
channels varies depending on the board you have. You can provide multiple Send blocks
for each channel.
Block Parameters
Board ID
From the list, select from 1 to 16 a unique ID for the CEI board. Use the same ID to
identify the CEI board in the Initialize, Send, and Receive blocks in your model. This
ID is drawn from a pool shared by the RCEI-530, CEI-530, RCEI-830A, and CEI-830
series boards.
Channel
From the list, select a channel ID. This number varies depending on the particular
board that you are using. Refer to your board manufacturer documentation for the
number of channels in the board. If you try to select a nonexistent channel, the block
returns an error.
Baud rate
From the list, select:
• 12.5 Kbits/sec
• 100 Kbits/sec
Corresponding Send and Receive blocks must have the same baud rate setting for
this channel.
23-40
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Condor (GE-IP) RCEI-830A Send
Parity
From the list, select:
• odd
• none
Corresponding Send and Receive blocks must have the same parity setting for this
channel.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
23-41
23
GE Intelligent Platforms
Condor (GE-IP) RCEI-830A Receive
Condor RCEI-830A Receive block, Condor CEI-830 Receive block
Library
Simulink Real-Time Library for Arinc-429
Note
Use this block to set up one channel of a board to receive 32-bit words. The number of
channels varies depending on the board you have.
The output port of a Receive block is a signal of type double, but the data on this port
is encoded in a nonstandard way. Normally, you should feed this output port into an
ARINC Decode block (which converts the data into standard double output). You can
also feed it into blocks such as MUX blocks which do not interpret the data. However,
before feeding this port into a block such as a Simulink Real-Time Scope block which
does interpret the data, you must first pass it through an ARINC Decode block.
Block Parameters
Board ID
From the list, select from 1 to 16 a unique ID for the CEI board. Use the same ID to
identify the CEI board in the Initialize, Send, and Receive blocks in your model. This
ID is drawn from a pool shared by the RCEI-530, CEI-530, RCEI-830A, and CEI-830
series boards.
Channel
From the list, select a channel ID. This number varies depending on the particular
board that you are using. Refer to your board manufacturer documentation for the
number of channels in the board. If you try to select a nonexistent channel, the block
returns an error.
Max number of words to return
23-42
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Condor (GE-IP) RCEI-830A Receive
Enter the maximum number of words to extract from the hardware receive buffer.
This number is the maximum number of words for the selected channel at each
sample time.
If you select n, the output port of the block has a signal width of n+1. The first signal
element contains the count of words actually extracted from the buffer during the
current sample time.
Min number of words to return
Enter the minimum number of words to extract from the hardware receive buffer.
This number is the minimum number of words for the selected channel at each
sample time.
If the hardware receive buffer does not contain this minimum number of words for
the selected channel during the current sample time, the block does not extract words
from the hardware receive buffer. The word count associated with the output port is
then 0.
Baud rate
From the list, select:
• 12.5 Kbits/sec
• 100 Kbits/sec
Corresponding Send and Receive blocks must have the same baud rate setting for
this channel.
Parity
From the list, select:
• odd
• none
Corresponding Send and Receive blocks must have the same parity setting for this
channel.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
23-43
23
GE Intelligent Platforms
Condor Encode ARINC 429 Words for Send
Encode ARINC 429 Words for Send block
Library
Simulink Real-Time Library for Arinc-429
Note
The output port of an Encode block is a signal of type double. Because the Encode block
encodes the data on this port in a nonstandard way, you must send this data to one of the
following:
• Condor CEI-520A Send, Condor (GE-IP) RCEI-530 Send, and Condor (GE-IP)
RCEI-830A Send blocks — The ARINC Send block accepts data as a double.
• MUX block — The MUX block does not interpret the data. After the MUX block, you
can send it to an ARINC Send block.
Block Parameters
Label
Enter a three digit octal number as the label. The label field of each ARINC word
sent over the output port will contain this value.
Data type vector
Enter a vector consisting of values between 0 and 3. These values specify the data
type. The length of this vector determines the widths of both the input and output
ports. The data type determines how the input double value is converted to a
corresponding ARINC value, as follows
23-44
Type
Interpretation
0
Raw — Cast the input to an unsigned 32-bit integer and output it as an
ARINC word without further processing.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Condor Encode ARINC 429 Words for Send
Type
Interpretation
1
BNR (two's complement binary notation) — Scale the input by dividing
it by the scale vector in the Resolution (BCD) or Scale (BNR)
vector parameter. This input value is restricted to the range [Scale, Scale], resulting in a scaled value in the range [-1,1].
The driver performs the following on the scaled value:
1
Multiplies the scaled value by 2^18.
2
Truncates the value to a 19-bit fixed-point integer, then masks
it to the number of high-order bits specified by the Bits to send
parameter.
3
Shifts the result up 10 bits and inserts them into the 32-bit integer
along with the SSM, SDI, and Label parameter values.
To place discrete bits into unused positions, construct the 32-bit word
and use it with RAW mode instead of the BNR mode.
2
BCD (binary coded decimal) — Cast the input as a signed integer, limit
it to the range representable by an ARINC five-character BCD value,
and pack it into an ARINC word. and set the required SSM, SDI, and
Label parameter values.
3
Discretes —- Cast the input as an unsigned 32-bit integer, pack the low
order 19 bits of the result into an ARINC word, and set the required
SSM, SDI, and Label parameters.
Resolution (BCD) or Scale (BNR) vector
Enter a vector or scalar value as the resolution vector. This value must be a vector of
the same length as the data type vector . Otherwise, the scalar value is applied to
the length of the data type vector. The interpretation of this value depends on the
data type. The block works with the data types as follows.
Type
Effect
Raw
The block ignores the resolution value. However, you must still
include an associated value in the resolution vector.
BNR
The block uses this value as a scale factor. The block divides the
input value by the scale. Doing so limits the valid input range to
[-Scale, Scale]. Values outside that range will be limited to
±Scale.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
23-45
23
GE Intelligent Platforms
Type
Effect
A 19-bit signed ARINC binary can represent a range from
-262,144 to 262,143. If the combination of input signal and
resolution produces a value outside this range, the block keeps it
within the range.
BCD
The resolution vector specifies, in the same units as the input
signal, the value of the least significant digit of the BCD data
field to be encoded and sent. For example, if the associated
resolution is .01 and the input signal contains the value 3.1415,
the output ARINC word will contain the number 314 in its data
field, encoded in BCD. Use the same resolution on the receive
side to reconstruct 3.14. Resolution is typically a power of 10, but
this is not a restriction.
The range representable as an ARINC BCD value is -79,999 to
79,999. If the combination of input signal and resolution produces
a value outside this range, the block limits it to be within the
range.
Discretes
The block ignores the resolution value. However, you must still
include an associated value in the resolution vector.
Bits to send (BNR)
Specifies the number of high order bits of the 19-bit scaled input to keep when the
value is inserted into the encoded word. The block uses this value for a BNR format
input; other formats ignore it. You must include a place in the array of Bits values for
each entry in the data type vector array; however, the block uses the value only for
BNR.
SDI vector
Enter a vector or scalar value as the SDI vector. This must be a vector of the same
length as the data type vector. Otherwise, the scalar value is applied to the length
of the data type vector.
This block interprets the SDI vector values as follows:
23-46
Type
Effect
Raw
The block ignores the SDI value. However, you must still include
an associated value in the resolution vector.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Condor Encode ARINC 429 Words for Send
Type
Effect
BNR, BCD,
Discretes
If the SDI element is in the range 0 to 3, the block sets the
SDI field of the corresponding output word to that value. If an
SDI element has a value of -1, the block does not perform SDI
processing on the corresponding output word.
SSM vector
Enter a vector or scalar value as the SSM vector. This vector must be a vector of the
same length as the data type vector. Otherwise, the scalar value is applied to the
length of the data type vector.
If the SSM element is in the range 0 to 3, the block sets the SSM field of the
corresponding output word to that value. If an SSM element has a value of -1, the
block does not perform SSM processing on the corresponding output word. The
meaning of a given SSM value differs depending on the data type of the ARINC word.
Type
Effect
Raw
The block ignores the SSM value. However, you must still include
an associated value in the resolution vector.
BNR, BCD,
Discretes
If the SSM element is in the range 0 to 3, the block sets the
SSM field of the corresponding output word to that value. If an
SSM element has a value of -1, the block does not perform SSM
processing on the corresponding output word.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
23-47
23
GE Intelligent Platforms
Condor Decode ARINC 429 Words from Receive
Decode ARINC 429 Words from Receive block
Library
Simulink Real-Time Library for Arinc-429
Note
The input port of a Decode block is a signal of type double. Because the Decode block
interprets the data on this port in a nonstandard way, you can send the data to this port
from one of the following:
• Condor CEI-520A Receive, Condor (GE-IP) RCEI-530 Receive, and Condor (GEIP) RCEI-830A Receive blocks — The ARINC Receive blocks output their data into
standard double output. This is the block from which you will most likely send data to
the ARINC Decode block.
The output port of a Decode block is in standard double format.
The input to this block should be a CEI-520A, RCEI-530, or CEI-830 Receive block. The
Decode block input port width will automatically adapt to that of the source block.
Block Parameters
Label
Enter a three digit octal number. If the label of an input word does not match this
label, the block completely ignores the word and does not apply the Sync mask and
Sync value parameters.
Data type vector
Enter a vector consisting of values between 0 and 3. These values specify the data
type. The length of this vector determines how many ARINC words the block will
attempt to decode and output each sample time.
23-48
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Condor Decode ARINC 429 Words from Receive
The elements of the vector determine how the input double value is converted to a
corresponding double output value, as follows
Type
Interpretation
0
Raw — Convert the entire (unsigned) 32–bit input word to double.
1
BNR — For each word, convert bits 10–28 from signed binary
format to a double output in the range [-Scale, Scale] using the
Resolution (BCD) or Scale (BNR) vector scale factor specified for
this value.
2
BCD — For each word, convert bits 10–28 from BCD format to double,
using the sign data in the SSM.
3
Discretes — For each word, extract bits 10–28 and return them as a
double.
The elements of the data type vector determine how the input ARINC value is
converted to a corresponding double output. The following describes how this block
performs the conversion. For the purposes of this description, n denotes the length of
the data type vector.
• The output width is one of the following, depending on your time tag selection
• 2n + 1 — This is the output width if you select the Provide time tags check box.
The width consists of a count element, followed by n data elements, followed by n
time tag elements.
• n + 1 — This is the output width if you do not select the Provide time tags
check box. The width consists of a count element followed by n data elements.
The count element indicates how many valid messages the block has decoded during
the current sample time. The count element has a nonzero value if at least one
message on the data element is currently valid, and zero otherwise. If the count
element has a value greater than one, the block asserts only the most recent valid
message on the output port.
• The Decode block buffers its input internally. It updates its output port only during
sample times when it has assembled at least one complete message of length n
without detecting an error.
More than one complete message might be assembled during one sample time. The
Decode block overwrites these messages such that only the most recent message is on
the output port.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
23-49
23
GE Intelligent Platforms
Resolution (BCD) or Scale (BNR) vector
Enter a vector or scalar value as the resolution vector. This value must be a vector of
the same length as the data type vector. Otherwise, the scalar value is applied to
the length of the data type vector. The interpretation of this value depends on the
data type. The block works with the data types as follows.
Type
Effect
Raw
The block ignores the resolution value. However, you must still
include an associated value in the resolution vector.
BNR
The block uses this value as a scale factor. The block converts the
binary value in bits 10–28 back to a double in the range [-1,1].
The block then multiplies that value by the scale value to recover
the original value.
A 19-bit signed ARINC binary can represent a range from
-262,144 to 262,143. If the combination of input signal and
resolution produces a value outside this range, the block clamps
it to be within the range.
BCD
The resolution vector specifies, in the same units as the input
signal, the value of the least significant digit of the BCD data
field to be encoded and sent. For example, if the associated
resolution is .01 and the input signal contains the value 3.1415,
the output ARINC word will contain the number 314 in its data
field, encoded in BCD. Use same resolution on the receive side to
reconstruct 3.14. Resolution is typically a power of 10, but this is
not a restriction.
The range representable as an ARINC BCD value is -79,999 to
79,999. If the combination of input signal and resolution produces
a value outside this range, the block limits it to within the range.
Discretes
The block ignores the resolution value. However, you must still
include an associated value in the resolution vector.
Sync mask
Enter a value, in hexadecimal, to specify which bits of the input words are the sync
bits. (A sync bit lets you specify, using other parameters, when a message should
begin.) The Decode block will examine these bits to look for the start of the next
23-50
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Condor Decode ARINC 429 Words from Receive
message. A message might be a string of one or more words. For example, a sync
mask value of 0x300 equals 1100000000 in binary. This value selects the SDI
bits (bits 9 and 10) as the sync bits. This functionality works with the Sync value
parameter.
If the sync mask is 0x0, sync logic is not used. The next word begins a new message.
Sync value(s)
This parameter specifies the sync logic for the block. Enter one hex value to specify
oneSync, two hex values separated by a space for twoSync logic. For example, the
sync value
0x100
selects oneSync logic. The sync value
0x100 0x200
selects twoSync logic. You can enter an 32-bit value.
The sync value takes into account the value of the sync mask, as follows:
• Assume the following:
Sync mask = 0x300
Sync value = 0x100
When looking for the beginning of a new message, the block ANDs each input word
with the sync mask 0x300 and compares the result with 0x100 and 0x300. When
it finds a match, the block stops this search and begins a new search, looking for the
next message. The block decodes the next n words starting at this point.
• Assume the following:
Sync mask = 0x300
Sync value = 0x100 0x200
When looking for the beginning of a new message, the block ANDs each input word
with 0x300 and compares the result to 0x100 and 0x300. When the block finds a
match, and when the next input word, when ANDed with 0x300, equals 0x200 and
0x300, this second word begins a new message.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
23-51
23
GE Intelligent Platforms
Once the block locates the beginning of a message, it uses the next n input words and
the required label to assemble the next output message. The block does not use sync
logic until it is time to begin the assembly of a new message.
Provide time tags
Select this check box to enable an output port of width 2n + 1, with time tag data in
the last n elements.
23-52
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Condor 1553 Create BC Message List
Condor 1553 Create BC Message List
Condor Create BC Message List block for bus controller
Library
Simulink Real-Time Library for MIL-STD-1553
Description
This block allocates space for a BC message list. It sets the messages in the list to no-op.
This implies that the execution of a message on a given time step requires that a 1553
Encode BC Message block execute on that time step. The 1553 Create BC Message List
block performs a clearing operation that allows you to control when a message is sent by
placing 1553 Encode BC Message blocks in enabled subsystems.
Block Parameters
Number of message buffers
Enter the number of message buffers for the list. This block allocates an empty list
for these buffers in Simulink Real-Time memory.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
See Also
Condor 1553 Encode BC Message
“Bus Controller Operation” on page 23-8
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
23-53
23
GE Intelligent Platforms
Condor 1553 Decode BC Message
Condor 1553 Decode BC Message block for bus controller
Library
Simulink Real-Time Library for MIL-STD-1553
Description
Each instance of this block extracts information out of one message in the receive list.
This block has three outputs.
L — Specifies the input and output message list passed to other Decode BC Message
blocks. If this is the only Decode BC Message block in your model, connect the signal to a
terminator or ground.
S — The S output is a vector of six elements from the received message, bit packed with
information:
control, command1, status1, command2, status2, overall status
These elements derive from the API_BC_MBUF structure, which is contained in the
Simulink Real-Time file matlab\toolbox\rtw\targets\xpc\target\build
\xpcblocks\ include\busapi.h. See the GE Fanuc (formerly Condor Engineering)
1553 software user documentation for details on this structure.
Use the Decode BC Status block to extract individual status bits from this status. To get
multiple status bits, use multiple Decode BC Status blocks and feed, in parallel, the same
signal to the S ports.
D — The D output is a vector of 32 short integers with the data from that message. For a
message sent to an RT (R direction), these values are the ones sent. For a message from
an RT (T direction), this contains the values from the RT. You do not need to decode the
received message from an R message.
Block Parameters
Message number
23-54
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Condor 1553 Decode BC Message
Enter the number of the message to decode.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
23-55
23
GE Intelligent Platforms
Condor 1553 Decode BC Status
Condor 1553 Decode BC Status block for bus controller
Library
Simulink Real-Time Library for MIL-STD-1553
Description
This block extracts individual status bits from the status output of the Decode BC
Message block.
Block Parameters
Status to read
From the list, choose a status to read. The Decode BC Status block extracts
individual status bits from the status (S) output of the Decode BC Message block.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
23-56
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Condor 1553 Encode BC Message
Condor 1553 Encode BC Message
Condor 1553 Encode BC Message block for bus controller
Library
Simulink Real-Time Library for MIL-STD-1553
Description
This block fills each message for the timestep during which the message should be sent.
The Create BC Message List block allocates an empty list of message buffers in Simulink
Real-Time memory. Use the Encode BC Message block to fill these messages.
Block Parameters
Message number
Enter the number of the message to encode. Each BC message needs to use a unique
message number. This is the place in the list to fill with this message.
Remote Terminal address 1 (Receive if RT-RT)
From the list, choose a Remote Terminal address 1.
Sub address 1 (Receive if RT-RT)
From the list, choose a Remote Terminal sub address 1. Setting this parameter to
Send (0) mode command or Send (31) mode command disables the Message
word count parameter.
Remote Terminal address 2 (Transmit if RT-RT)
From the list, choose a Remote Terminal address 2. This is not used if the Direction
is R (BC->RT) or T (RT->BC).
Sub address 2 (Transmit if RT-RT)
From the list, choose a Remote Terminal sub address 2. This is not used if the
Direction is R (BC->RT) or T (RT->BC).
Mode command
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
23-57
23
GE Intelligent Platforms
If the Sub address 1 is 0 or 31, from the list, choose a mode command.
Message word count
Specify the number of uint16 words to send or receive.
Direction
From the list, choose the encode direction. Choose from
• R (BC->RT)
• T (RT->BC)
• RT->RT
Inter message gap to next message (usec)
Specify the minimum amount of time, in microseconds, between messages.
Output bus
From the list, choose output bus A or B that this message will be sent on.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
See Also
Condor 1553 Create BC Message List, Condor 1553 Decode BC Message
23-58
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Condor 1553 Select BM Message
Condor 1553 Select BM Message
Condor Select 1553 BM Message block for bus monitor
Library
Simulink Real-Time Library for MIL-STD-1553
Description
This block picks a message with specified properties out of a Bus Monitor list from the
PCI-1553 Bus Monitor block.
Block Input and Outputs
This block has the following inputs and outputs:
L — The passed through message list
T — Time in microseconds at which this message was received
S — Status (seven component vector with contents)
• 1 message number
• 2 cmd1
• 3 resp1
• 4 status 1
• 5 cmd 2
• 6 resp 2
• 7 status 2
Elements cmd1 and cmd2 contain address information in bit fields in the 16-bit integer.
cmdN=<RRRRR>T<SSSSS><CCCCC>
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
23-59
23
GE Intelligent Platforms
Where RRRRR is the 5-bit field with the remote terminal address. T is 1 if a transmit
message, 0 if receive. S is the sub address. C is the count.
Elements 5, 6, and 7 are only nonzero for the RT->RT messages.
D — 32 uint16 vector data. cmd 1 has the length of real data in the low order 5 bits.
The block clears the status and data words to 0 if a matching message is not found in the
list.
Block Parameters
Message selection mode
From the list, choose a message selection (filtering) mode
• message number — By message number
• BC->RT or RT->BC — By Remote Terminal and sub address
• RT->RT — By both Remote Terminal and sub addresses
Message number
Specify an index into a Bus Monitor list. Use this parameter if you set Message
selection mode to message number.
Remote Terminal 1
Specify the Remote Terminal from which to select the message. Use this parameter if
you set Message selection mode to one of the following:
• BC->RT or RT->BC
• RT->RT (receive side)
Sub address 1
Specify the sub address from which to select the message. Use this parameter if you
set Message selection mode to one of the following:
• BC->RT or RT->BC
• RT->RT (receive side)
Remote Terminal 2
23-60
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Condor 1553 Select BM Message
Specify the Remote Terminal from which to select the message. Use this parameter if
you set Message selection mode to RT->RT (send side).
Sub address 2
Specify the sub address from which to select the message. Use this parameter if you
set Message selection mode to RT->RT (send side).
Direction
From the list, choose the encode direction. Use this parameter if you set Message
selection mode to BC->RT or RT->BC. Choose from
• R (BC->RT) — Receive, from Bus Controller to Remote Terminal
• T (RT->BC) — Transmit, from Remote Terminal to Bus Controller
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
See Also
Condor PCI-1553 Bus Monitor
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
23-61
23
GE Intelligent Platforms
Condor PCI-1553
Support for MIL-STD-1553 PCI boards
Board
Condor PCI-1553
General Description
The MIL-STD-1553 driver library allows Simulink Real-Time applications to connect to
a MIL-STD-1553 bus network to send and receive messages of up to 32 16-bit words. You
must be familiar with the MIL-STD-1553 standard.
The Simulink Real-Time block library supports the MIL-STD-1553 protocol with
PCI-1553 boards. These boards connect a target computer to a MIL-STD-1553 data bus
via the PCI bus.
The PCI-1553 board is available with 1 or 2 channels as either a single function or a
multifunction configuration. The multifunction version supports simultaneous use of the
Bus Controller, Bus Monitor, and Remote Terminal functions. The single function version
emits an error if more than one function is initialized. PCI-1553 blocks support up to two
channels for this board.
To support these boards, the block library provides the following driver blocks:
• Condor PCI-1553 Bus Controller Send
• Condor PCI-1553 Bus Monitor
• Condor PCI-1553 Initialize
• Condor PCI-1553 RT Initialize
• Condor PCI-1553 RT Receive
• Condor PCI-1553 RT Send
To format the Bus Controller messages, use the following utility blocks:
• Condor 1553 Create BC Message List
23-62
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Condor PCI-1553
• Condor 1553 Decode BC Message
• Condor 1553 Decode BC Status
• Condor 1553 Encode BC Message
• Condor 1553 Select BM Message
Board Characteristics
Board name
PCI-1553
Manufacturer
GE Fanuc (formerly Condor Engineering)
Bus type
PCI
Multiple board support
Yes
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
23-63
23
GE Intelligent Platforms
Condor PCI-1553 Bus Controller Send
Condor PCI-1553 BC Send block for bus controller
Library
Simulink Real-Time Library for MIL-STD-1553
Description
This block sends a list of messages to the specified channel on the board. Before you
construct the list of messages:
1
Allocate space for the list with the Condor 1553 Create BC Message List block.
2
Fill in information about each message with Condor 1553 Encode BC Message
blocks.
Each instance of an Encode BC Message block fills in information for a single
message on the list. Daisy chain the Encode BC Message block L signals so that the
Encode BC blocks execute before the Bus Controller Send block.
The Bus Controller Send block allocates a list for the reception of messages. This block
can:
• Read the set of messages and statuses from the last time a message was sent before
sending the new list.
• Send the new list and wait for a response.
In other words, for time step N, the output of the Send block is either the response to time
step N-1 or the response to time step N, chosen from the Response mode parameter.
Block Parameters
Channel
From the list of available channels on the board, choose 1 or 2. This channel is
initialized for this command stream.
23-64
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Condor PCI-1553 Bus Controller Send
Response mode
Choose from:
• Read response to previous message then send new message — Before
sending new messages, read the command buffers from the board.
• Send new message then wait and read response — Transmit new message,
and then wait for response before continuing.
Use the Maximum wait time (microseconds) parameter to set the amount of
time the block must wait for a response.
Maximum wait time (microseconds)
Enter the maximum time that this block waits for the message stream to be sent by
the board. If the Response mode parameter is set to Send new message then
wait and read response, use this parameter.
A reasonable maximum wait time is 1000 microseconds (1 millisecond). This value
must not exceed the sample time. Exceeding the sample time triggers an execution
overload.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
PCI slot (-1:autosearch)
If only one board of this type is in the target computer, enter -1 to locate the board.
If two or more boards of this type are in the target computer, enter the bus number
and the PCI slot number of the board associated with this driver block. Use the
format [BusNumber,SlotNumber].
To determine the bus number and the PCI slot number, type:
tg = slrt;
getPCIInfo(tg, 'installed')
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
23-65
23
GE Intelligent Platforms
Condor PCI-1553 Bus Monitor
Condor PCI-1553 Bus Monitor (BM) block
Library
Simulink Real-Time Library for MIL-STD-1553
Block Parameters
Channel
From the list of available channels on the board, choose 1 or 2. This channel is
initialized for this command stream.
Maximum number of messages to receive
Enter the maximum number of messages this block must read from the board.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
PCI slot (-1:autosearch)
If only one board of this type is in the target computer, enter -1 to locate the board.
If two or more boards of this type are in the target computer, enter the bus number
and the PCI slot number of the board associated with this driver block. Use the
format [BusNumber,SlotNumber].
To determine the bus number and the PCI slot number, type:
tg = slrt;
getPCIInfo(tg, 'installed')
23-66
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Condor PCI-1553 Initialize
Condor PCI-1553 Initialize
Condor PCI-1553 Initialize block
Library
Simulink Real-Time Library for MIL-STD-1553
Block Parameters
Channel
From the list of available channels on the board, choose 1 or 2. This channel is
initialized for this command stream.
Coupling mode
From the list, select from Direct Coupling and Transformer Coupling. This
selection defines the mode for coupling a terminal device to the bus.
Initialize for Bus Controller operation
Select this check box to perform Bus Controller initialization for this channel.
Selecting this check box enables the parameters Number of Bus Controller
buffers to allocate, Enable retries, No response timeout (microseconds), and
Late response timeout (microseconds).
Number of Bus Controller buffers to allocate
Enter the number of buffers to allocate in onboard memory on the board. This
number must be greater than or equal to the longest string of command buffers
that the board is given to process.
Enable retries
Select this check box to enable automatic retries when a message times out or
has an error.
No response timeout (microseconds)
Enter the number of microseconds the board is to wait for a response from the
Remote Terminal. If the response from the Remote Terminal takes longer than
this timeout value, the board sets the NORESPONSE error condition in the
status returned from the command.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
23-67
23
GE Intelligent Platforms
Late response timeout (microseconds)
Enter the number of microseconds the board is to wait for a response from the
Remote Terminal. If the response from the Remote Terminal takes longer than
this timeout value, the board sets the LATERESPONSE error condition in the
status returned from the command.
Initialize for Bus Monitor operation
Select this check box to initialize this channel for Bus Monitor operation. Selecting
this check box enables the parameters Monitor bus A, Monitor bus B, and
Number of monitor buffers to allocate.
Monitor bus A
Select this check box to monitor bus A. You can monitor either bus A, bus B, or
both.
Monitor bus B
Select this check box to monitor bus B. You can monitor either bus B, bus A, or
both.
Number of monitor buffers to allocate
Enter a number at least as large as the number of messages that you expect to
see between calls to the Bus Monitor block. If more messages arrive than there
are buffers, some messages are lost and not monitored.
Initialize for Remote Terminal operation
Select this check box to prepare the board to operate as a Remote Terminal. If you
select this check box, add the RT Initialize block to the model to initialize the Remote
Terminal. Connect the RT Initialize block for the Remote Terminal to the S output of
this block.
Selecting this check box enables the parameter RT address 31 is Broadcast.
RT address 31 is Broadcast
Select this check box to enable the board to see messages to Remote Terminal 31
as broadcast messages.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
PCI slot (-1:autosearch)
23-68
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Condor PCI-1553 Initialize
If only one board of this type is in the target computer, enter -1 to locate the board.
If two or more boards of this type are in the target computer, enter the bus number
and the PCI slot number of the board associated with this driver block. Use the
format [BusNumber,SlotNumber].
To determine the bus number and the PCI slot number, type:
tg = slrt;
getPCIInfo(tg, 'installed')
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
23-69
23
GE Intelligent Platforms
Condor PCI-1553 RT Initialize
Condor PCI-1553 RT Initialize block
Library
Simulink Real-Time Library for MIL-STD-1553
Description
Add an RT Initialize block for each Remote Terminal address for which you want this
board to accept commands. Because each of these blocks must execute after the global
board initialization, connect the S input to either the:
• Main Condor PCI-1553 Initialize block for this board
• Another Condor PCI-1553 RT Initialize block that is connected to the main Condor
PCI-1553 Initialize block
This connection carries the channel number and PCI slot information.
Block Parameters
Remote Terminal
From the list, choose a Remote Terminal from 0 to 31. The remote terminal
number configured in RT Send and RT Receive must match that specified by the
corresponding RT Initialize block.
Connect to bus A
Select this check box to have this Remote Terminal listen on bus A. If a message can
come in on either bus, choose both A and B.
Connect to bus B
Select this check box to have this Remote Terminal listen on bus B. If a message can
come in on either bus, choose both A and B.
Initial status
23-70
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Condor PCI-1553 RT Initialize
Enter the value to which the board should initialize the status before it executes
commands. The board maintains a status word that it sends to the Bus Controller
after it executes a command.
Initial BIT word
Enter the initial value of the Built In Test (BIT) word. The Remote Terminal sends
this word in response to the Transmit BIT Word mode code.
Inhibit terminal flag
Select this check box to inhibit the Remote Terminal flag. This value is the initial
value of the Inhibit Terminal Flag bit. This value can be changed from the Bus
Controller with the Inhibit Terminal and Override Inhibit Terminal mode
codes. The terminal bit is one of the hardware-maintained bits in the status word.
Transmit sub addresses
Enter a vector of sub addresses to which this Remote Terminal must respond. These
sub addresses are the sub addresses that can transmit data when requested. Each
element of the vector must correspond to the corresponding element of the Legal
transmit message lengths vector. To enable the sub address for the Remote
Terminal, include the sub address in the vector.
A Remote Terminal accepts a message only if it has been directed to accept messages
of the same length. During initialization, the board must receive a list of valid
message lengths for each Remote Terminal number.
Legal transmit message lengths
Enter a vector of transmit message lengths. This vector is a vector of bit masks. Each
mask bit corresponds to a single message length. Construct the transmit message
length vector as follows:
• Each element of the vector corresponds to the corresponding element of the
Transmit sub addresses vector.
• Each element of the vector corresponds to the corresponding element of the Legal
receive message lengths. Failure to do so prevents the sub address on this
Remote Terminal from responding.
A message can have a length of from 1 to 32 words, selected by setting one or more
bits in a 32-bit mask.
Bit Position
Mask Value (hex)
Word Length (words)
0
0x00000001
32
1
0x00000002
1
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
23-71
23
GE Intelligent Platforms
Bit Position
Mask Value (hex)
Word Length (words)
2
0x00000004
2
30
0x40000000
30
31
0x80000000
31
...
• Use the hex2dec function to specify the bit mask in hexadecimal.
• The message length is expressed by bit position in the mask, not by mask value.
The value 0xffffffff enables all message lengths from 1 to 32.
• The board does not accept a message with a disallowed length. The board sends
an error to the Bus Controller by returning a status with the Message Error bit
set.
Receive sub addresses
Enter a vector of the sub addresses that can accept a receive message. Each element
of the vector must correspond to the corresponding element of the Legal receive
message lengths vector. To enable the sub address for the Remote Terminal,
include the sub address in the vector.
A Remote Terminal accepts a message only if it has been directed to accept messages
of the same length. During initialization, the board must receive a list of valid
message lengths for each Remote Terminal number.
Legal receive message lengths
Enter a vector of receive message lengths. This vector is a vector of bit masks. Each
bit corresponds to a single message length. Construct the receive message lengths
vector as follows:
• Each element of the vector corresponds to the corresponding element of the
Transmit sub addresses vector.
• Each element of the vector corresponds to the corresponding element of the
Receive sub addresses vector.
• Each element of the vector corresponds to the corresponding element of the Legal
transmit message lengths. Failure to do so prevents the sub address on this
Remote Terminal from responding.
A message can have a length of from 1 to 32 words, selected by setting one or more
bits in a 32-bit mask.
23-72
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Condor PCI-1553 RT Initialize
Bit Position
Mask Value (hex)
Word Length (words)
0
0x00000001
32
1
0x00000002
1
2
0x00000004
2
30
0x40000000
30
31
0x80000000
31
...
• Use the hex2dec function to specify the bit mask in hexadecimal.
• The message length is expressed by bit position in the mask, not by mask value.
The value 0xffffffff enables all message lengths from 1 to 32.
• The board does not accept a message with a disallowed length. The board sends
an error to the Bus Controller by returning a status with the Message Error bit
set.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
23-73
23
GE Intelligent Platforms
Condor PCI-1553 RT Receive
Condor PCI-1553 RT Receive block for remote terminal
Library
Simulink Real-Time Library for MIL-STD-1553
Note
Your model might have multiple Remote Terminal Receive blocks. To help you locate a
particular block, the Remote Terminal Receive block displays the channel number and
address parameters. The address display has the format:
remote terminal-R-sub address-number of words
Remote terminal — Is the Remote Terminal parameter
R — Indicates receive command
Subaddress — Is the Sub address parameter
Number of words — Is the Number of words to receive parameter
A receive command for RT 1, sub address 3 to receive 2 words has the layout 1-R-3-2.
Block Parameters
Channel
From the list of available channels on the board, choose 1 or 2. This channel is
initialized for this command stream.
Remote Terminal
From the list, choose a Remote Terminal from 0 to 31. The remote terminal
number configured in RT Send and RT Receive must match that specified by the
corresponding RT Initialize block.
Sub address
23-74
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Condor PCI-1553 RT Receive
From the list, choose a sub address from 0 to 31. Select the sub address for this
message.
Number of words to receive
Enter the number of 16-bit integers to receive as the data part of this message. This
number must be between 1 and 32. The output data vector has the same vector
width.
If this Remote Terminal or sub address can be sent messages with different lengths,
specify the longest message length for this parameter. You must determine how
much length is significant from content.
Enable timestamp output
Select this check box to cause output T to appear.
Output T returns the time, in microseconds, at which the most recent message was
received. The time is measured from the beginning of execution.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
PCI slot (-1:autosearch)
If only one board of this type is in the target computer, enter -1 to locate the board.
If two or more boards of this type are in the target computer, enter the bus number
and the PCI slot number of the board associated with this driver block. Use the
format [BusNumber,SlotNumber].
To determine the bus number and the PCI slot number, type:
tg = slrt;
getPCIInfo(tg, 'installed')
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
23-75
23
GE Intelligent Platforms
Condor PCI-1553 RT Send
Condor PCI-1553 RT Send block for remote terminal
Library
Simulink Real-Time Library for MIL-STD-1553
Description
A Remote Terminal sends data only if it receives a transmit command from the Bus
Controller. This block prepares the board for the next transmit command on this channel,
Remote Terminal number, and sub address as specified by the Initialize and RT Initialize
blocks.
The data vector signal input to this block is copied to the board message buffer that
corresponds to the specified address. The input data vector must have the same length
as specified in the Number of words to send parameter. The input vector can be either
16- or 32-bit signed or unsigned data. The block sends only the bottom 16 bits of each
element.
Your model might have multiple Remote Terminal Send blocks. To help you locate a
particular block, the Remote Terminal Send block displays the channel number and
address parameters. The address display has the format:
remote terminal-T-sub address-number of words
Remote terminal — Derives from the Remote Terminal parameter
T — Indicates transmit (or send) command
Subaddress — Derives from the Sub address parameter
Number of words — Derives from the Number of words to receive parameter
A transmit command for RT 1, sub address 3 to send 2 words has the layout 1-T-3-2.
23-76
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Condor PCI-1553 RT Send
Block Parameters
Channel
From the list of available channels on the board, choose 1 or 2. This channel is
initialized for this command stream.
Remote Terminal
From the list, choose a Remote Terminal from 0 to 31. The remote terminal
number configured in RT Send and RT Receive must match that specified by the
corresponding RT Initialize block.
Sub address
From the list, choose a sub address from 0 to 31. Select the sub address for this
message.
Number of words to send
Enter the number of 16-bit integers to send as the data part of this message. This
number must be between 1 and 32. The input data vector must have the same vector
width.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
PCI slot (-1:autosearch)
If only one board of this type is in the target computer, enter -1 to locate the board.
If two or more boards of this type are in the target computer, enter the bus number
and the PCI slot number of the board associated with this driver block. Use the
format [BusNumber,SlotNumber].
To determine the bus number and the PCI slot number, type:
tg = slrt;
getPCIInfo(tg, 'installed')
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
23-77
23
GE Intelligent Platforms
Condor Q104-1553
Support for MIL-STD-1553 PC104 boards
Board
Condor Q104-1553
General Description
The MIL-STD-1553 driver library allows Simulink Real-Time applications to connect to
a MIL-STD-1553 bus network to send and receive messages of up to 32 16-bit words. You
must be familiar with the MIL-STD-1553 standard.
The Simulink Real-Time block library supports the MIL-STD-1553 protocol with
Q104-1553 boards. These boards connect a target computer to a MIL-STD-1553 data bus
via the PC104 bus.
The Q104-1553 board is available with 1, 2, 3, or 4 channels as either a single function or
multifunction configuration. The multifunction version supports simultaneous use of the
Bus Controller, Bus Monitor, and Remote Terminal functions. The single function version
emits an error if more than one function is initialized.
To support these boards, the block library provides the following driver blocks:
• Condor Q104-1553 Bus Controller Send
• Condor Q104-1553 Bus Monitor
• Condor Q104-1553 Initialize
• Condor Q104-1553 RT Initialize
• Condor Q104-1553 RT Receive
• Condor Q104-1553 RT Send
To format the Bus Controller messages, use the following utility blocks:
• Condor 1553 Create BC Message List
• Condor 1553 Decode BC Message
23-78
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Condor Q104-1553
• Condor 1553 Decode BC Status
• Condor 1553 Encode BC Message
• Condor 1553 Select BM Message
Board Characteristics
Board name
Q104-1553
Manufacturer
GE Fanuc (formerly Condor Engineering)
Bus type
PC104
Multiple board support
Yes
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
23-79
23
GE Intelligent Platforms
Condor Q104-1553 Bus Controller Send
Condor Q104-1553 BC Send block for bus controller
Library
Simulink Real-Time Library for MIL-STD-1553
Description
This block sends a list of messages to the specified channel on the board. Before you
construct the list of messages:
1
Allocate space for the list with the Condor 1553 Create BC Message List block.
2
Fill in information about each message with Condor 1553 Encode BC Message
blocks.
Each instance of an Encode BC Message block fills in information for a single
message on the list. Daisy chain the Encode BC Message block L signals so the
Encode BC blocks execute before the Bus Controller Send block.
The Bus Controller Send block allocates a list for the reception of messages. This block
can:
• Read the set of messages and statuses from the last time a message was sent before
sending the new list.
• Send the new list and wait for a response.
In other words, for time step N, the output of the Send block is either the response to time
step N-1 or the response to time step N, chosen from the Response mode parameter.
Block Parameters
Channel
From the list of available channels on the board, choose 1, 2, 3, or 4. This channel is
initialized for this command stream.
23-80
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Condor Q104-1553 Bus Controller Send
Response mode
Choose from:
• Read response to previous message then send new message — Before
sending new messages, read the command buffers from the board.
• Send new message then wait and read response — Transmit new message,
and then wait for response before continuing.
Use the Maximum wait time (microseconds) parameter to set the amount of
time the block must wait for a response.
Maximum wait time (microseconds)
Enter the maximum time that this block waits for the message stream to be sent by
the board. If the Response mode parameter is set to Send new message then
wait and read response, use this parameter.
A reasonable maximum wait time is 1000 microseconds (1 millisecond). This value
must not exceed the sample time. Exceeding the sample time triggers an execution
overload.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
Base address
Enter the base address of the board. This entry must correspond to the DIP switch
setting on the board. For example, if the DIP switch setting is 300 (hexadecimal),
enter 0x300.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
23-81
23
GE Intelligent Platforms
Condor Q104-1553 Bus Monitor
Condor Q104-1553 Bus Monitor (BM) block
Library
Simulink Real-Time Library for MIL-STD-1553
Block Parameters
Channel
From the list of available channels on the board, choose 1, 2, 3, or 4. This channel is
initialized for this command stream.
Maximum number of messages to receive
Enter the maximum number of messages this block must read from the board.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
Base address
Enter the base address of the board. This entry must correspond to the DIP switch
setting on the board. For example, if the DIP switch setting is 300 (hexadecimal),
enter 0x300.
23-82
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Condor Q104-1553 Initialize
Condor Q104-1553 Initialize
Condor Q104-1553 Initialize block
Library
Simulink Real-Time Library for MIL-STD-1553
Block Parameters
Channel
From the list of available channels on the board, choose 1, 2, 3, or 4. This channel is
initialized for this command stream.
Initialize for Bus Controller operation
Select this check box to perform Bus Controller initialization for this channel.
Selecting this check box enables the parameters Number of Bus Controller
buffers to allocate, Enable retries, No response timeout (microseconds), and
Late response timeout (microseconds).
Number of Bus Controller buffers to allocate
Enter the number of buffers to allocate in onboard memory on the board. This
number must be greater than or equal to the longest string of command buffers
that the board is given to process.
Enable retries
Select this check box to enable automatic retries when a message times out or
has an error.
No response timeout (microseconds)
Enter the number of microseconds the board is to wait for a response from the
Remote Terminal. If the response from the Remote Terminal takes longer than
this timeout value, the board sets the NORESPONSE error condition in the
status returned from the command.
Late response timeout (microseconds)
Enter the number of microseconds the board is to wait for a response from the
Remote Terminal. If the response from the Remote Terminal takes longer than
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
23-83
23
GE Intelligent Platforms
this timeout value, the board sets the LATERESPONSE error condition in the
status returned from the command.
Initialize for Bus Monitor operation
Select this check box to initialize this channel for Bus Monitor operation. Selecting
this check box enables the parameters Monitor bus A, Monitor bus B, and
Number of monitor buffers to allocate.
Monitor bus A
Select this check box to monitor bus A. You can monitor either bus A, bus B, or
both.
Monitor bus B
Select this check box to monitor bus B. You can monitor either bus B, bus A, or
both.
Number of monitor buffers to allocate
Enter a number at least as large as the number of messages that you expect to
see between calls to the Bus Monitor block. If more messages arrive than there
are buffers, some messages are lost and not monitored.
Initialize for Remote Terminal operation
Select this check box to prepare the board to operate as a Remote Terminal. If you
select this check box, add the RT Initialize block to the model to initialize the Remote
Terminal. Connect the RT Initialize block for the Remote Terminal to the S output of
this block.
Selecting this check box enables the parameter RT address 31 is Broadcast.
RT address 31 is Broadcast
Select this check box to enable the board to see messages to Remote Terminal 31
as broadcast messages.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
Base address
Enter the base address of the board. This entry must correspond to the DIP switch
setting on the board. For example, if the DIP switch setting is 300 (hexadecimal),
enter 0x300.
23-84
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Condor Q104-1553 RT Initialize
Condor Q104-1553 RT Initialize
Condor Q104-1553 RT Initialize block
Library
Simulink Real-Time Library for MIL-STD-1553
Description
Add an RT Initialize block for each Remote Terminal address for which you want this
board to accept commands. Because each of these blocks must execute after the global
board initialization, connect the S input to either the:
• Main Condor Q104-1553 Initialize block for this board
• Another Condor Q104-1553 RT Initialize block that is connected to the main Condor
Q104-1553 Initialize block
This connection carries the channel number and PC104 base address.
Block Parameters
Remote Terminal
From the list, choose a Remote Terminal from 0 to 31. The remote terminal
number configured in RT Send and RT Receive must match that specified by the
corresponding RT Initialize block.
Connect to bus A
Select this check box to have this Remote Terminal listen on bus A. If a message can
come in on either bus, choose both A and B.
Connect to bus B
Select this check box to have this Remote Terminal listen on bus B. If a message can
come in on either bus, choose both A and B.
Initial status
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
23-85
23
GE Intelligent Platforms
Enter the value to which the board should initialize the status before it executes
commands. The board maintains a status word that it sends to the Bus Controller
after it executes a command.
Initial BIT word
Enter the initial value of the Built In Test (BIT) word. The Remote Terminal sends
this word in response to the Transmit BIT Word mode code.
Inhibit terminal flag
Select this check box to inhibit the Remote Terminal flag. This value is the initial
value of the Inhibit Terminal Flag bit. This value can be changed from the Bus
Controller with the Inhibit Terminal and Override Inhibit Terminal mode
codes. The terminal bit is one of the hardware-maintained bits in the status word.
Transmit sub addresses
Enter a vector of sub addresses to which this Remote Terminal must respond. These
sub addresses are the sub addresses that can transmit data when requested. Each
element of the vector must correspond to the corresponding element of the Legal
transmit message lengths vector. To enable the sub address for the Remote
Terminal, include the sub address in the vector.
A Remote Terminal accepts a message only if it has been directed to accept messages
of the same length. During initialization, the board must receive a list of valid
message lengths for each Remote Terminal number.
Legal transmit message lengths
Enter a vector of transmit message lengths. This vector is a vector of bit masks. Each
mask bit corresponds to a single message length. Construct the transmit message
length vector as follows:
• Each element of the vector corresponds to the corresponding element of the
Transmit sub addresses vector.
• Each element of the vector corresponds to the corresponding element of the Legal
receive message lengths. Failure to do so prevents the sub address on this
Remote Terminal from responding.
A message can have a length of from 1 to 32 words, selected by setting one or more
bits in a 32-bit mask.
23-86
Bit Position
Mask Value (hex)
Word Length (words)
0
0x00000001
32
1
0x00000002
1
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Condor Q104-1553 RT Initialize
Bit Position
Mask Value (hex)
Word Length (words)
2
0x00000004
2
30
0x40000000
30
31
0x80000000
31
...
• Use the hex2dec function to specify the bit mask in hexadecimal.
• The message length is expressed by bit position in the mask, not by mask value.
The value 0xffffffff enables all message lengths from 1 to 32.
• The board does not accept a message with a disallowed length. The board sends
an error to the Bus Controller by returning a status with the Message Error bit
set.
Receive sub addresses
Enter a vector of the sub addresses that can accept a receive message. Each element
of the vector must correspond to the corresponding element of the Legal receive
message lengths vector. To enable the sub address for the Remote Terminal,
include the sub address in the vector.
A Remote Terminal accepts a message only if it has been directed to accept messages
of the same length. During initialization, the board must receive a list of valid
message lengths for each Remote Terminal number.
Legal receive message lengths
Enter a vector of receive message lengths. This vector is a vector of bit masks. Each
bit corresponds to a single message length. Construct the receive message lengths
vector as follows:
• Each element of the vector corresponds to the corresponding element of the
Transmit sub addresses vector.
• Each element of the vector corresponds to the corresponding element of the
Receive sub addresses vector.
• Each element of the vector corresponds to the corresponding element of the Legal
transmit message lengths. Failure to do so prevents the sub address on this
Remote Terminal from responding.
A message can have a length of from 1 to 32 words, selected by setting one or more
bits in a 32-bit mask.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
23-87
23
GE Intelligent Platforms
Bit Position
Mask Value (hex)
Word Length (words)
0
0x00000001
32
1
0x00000002
1
2
0x00000004
2
30
0x40000000
30
31
0x80000000
31
...
• Use the hex2dec function to specify the bit mask in hexadecimal.
• The message length is expressed by bit position in the mask, not by mask value.
The value 0xffffffff enables all message lengths from 1 to 32.
• The board does not accept a message with a disallowed length. The board sends
an error to the Bus Controller by returning a status with the Message Error bit
set.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
23-88
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Condor Q104-1553 RT Receive
Condor Q104-1553 RT Receive
Condor Q104-1553 RT Receive block for remote terminal
Library
Simulink Real-Time Library for MIL-STD-1553
Note
Your model might have multiple Remote Terminal Receive blocks. To help you locate a
particular block, the Remote Terminal Receive block displays the number and address
parameters in the following format:
remote terminal-R-sub address-number of words
Remote terminal — Is the Remote Terminal parameter
R — Indicates receive command
Subaddress — Is the Sub address parameter
Number of words — Is the Number of words to receive parameter
A receive command for RT 1, sub address 3 to receive 2 words has the layout 1-R-3-2.
Block Parameters
Channel
From the list of available channels on the board, choose 1, 2, 3, or 4. This channel is
initialized for this command stream.
Remote Terminal
From the list, choose a Remote Terminal from 0 to 31. The remote terminal
number configured in RT Send and RT Receive must match that specified by the
corresponding RT Initialize block.
Sub address
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
23-89
23
GE Intelligent Platforms
From the list, choose a sub address from 0 to 31. Select the sub address for this
message.
Number of words to receive
Enter the number of 16-bit integers to receive as the data part of this message. This
number must be between 1 and 32. The output data vector has the same vector
width.
If this Remote Terminal or sub address can be sent messages with different lengths,
specify the longest message length for this parameter. You must determine how
much length is significant from content.
Enable timestamp output
Select this check box to cause output T to appear.
Output T returns the time, in microseconds, at which the most recent message was
received. The time is measured from the beginning of execution.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
Base address
Enter the base address of the board. This entry must correspond to the DIP switch
setting on the board. For example, if the DIP switch setting is 300 (hexadecimal),
enter 0x300.
23-90
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Condor Q104-1553 RT Send
Condor Q104-1553 RT Send
Condor Q104-1553 RT Send block for remote terminal
Library
Simulink Real-Time Library for MIL-STD-1553
Description
A Remote Terminal sends data only if it receives a transmit command from the Bus
Controller. This block prepares the board for the next transmit command on this channel,
Remote Terminal number, and sub address as specified by the Initialize and RT Initialize
blocks.
The data vector signal input to this block is copied to the board message buffer that
corresponds to the specified address. The input data vector must have the same length
as specified in the Number of words to send parameter. The input vector can be either
16- or 32-bit signed or unsigned data. The block sends only the bottom 16 bits of each
element.
Your model might have multiple Remote Terminal Send blocks. To help you locate a
particular block, the Remote Terminal Send block displays the number and address
parameters in the following format:
remote terminal-T-sub address-number of words
Remote terminal — Is the Remote Terminal parameter
T — Indicates transmit (or send) command
Subaddress — Is the Sub address parameter
Number of words — Is the Number of words to receive parameter
A transmit command for RT 1, sub address 3 to send 2 words has the layout 1-T-3-2.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
23-91
23
GE Intelligent Platforms
Block Parameters
Channel
From the list of available channels on the board, choose 1, 2, 3, or 4. This channel is
initialized for this command stream.
Remote Terminal
From the list, choose a Remote Terminal from 0 to 31. The remote terminal
number configured in RT Send and RT Receive must match that specified by the
corresponding RT Initialize block.
Sub address
From the list, choose a sub address from 0 to 31. Select the sub address for this
message.
Number of words to send
Enter the number of 16-bit integers to send as the data part of this message. This
number must be between 1 and 32. The input data vector must have the same vector
width.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
Base address
Enter the base address of the board. This entry must correspond to the DIP switch
setting on the board. For example, if the DIP switch setting is 300 (hexadecimal),
enter 0x300.
23-92
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Condor QPCI-1553
Condor QPCI-1553
Support for MIL-STD-1553 QPCI boards
Board
Condor QPCI-1553
General Description
The MIL-STD-1553 driver library allows Simulink Real-Time applications to connect to
a MIL-STD-1553 bus network to send and receive messages of up to 32 16-bit words. You
must be familiar with the MIL-STD-1553 standard.
The Simulink Real-Time block library supports the MIL-STD-1553 protocol with
QPCI-1553 boards. These boards connect a target computer to a MIL-STD-1553 data bus
via the high-density PCI (QPCI) bus.
The QPCI-1553 board is available with 1, 2, 3, or 4 channels as either a single function
or multifunction configuration. The multifunction version supports simultaneous use of
the Bus Controller, Bus Monitor, and Remote Terminal functions. The single function
version emits an error if more than one function is initialized. This board also supports a
loopback mode for testing. QPCI-1553 blocks support up to four channels for this board.
To support these boards, the block library provides the following driver blocks:
• Condor QPCI-1553 Bus Controller Send
• Condor QPCI-1553 Bus Monitor
• Condor QPCI-1553 Initialize
• Condor QPCI-1553 RT Initialize
• Condor QPCI-1553 RT Receive
• Condor QPCI-1553 RT Send
To format the Bus Controller messages, use the following utility blocks:
• Condor 1553 Create BC Message List
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
23-93
23
GE Intelligent Platforms
• Condor 1553 Decode BC Message
• Condor 1553 Decode BC Status
• Condor 1553 Encode BC Message
• Condor 1553 Select BM Message
Board Characteristics
23-94
Board name
QPCI-1553
Manufacturer
GE Fanuc (formerly Condor Engineering)
Bus type
QPCI
Multiple board support
Yes
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Condor QPCI-1553 Bus Controller Send
Condor QPCI-1553 Bus Controller Send
Condor QPCI-1553 BC Send block for bus controller
Library
Simulink Real-Time Library for MIL-STD-1553
Description
This block sends a list of messages to the specified channel on the board. Before you
construct the list of messages:
1
Allocate space for the list with the Condor 1553 Create BC Message List block.
2
Fill in information about each message with Condor 1553 Encode BC Message
blocks.
Each instance of an Encode BC Message block fills in information for a single
message on the list. Daisy chain the Encode BC Message block L signals so the
Encode BC blocks execute before the Bus Controller Send block.
The Bus Controller Send block allocates a list for the reception of messages. This block
can:
• Read the set of messages and statuses from the last time a message was sent before
sending the new list.
• Send the new list and wait for a response.
In other words, for time step N, the output of the Send block is either the response to time
step N-1 or the response to time step N, chosen from the Response mode parameter.
Block Parameters
Channel
From the list of available channels on the board, choose 1, 2, 3, or 4. This channel is
initialized for this command stream.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
23-95
23
GE Intelligent Platforms
Response mode
Choose from:
• Read response to previous message then send new message — Before
sending new messages, read the command buffers from the board.
• Send new message then wait and read response — Transmit new message,
and then wait for response before continuing.
Use the Maximum wait time (microseconds) parameter to set the amount of
time the block must wait for a response.
Maximum wait time (microseconds)
Enter the maximum time that this block waits for the message stream to be sent by
the board. If the Response mode parameter is set to Send new message then
wait and read response, use this parameter.
A reasonable maximum wait time is 1000 microseconds (1 millisecond). This value
must not exceed the sample time. Exceeding the sample time triggers an execution
overload.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
PCI slot (-1:autosearch)
If only one board of this type is in the target computer, enter -1 to locate the board.
If two or more boards of this type are in the target computer, enter the bus number
and the PCI slot number of the board associated with this driver block. Use the
format [BusNumber,SlotNumber].
To determine the bus number and the PCI slot number, type:
tg = slrt;
getPCIInfo(tg, 'installed')
23-96
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Condor QPCI-1553 Bus Monitor
Condor QPCI-1553 Bus Monitor
Condor QPCI-1553 Bus Monitor (BM) block
Library
Simulink Real-Time Library for MIL-STD-1553
Block Parameters
Channel
From the list of available channels on the board, choose 1, 2, 3, or 4. This channel is
initialized for this command stream.
Maximum number of messages to receive
Enter the maximum number of messages this block must read from the board.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
PCI slot (-1:autosearch)
If only one board of this type is in the target computer, enter -1 to locate the board.
If two or more boards of this type are in the target computer, enter the bus number
and the PCI slot number of the board associated with this driver block. Use the
format [BusNumber,SlotNumber].
To determine the bus number and the PCI slot number, type:
tg = slrt;
getPCIInfo(tg, 'installed')
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
23-97
23
GE Intelligent Platforms
Condor QPCI-1553 Initialize
Condor QPCI-1553 Initialize block
Library
Simulink Real-Time Library for MIL-STD-1553
Block Parameters
Channel
From the list of available channels on the board, choose 1, 2, 3, or 4. This channel is
initialized for this command stream.
Loopback enabled
Select this check box to route signals to the test bus on the board. This bus provides
a loopback connection between the four channels on the board that does not require
external wiring.
Coupling mode
From the list, select from Direct Coupling and Transformer Coupling. This
selection defines the mode for coupling a terminal device to the bus.
Initialize for Bus Controller operation
Select this check box to perform Bus Controller initialization for this channel.
Selecting this check box enables the parameters Number of Bus Controller
buffers to allocate, Enable retries, No response timeout (microseconds), and
Late response timeout (microseconds).
Number of Bus Controller buffers to allocate
Enter the number of buffers to allocate in onboard memory on the board. This
number must be greater than or equal to the longest string of command buffers
that the board is given to process.
Enable retries
Select this check box to enable automatic retries when a message times out or
has an error.
23-98
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Condor QPCI-1553 Initialize
No response timeout (microseconds)
Enter the number of microseconds the board is to wait for a response from the
Remote Terminal. If the response from the Remote Terminal takes longer than
this timeout value, the board sets the NORESPONSE error condition in the
status returned from the command.
Late response timeout (microseconds)
Enter the number of microseconds the board is to wait for a response from the
Remote Terminal. If the response from the Remote Terminal takes longer than
this timeout value, the board sets the LATERESPONSE error condition in the
status returned from the command.
Initialize for Bus Monitor operation
Select this check box to initialize this channel for Bus Monitor operation. Selecting
this check box enables the parameters Monitor bus A, Monitor bus B, and
Number of monitor buffers to allocate.
Monitor bus A
Select this check box to monitor bus A. You can monitor either bus A, bus B, or
both.
Monitor bus B
Select this check box to monitor bus B. You can monitor either bus B, bus A, or
both.
Number of monitor buffers to allocate
Enter a number at least as large as the number of messages that you expect to
see between calls to the Bus Monitor block. If more messages arrive than there
are buffers, some messages are lost and not monitored.
Initialize for Remote Terminal operation
Select this check box to prepare the board to operate as a Remote Terminal. If you
select this check box, add the RT Initialize block to the model to initialize the Remote
Terminal. Connect the RT Initialize block for the Remote Terminal to the S output of
this block.
Selecting this check box enables the parameter RT address 31 is Broadcast.
RT address 31 is Broadcast
Select this check box to enable the board to see messages to Remote Terminal 31
as broadcast messages.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
23-99
23
GE Intelligent Platforms
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
PCI slot (-1:autosearch)
If only one board of this type is in the target computer, enter -1 to locate the board.
If two or more boards of this type are in the target computer, enter the bus number
and the PCI slot number of the board associated with this driver block. Use the
format [BusNumber,SlotNumber].
To determine the bus number and the PCI slot number, type:
tg = slrt;
getPCIInfo(tg, 'installed')
23-100
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Condor QPCI-1553 RT Initialize
Condor QPCI-1553 RT Initialize
Condor QPCI-1553 RT Initialize block
Library
Simulink Real-Time Library for MIL-STD-1553
Description
Add an RT Initialize block for each Remote Terminal address for which you want this
board to accept commands. Because each of these blocks must execute after the global
board initialization, connect the S input to either the:
• Main Condor QPCI-1553 Initialize block for this board
• Another Condor QPCI-1553 RT Initialize block that is connected to the main Condor
QPCI-1553 Initialize block
This connection carries the channel number and PCI slot information.
Block Parameters
Remote Terminal
From the list, choose a Remote Terminal from 0 to 31. The remote terminal
number configured in RT Send and RT Receive must match that specified by the
corresponding RT Initialize block.
Connect to bus A
Select this check box to have this Remote Terminal listen on bus A. If a message can
come in on either bus, choose both A and B.
Connect to bus B
Select this check box to have this Remote Terminal listen on bus B. If a message can
come in on either bus, choose both A and B.
Initial status
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
23-101
23
GE Intelligent Platforms
Enter the value to which the board should initialize the status before it executes
commands. The board maintains a status word that it sends to the Bus Controller
after it executes a command.
Initial BIT word
Enter the initial value of the Built In Test (BIT) word. The Remote Terminal sends
this word in response to the Transmit BIT Word mode code.
Inhibit terminal flag
Select this check box to inhibit the Remote Terminal flag. This value is the initial
value of the Inhibit Terminal Flag bit. This value can be changed from the Bus
Controller with the Inhibit Terminal and Override Inhibit Terminal mode
codes. The terminal bit is one of the hardware-maintained bits in the status word.
Transmit sub addresses
Enter a vector of sub addresses to which this Remote Terminal must respond. These
sub addresses are the sub addresses that can transmit data when requested. Each
element of the vector must correspond to the corresponding element of the Legal
transmit message lengths vector. To enable the sub address for the Remote
Terminal, include the sub address in the vector.
A Remote Terminal accepts a message only if it has been directed to accept messages
of the same length. During initialization, the board must receive a list of valid
message lengths for each Remote Terminal number.
Legal transmit message lengths
Enter a vector of transmit message lengths. This vector is a vector of bit masks. Each
mask bit corresponds to a single message length. Construct the transmit message
length vector as follows:
• Each element of the vector corresponds to the corresponding element of the
Transmit sub addresses vector.
• Each element of the vector corresponds to the corresponding element of the Legal
receive message lengths. Failure to do so prevents the sub address on this
Remote Terminal from responding.
A message can have a length of from 1 to 32 words, selected by setting one or more
bits in a 32-bit mask.
23-102
Bit Position
Mask Value (hex)
Word Length (words)
0
0x00000001
32
1
0x00000002
1
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Condor QPCI-1553 RT Initialize
Bit Position
Mask Value (hex)
Word Length (words)
2
0x00000004
2
30
0x40000000
30
31
0x80000000
31
...
• Use the hex2dec function to specify the bit mask in hexadecimal.
• The message length is expressed by bit position in the mask, not by mask value.
The value 0xffffffff enables all message lengths from 1 to 32.
• The board does not accept a message with a disallowed length. The board sends
an error to the Bus Controller by returning a status with the Message Error bit
set.
Receive sub addresses
Enter a vector of the sub addresses that can accept a receive message. Each element
of the vector must correspond to the corresponding element of the Legal receive
message lengths vector. To enable the sub address for the Remote Terminal,
include the sub address in the vector.
A Remote Terminal accepts a message only if it has been directed to accept messages
of the same length. During initialization, the board must receive a list of valid
message lengths for each Remote Terminal number.
Legal receive message lengths
Enter a vector of receive message lengths. This vector is a vector of bit masks. Each
bit corresponds to a single message length. Construct the receive message lengths
vector as follows:
• Each element of the vector corresponds to the corresponding element of the
Transmit sub addresses vector.
• Each element of the vector corresponds to the corresponding element of the
Receive sub addresses vector.
• Each element of the vector corresponds to the corresponding element of the Legal
transmit message lengths. Failure to do so prevents the sub address on this
Remote Terminal from responding.
A message can have a length of from 1 to 32 words, selected by setting one or more
bits in a 32-bit mask.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
23-103
23
GE Intelligent Platforms
Bit Position
Mask Value (hex)
Word Length (words)
0
0x00000001
32
1
0x00000002
1
2
0x00000004
2
30
0x40000000
30
31
0x80000000
31
...
• Use the hex2dec function to specify the bit mask in hexadecimal.
• The message length is expressed by bit position in the mask, not by mask value.
The value 0xffffffff enables all message lengths from 1 to 32.
• The board does not accept a message with a disallowed length. The board sends
an error to the Bus Controller by returning a status with the Message Error bit
set.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
23-104
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Condor QPCI-1553 RT Receive
Condor QPCI-1553 RT Receive
Condor QPCI-1553 RT Receive block for remote terminal
Library
Simulink Real-Time Library for MIL-STD-1553
Note
Your model might have multiple Remote Terminal Receive blocks. To help you locate a
particular block, the Remote Terminal Receive block displays the channel number and
address parameters. The address display has the format:
remote terminal-R-sub address-number of words
Remote terminal — Is the Remote Terminal parameter
R — Indicates receive command
Subaddress — Is the Sub address parameter
Number of words — Is the Number of words to receive parameter
A receive command for RT 1, sub address 3 to receive 2 words has the layout 1-R-3-2.
Block Parameters
Channel
From the list of available channels on the board, choose 1, 2, 3, or 4. This channel is
initialized for this command stream.
Remote Terminal
From the list, choose a Remote Terminal from 0 to 31. The remote terminal
number configured in RT Send and RT Receive must match that specified by the
corresponding RT Initialize block.
Sub address
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
23-105
23
GE Intelligent Platforms
From the list, choose a sub address from 0 to 31. Select the sub address for this
message.
Number of words to receive
Enter the number of 16-bit integers to receive as the data part of this message. This
number must be between 1 and 32. The output data vector has the same vector
width.
If this Remote Terminal or sub address can be sent messages with different lengths,
specify the longest message length for this parameter. You must determine how
much length is significant from content.
Enable timestamp output
Select this check box to cause output T to appear.
Output T returns the time, in microseconds, at which the most recent message was
received. The time is measured from the beginning of execution.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
PCI slot (-1:autosearch)
If only one board of this type is in the target computer, enter -1 to locate the board.
If two or more boards of this type are in the target computer, enter the bus number
and the PCI slot number of the board associated with this driver block. Use the
format [BusNumber,SlotNumber].
To determine the bus number and the PCI slot number, type:
tg = slrt;
getPCIInfo(tg, 'installed')
23-106
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Condor QPCI-1553 RT Send
Condor QPCI-1553 RT Send
Condor QPCI-1553 RT Send block for remote terminal
Library
Simulink Real-Time Library for MIL-STD-1553
Description
A Remote Terminal sends data only if it receives a transmit command from the Bus
Controller. This block prepares the board for the next transmit command on this channel,
Remote Terminal number, and sub address as specified by the Initialize and RT Initialize
blocks.
The data vector signal input to this block is copied to the board message buffer that
corresponds to the specified address. The input data vector must have the same length
as specified in the Number of words to send parameter. The input vector can be either
16- or 32-bit signed or unsigned data. The block sends only the bottom 16 bits of each
element.
Your model might have multiple Remote Terminal Send blocks. To help you locate a
particular block, the Remote Terminal Send block displays the channel number and
address parameters. The address display has the format:
remote terminal-T-sub address-number of words
Remote terminal — Is the Remote Terminal parameter
T — Indicates transmit (or send) command
Subaddress — Is the Sub address parameter
Number of words — Is the Number of words to receive parameter
A transmit command for RT 1, sub address 3 to send 2 words has the layout 1-T-3-2.
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
23-107
23
GE Intelligent Platforms
Block Parameters
Channel
From the list of available channels on the board, choose 1, 2, 3, or 4. This channel is
initialized for this command stream.
Remote Terminal
From the list, choose a Remote Terminal from 0 to 31. The remote terminal
number configured in RT Send and RT Receive must match that specified by the
corresponding RT Initialize block.
Sub address
From the list, choose a sub address from 0 to 31. Select the sub address for this
message.
Number of words to send
Enter the number of 16-bit integers to send as the data part of this message. This
number must be between 1 and 32. The input data vector must have the same vector
width.
Sample time
Enter the base sample time or a multiple of the base sample time (-1 means sample
time is inherited).
PCI slot (-1:autosearch)
If only one board of this type is in the target computer, enter -1 to locate the board.
If two or more boards of this type are in the target computer, enter the bus number
and the PCI slot number of the board associated with this driver block. Use the
format [BusNumber,SlotNumber].
To determine the bus number and the PCI slot number, type:
tg = slrt;
getPCIInfo(tg, 'installed')
23-108
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Condor QPCX-1553
Condor QPCX-1553
Support for MIL-STD-1553 QPCX boards
Board
Condor QPCX-1553
General Description
The MIL-STD-1553 driver library allows Simulink Real-Time applications to connect to
a MIL-STD-1553 bus network to send and receive messages of up to 32 16-bit words. You
must be familiar with the MIL-STD-1553 standard.
The Simulink Real-Time block library supports the MIL-STD-1553 protocol with
QPCX-1553 boards. These boards connect a target computer to a MIL-STD-1553 data bus
via the high-density PCX (QPCX) bus.
The QPCX-1553 board is available with 1, 2, 3, or 4 channels as either a single function
or multifunction configuration. The multifunction version supports simultaneous use of
the Bus Controller, Bus Monitor, and Remote Terminal functions. The single function
version emits an error if more than one function is initialized. This board also supports a
loopback mode for testing. QPCX-1553 blocks support up to four channels for this board.
To support these boards, the block library provides the following driver blocks:
• Condor QPCX-1553 Bus Controller Send
• Condor QPCX-1553 Bus Monitor
• Condor QPCX-1553 Initialize
• Condor QPCX-1553 RT Initialize
• Condor QPCX-1553 RT Receive
• Condor QPCX-1553 RT Send
To format the Bus Controller messages, use the following utility blocks:
• Condor 1553 Create BC Message List
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
23-109
23
GE Intelligent Platforms
• Condor 1553 Decode BC Message
• Condor 1553 Decode BC Status
• Condor 1553 Encode BC Message
• Condor 1553 Select BM Message
Board Characteristics
23-110
Board name
QPCX-1553
Manufacturer
GE Fanuc (formerly Condor Engineering)
Bus type
QPCX
Multiple board support
Yes
www.MatlabSite.com | ‫ﻣﺘﻠﺐ ﺳﺎﯾﺖ‬
‫ﻣﺮﺟﻊ آﻣﻮزش ﺑﺮﻧﺎﻣﻪﻧﻮﯾﺴﯽ ﻣﺘﻠﺐ در اﯾﺮان‬
Condor QPCX-1553 Bus Controller Send
Condor QPCX-1553 Bus Controller Send
Condor QPCX-1553 BC Send block for bus controller
Library
Simulink Real-Time Library for MIL-STD-1553
Description
This block sends a list of messages to the specified channel on the board. Before you
construct the list of messages:
1
Allocate space for the list with the Condor 1553 Create BC Message List block.
2
Fill in information about each message with Condor 1553 Encode BC Message
blocks.
Each instance of an Encode BC Message block fills in information for a single
message on the list. Daisy-chain the Encode BC Message block L signals so the
Encode BC blocks execute before the Bus Controller Send block.
The Bus Controller Send block allocates a list for the reception of messages. This block
can:
• Read the set of messages and statuses from the last time a message was sent before
sending the new list.
• Send the new list and wait for a response.
In other words, for time step N, the output of the Send block is either the response to time
step N-1 or the response to time step N, chosen from the Response mod