Resumen del contenido incluido en la página 1
TM
NI MATRIXx
TM
AutoCode Reference
AutoCode Reference
April 2007
370768C-01
Resumen del contenido incluido en la página 2
Support Worldwide Technical Support and Product Information ni.com National Instruments Corporate Headquarters 11500 North Mopac Expressway Austin, Texas 78759-3504 USA Tel: 512 683 0100 Worldwide Offices Australia 1800 300 800, Austria 43 662 457990-0, Belgium 32 (0) 2 757 0020, Brazil 55 11 3262 3599, Canada 800 433 3488, China 86 21 5050 9800, Czech Republic 420 224 235 774, Denmark 45 45 76 26 00, Finland 385 (0) 9 725 72511, France 33 (0) 1 48 14 24 24, Germany 49 89 7413130, India 91 80
Resumen del contenido incluido en la página 3
Important Information Warranty The media on which you receive National Instruments software are warranted not to fail to execute programming instructions, due to defects in materials and workmanship, for a period of 90 days from date of shipment, as evidenced by receipts or other documentation. National Instruments will, at its option, repair or replace software media that do not execute programming instructions if National Instruments receives notice of such defects during the warranty per
Resumen del contenido incluido en la página 4
Conventions The following conventions are used in this manual: <> Angle brackets that contain numbers separated by an ellipsis represent a range of values associated with a bit or signal name—for example, DIO<3..0>. » The » symbol leads you through nested menu items and dialog box options to a final action. The sequence File»Page Setup»Options directs you to pull down the File menu, select the Page Setup item, and select Options from the last dialog box. This icon denotes a note, which aler
Resumen del contenido incluido en la página 5
Contents Chapter 1 Introduction Manual Organization .....................................................................................................1-1 General Information.......................................................................................................1-2 Configuration File..........................................................................................................1-2 Language-Specific Information ...........................................................
Resumen del contenido incluido en la página 6
Contents Linking Procedures with Real-Time Applications or Simulator .................... 2-22 Invoking Generated Procedures Directly.......................................... 2-22 Invoking Procedures Using Generated UCB Wrapper Function...... 2-24 Invoking Procedures Using Generated Subsystem Function ........... 2-25 C Fixed-Point Arithmetic .............................................................................................. 2-26 Fixed-Point AutoCode/C Implementation ................
Resumen del contenido incluido en la página 7
Contents External_Input ( ) Procedure.............................................................3-10 External_Output( ) Procedure ...........................................................3-11 UserCode Blocks ...........................................................................................................3-11 Linking Handwritten UCBs with AutoCode Applications..............................3-11 Calling UCBs..............................................................................
Resumen del contenido incluido en la página 8
Contents Chapter 4 Generating Code for Real-Time Operating Systems Real-Time Operating System Configuration File.......................................................... 4-1 Configuration Items ........................................................................................ 4-2 Table Syntax ................................................................................................... 4-2 Table Naming Convention................................................................ 4-3 Tab
Resumen del contenido incluido en la página 9
Contents System External Interface Layer .....................................................................5-7 Discrete Subsystem Interface Layer................................................................5-8 Single-Rate System...........................................................................5-8 Multi-Rate System ............................................................................5-8 Sample and Hold..........................................................................
Resumen del contenido incluido en la página 10
Contents States ............................................................................................................... 5-26 Local Variables and Phases .............................................................. 5-27 Discrete Semantics ........................................................................... 5-27 Continuous Semantics ...................................................................... 5-29 Looping Concepts ..........................................................
Resumen del contenido incluido en la página 11
Contents Definitions and Conventions ...........................................................................5-45 Shared Memory Fixed-Point Callouts in AutoCode/C .....................5-46 Shared Variable Block Support.......................................................................5-47 Shared Memory Callout Option........................................................5-50 Global Variable Block Callouts.......................................................................5-51 Callout
Resumen del contenido incluido en la página 12
Contents Chapter 7 Code Optimization Read from Variable Blocks ........................................................................................... 7-1 Restart Capability .......................................................................................................... 7-5 Merging INIT Sections.................................................................................................. 7-8 Reuse of Temporary Block Outputs.......................................................
Resumen del contenido incluido en la página 13
Contents Variable Block Aliasing....................................................................9-4 Monitored Signals within a Procedure SuperBlock..........................9-4 Monitoring Procedure External Outputs ...........................................9-4 Parameterless Procedure ................................................................................................9-5 Specifying Parameterless Procedure Interface ................................................9-5 Input Specifi
Resumen del contenido incluido en la página 14
1 Introduction This manual provides reference material for using AutoCode to write production quality code using graphical tools. Together with the AutoCode User Guide and the Template Programming Language User Guide, AutoCode documentation describes how to generate robust, high-quality, real-time C or Ada source code from SystemBuild block diagrams. Manual Organization This manual includes the following chapters: � Chapter 1, Introduction, provides an overview of the rapid prototyping con
Resumen del contenido incluido en la página 15
Chapter 1 Introduction � Chapter 8, AutoCode Sim Cdelay Scheduler, discusses the Sim Cdelay low-latency scheduler. � Chapter 9, Global Scope Signals and Parameterless Procedures, discusses additional signals and procedures. This guide also has an Index. General Information As an integral part of the rapid prototyping concept, AutoCode lets you generate high-level language code from a SystemBuild block diagram model quickly, automatically, and without programming skills. The AutoCode User Gu
Resumen del contenido incluido en la página 16
Chapter 1 Introduction Structure and Content of the Generated Code This reference includes detailed descriptions about what is generated for many of the blocks used within a model. Also, the framework of the generated code is discussed to show how all of the pieces work together to form an executable simulation. This discussion is only relevant to those designers who are either writing their own templates or who are striving to optimize the generated code. Topics include the following: � G
Resumen del contenido incluido en la página 17
Chapter 1 Introduction Related Publications National Instruments provides a complete library of publications to support its products. In addition to this guide, publications that you may find particularly useful when using AutoCode include the following: • AutoCode User Guide � Template Programming Language User Guide � Xmath User Guide � SystemBuild User Guide � BlockScript User Guide � DocumentIt User Guide For additional documentation, refer to the MATRIXx Help or visit the National Instru
Resumen del contenido incluido en la página 18
2 C Language Reference This chapter discusses files used to interface AutoCode and the generated C code to your specific platform and target processor. This chapter also describes target-specific utilities needed for simulation and testing. Stand-Alone Simulation The template provided for C code generation produces code that, when compiled and linked with stand-alone files, forms a stand-alone simulation. This simulation can be executed with MATRIXx-style data as input, and produces results
Resumen del contenido incluido en la página 19
Chapter 2 C Language Reference Table 2-1. Recognized C Preprocessor Defines for Supported Platforms Platform Preprocessor Define Compiler Switch -DIBM AIX (IBM UNIX) IBM -DOSF1 Compaq Tru64 5.0 OSF1 -DHP700 HPUX (700 series) HP700 -DHP HPUX (other than 700) HP -DSGI SGI IRIX SGI -DSOLARIS Sun Solaris 2.x SOLARIS -DMSWIN32 Windows 2000/NT/9x MSWIN32 Stand-Alone Library This section describes the system-specific and target-specific stand-alone (sa) files supplied with your system. System-Specif
Resumen del contenido incluido en la página 20
Chapter 2 C Language Reference Table 2-2. Distribution Directories and Files (Continued) Platform UNIX Windows $CASE/ACC/templates %CASE%\ACC\templates Templates Directory: c_sim.tpl, c_sim.tpl, Templates: c_intgr.tpl c_intgr.tpl Direct Access c_sim.dac c_sim.dac Templates: $XMATH/demos %XMATH%\demos Demos Directory: � The principal file is sa_utils.c, the stand-alone utilities file. At the time that you compile sa_utils.c and your generated code program, you must make the following hea