Target Language Compiler    

"Hello World" Example with model.rtw File

Objective: What programming class would be complete without "Hello world"? In this exercise, you'll learn how to make simple modifications to grt.tlc to generate a separate output file containing your code for hello.c.

What benefit is there in this assignment? More advanced TLC programming applications may rely on your ability to generate a file. This example prepares you for virtually any auxiliary files.

Exercise

  1. There is a special generic real time file called grt_assign.tlc in matlabroot/toolbox/rtw/rtwdemos/tlctutorial/helloworld. Copy this file to grt.tlc and create the necessary code to create hello.c. You can run any model, for example, f14 or vdp from Simulink demo and, as long as you use your special version of grt.tlc, you will generate the file hello.c.
  2. Edit grt.tlc and make changes accordingly.
  3. Before you try to build, select the Generate code only check box on the Real-Time Workshop page, which allows you to generate the C code and the makefile.
  4. Now you can generate code and get the file hello.c.

 Solution Generating Auxiliary Files for Batch FTP