Introductin Tools

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 15

CHAPTER 6 6.0 INTRODUCTION TO TOOLS 6.1 INTRODUCTION TO MATLAB 6.1.2 CREATING A GUI IN MATLAB 6.2 INTRODUCTION TO VISUAL BASIC6.

0 6.2.1 WHAT IS VISUAL BASIC? 6.2.2 SOME FEATURE OF VISUAL BASIC 6.2.3 VISUAL BASIC 6.0 VERSUS OTHER VERSIONS OF VISUAL BASIC 6.3 INTRODUCTION TO FPGAKIT 6.3.1 SPARTAN-3E FPGA FEATURES AND EMBEDDED PROCESSING FUNCTIONS 6. 3.2 KEY COMPONENTS AND FEATURES 6.4 INTRODUCTION TO EDK TOOL 6.4.1 EDK8.1MICROBLAZE TUTORIAL IN SPARTAN 3E 6.4.2 OBJECTIVES 6.4.2.1 DEFINING THE HARDWARE DESIGN(XPS) 6.4.3 SYSTEM REQUIREMENT 6.4.4 MICROBLAZE SYSTEM DESCRIPTION 6.4.5 SETUP 6.5 CREATING THE PROJECT FILE IN XPS 6.5.1 HOW CAN USE XPS TO CREATE THE FOLLOWING FILES 6.5.2 STARTING XPS 6.5.3MHS AND MPD 6.5.3.1 MHS 62 62 64 64 64 64 64 64 64 66 66 67 67 67 59 61 53 53 54 58 58 58

6.5.3.2 MPD 6.6 USING THE BASE SYSTEM BUILDER WIZARD

68 68

CHAPTER -6
6.0 INTRODUCTION TO TOOLS 6.1 INTRODUCTION TO MATLAB
MATLAB is a software package for computation in engineering, science, and applied mathematics. It offers a powerful programming language, excellent graphics, and a wide range of expert knowledge. MATLAB is published by and a trademark of The Math Works, Inc. The focus in MATLAB is on computation, not mathematics: Symbolic expressions and manipulations are not possible (except through the optional Symbolic Toolbox, a clever interface to Maple). All results are not only numerical but inexact, thanks to the rounding errors inherent in computer arithmetic. The limitation to numerical computation can be seen as a drawback, but it is a source of strength too: MATLAB is much preferred to Maple, Mathematica, and the like when it comes to numerics. On the other hand, compared to other numerically oriented languages like C++ and FORTRAN, MATLAB is much easier to use and comes with a huge standard library.1 The unfavorable comparison here is a gap in execution speed. This gap is not always as dramatic as popular lore has it, and it can often be narrowed or closed with good MATLAB programming. Moreover, one can link other codes into MATLAB, or vice versa, and MATLAB now optionally supports parallel computing. Still, MATLAB is usually not the tool of choice for maximum-performance computing. The MATLAB niche is numerical computation on workstations for non-experts in computation. This is a huge nicheone way to tell is to look at the number of MATLAB-related books on mathworks.com. Even for supercomputer users, MATLAB can be a valuable environment in which to explore and fine-tune algorithms before more laborious coding in another language. Most successful computing languages and environments acquire a distinctive character or

culture. In MATLAB, that culture contains several elements: an experimental and graphical bias, resulting from the interactive environment and compression of the write-compile-link-execute analyze cycle; an emphasis on syntax that is compact and friendly to the interactive mode, rather than tightly constrained and verbose; a kitchen-sink mentality for providing functionality; and a high degree of openness and transparency (though not to the extent of being open source software). 6.1.2 CREATING A GUI IN MATLAB One of the major comments that we hear about Matlab is "I don't know how I can use it in my classroom. It is too hard for my students to use." This may be a correct comment - we don't necessarily want the students to construct a model from scratch in Matlab, but would want them to use a previously prepared model. We can do this using Input and disp statements in a M-file which is run from the Matlab window. A much better way is to use a Graphical User Interface (GUI) where the student just "fills in the blanks" and all of the Matlab commands are completely hidden from the student. Creating GUI's in Matlab Version 7 is significantly easier than in previous versions of the program. In particular, the guide program allows one to easily place controls onto a model and set their properties. In the following exercise, we will construct a GUI which will create RESET button.

The Example Files and Code:

First, download the GUI skeleton here. Unzip the files and place them wherever you please. 1. Now, type guide at the command prompt.

2. Choose to open the sample GUI by clicking on Open Existing GUI. Click on Browse to locate where you saved the GUI files.

3. Here is what the GUI should look like when you open it:

4. Next, we must allow the GUI to run multiple instances. Go to the Tools tab, and then to GUI Options. Disable the following option as shown:

5. Click on the icon on the GUI figure to bring up the accompanying .m file.

6. Find the reset_Callback and add the following code

7. closeGUI = handles.figure1; %handles.figure1 is the GUI figure 8. guiPosition = get(handles.figure1,'Position'); %get the position of the GUI 9. guiName = get(handles.figure1,'Name'); %get the name of the GUI 10. eval(guiName) %call the GUI again 11. close(closeGUI); %close the old GUI set(gcf,'Position',guiPosition); %set the position for the new GUI 12. Now run the GUI and test it out! You should see a brief flicker when you reset GUI, as a new GUI is being opened while the old one is closed. the

6.2 INTRODUCTION TO VISUAL BASIC 6.0

6.2.1WHAT IS VISUAL BASIC?


Visual Basic is a tool that allows you to develop Windows (Graphic User Interface - GUI) applications. The applications have a familiar appearance to the user. Visual Basic is event-driven, meaning code remains idle until called upon to respond to some event (button pressing, menu selection , ...). Visual Basic is governed by an event processor. Nothing happens until an event is detected. Once an event is detected, the code corresponding to that event (event procedure) is executed. Program control is then returned to the event processor. 6.2.2 SOME FEATURES OF VISUAL BASIC Full set of objects - you 'draw' the application Lots of icons and pictures for your use Response to mouse and keyboard actions Clipboard and printer access Full array of mathematical, string handling, and graphics functions Can handle fixed and dynamic variable and control arrays

Sequential and random access file support Useful debugger and error-handling facilities Powerful database access tools ActiveX support Package & Deployment Wizard makes distributing your applications 6.2.3 VISUAL BASIC 6.0 VERSUS OTHERVERSIONS OF VISUAL BASIC The original Visual Basic for DOS and Visual Basic For Windows were introduced in 1991. Visual Basic 3.0 (a vast improvement over previous versions) was released in 1993. Visual Basic 4.0 released in late 1995 (added 32 bit application support). Visual Basic 5.0 released in late 1996. New environment, supported creation of ActiveX controls, deleted 16 bit application support. And, now Visual Basic 6.0 - some identified new features of Visual Basic 6.0: Faster compiler New ActiveX data control object Allows database integration with wide variety of applications New data report designer New Package & Deployment Wizard Additional internet capabilities The Form Window is central to developing Visual Basic applications. It is where you draw your application.

The Toolbox is the selection menu for controls used in your application. The Properties Window is used to establish initial property values for objects. The drop-down box at the top of the window lists all objects in the current form. Two views are available: Alphabetic and Categorized. Under this box are the available properties for the currently selected object. The Form Layout Window shows where (upon program execution) your form will be displayed relative to your monitors screen: The Project Window displays a list of all forms and modules making up your application. You can also obtain a view of the Form or Code windows (window containing the actual Basic coding) from the Project window. As mentioned, the user interface is drawn in the form window. There are two ways to place controls on a form: 1. Double-click the tool in the toolbox and it is created with a default size on the form. You can then move it or resize it. Click the tool in the toolbox, then move the mouse pointer to the form window. The cursor changes to a crosshair. Place the crosshair at the upper left corner of where you want the control to be, press the left mouse button and hold it down while dragging the cursor toward the lower right corner. When you release the mouse button, the control is drawn.

To move a control you have drawn, click the object in the form window and drag it to the new location. Release the mouse button. To resize a control, click the object so that it is select and sizing handles appear. Use these handles to resize the object.

5.2.1 EDK 10.1 Micro Blaze Tutorial in Spartan 3E Objectives: This tutorial will demonstrate process of creating and testing a MicroBlaze system design using the Embedded Development Kit (EDK). EDK is the combination of software and hardware by the name of embedded. EDK itself contains two parts 1. Xilinx Platform Studio (XPS) 2. Software Development Kit (SDK) 5.2.1.1 Defining the Hardware Design (XPS) The tutorial contains these sections: System Requirements MicroBlaze System Description Tutorial Steps The following steps are described in this tutorial:

Starting XPS Using the Base System Builder Wizard Create Import IP Peripheral Design Modification using Platform Studio Implementing the Design Defining the Software Design Downloading the Design Debugging the Design Performing Behavioral Simulation of the Embedded System 6.4.3 System Requirements: You must have the following software installed on your PC to complete this tutorial: Windows 2000 SP2/Windows XP EDK 8.1i or later ISE 8.1i sp1 or later In order to download the completed processor system, you must have the following hardware: Xilinx Spartan-3 Evaluation Board (3S200 FT256 -4) Xilinx Parallel -4 Cable used to program and debug the device Serial Cable 6.4.4 MicroBlaze System Description: In general, to design an embedded processor system, you need the following: Hardware components

Memory map Software application Tutorial Design Hardware The MicroBlaze (MB) tutorial design includes the following hardware components: MicroBlaze Local Memory Bus (LMB) Bus LMB_BRAM_IF_CNTLR BRAM_BLOCK On-chip Peripheral Bus (OPB) BUS OPB_MDM OPB_UARTLITE 3 - OPB_GPIOs OPB_EMC 6.4.5 Setup: Spartan-3 board with a RS-232 terminal connected to the serial port and configured for 57600 baud, with 8 data bits, no parity and no handshakes. 6.5 Creating the Project File in XPS The first step in this tutorial is using the Xilinx Platform Studio (XPS) to create a project file. XPS allows you to control the hardware and software development of the Micro Blaze system, and includes the following: An editor and a project management interface for creating and editing source code Software tool flow configuration options

6.5.1 You can use XPS to create the following files: Project Navigator project file that allows you to control the hardware implementation flow Microprocessor Hardware Specification (MHS) file Microprocessor Software Specification (MSS) file XPS supports the software tool flows associated with these software specifications. Additionally, you can use XPS to customize software libraries, drivers, and interrupt handlers, and to compile your programs. 6.5.2 Starting XPS To open XPS, select Start Programs Xilinx Platform Studio 8.1i Xilinx Platform Studio Select Base System Builder Wizard (BSB) to open the Create New Project Using BSB Wizard dialog box shown in Figure 1. Click Ok. Use the Project File Browse button to browse to the folder you want as your project directory. Click Open to create the system.xmp file then Save. Click Ok to start the BSB wizard. Note: XPS does not support directory or project names which include spaces. 6.5.3 MHS and MPD Files The next step in the tutorial is defining the embedded system hardware with the Microprocessor Hardware Specification (MHS) and Microprocessor Peripheral Description (MPD) files. 6.5.3.1 MHS File The Microprocessor Hardware Specification (MHS) file describes the following:

Embedded processor: either the soft core Micro Blaze processor or the hard core PowerPC (only available in Virtex-II Pro and Virtex-4 FX devices) Peripherals and associated address spaces Buses Overall connectivity of the system The MHS file is a readable text file that is an input to the Platform Generator (the hardware system building tool). Conceptually, the MHS file is a textual schematic of the embedded system. To instantiate a component in the MHS file, you must include information specific to the component. 6.5.3.2 MPD File Each system peripheral has a corresponding MPD file. The MPD file is the symbol of the embedded system peripheral to the MHS schematic of the embedded system. The MPD file contains all of the available ports and hardware parameters for a peripheral. The tutorial MPD file is located in the following directory: $XILINX_EDK/hw/XilinxProcessorIPLib/pcores/<peripheral name>/data EDK provides two methods for creating the MHS file. Base System Builder Wizard and the did/Edit Cores Dialog assist you in building the processor system, which is defined in the MHS file. This tutorial illustrates the Base System Builder. 6.6 Using the Base System Builder Wizard Use the following steps to create the processor system: In the Base System Builder Select I would like to create a new design then click Next. In the Base System Builder - Select Board Dialog select the following, as shown in Figure 2: Board Vendor: Xilinx Board Name: Spartan-3E

Board Version: C, D. To debug the design, follow these steps: In XPS select Debug-> XMD debug Options. The XMD Debug Options dialog box allows the user to specify the connections type and JTAG chain Definition . The connection types are available for Micro Blaze:Simulator enables XMD to connect to the Micro Blaze ISS Hardware enables XMD to connect to the MDM peripheral in the hardware Stub enables XMD to connect to the JTAG UART or UART via XMDSTUB Virtual platform enables a virtual (c model) to be used Verify that Hardware is selected
Select Save

Select Debug -> Launch XMD

You might also like