Anda di halaman 1dari 10

Creating a LabVIEW Project for the MCB2300

Create in new folder in the root directory of your home space (F drive) called MCB2300. This will be required later. Complete the following steps to create a project with an ARM target and a blank VI. 1. Launch LabVIEW and setup an ARM project Double click the LabVIEW 2009 icon on the desktop. The startup window below should appear.

Select launch LabVIEW. The LabVIEW getting started screen should appear as below.

In the bottom left hand corner of the Getting started screen under the Targets heading ensure ARM Project is selected and select Go. 1 AH 2009 V1.0

The screen should appear as below

Ensure the option New ARM project, Blank VI is selected and select next.

You must now select the target hardware. Select MCB2300 from the menu and press next to continue. The final setup screen shown overleaf will appear.

2 AH 2009 V1.0

Make sure the Run on simulator box is unchecked and select finish.

A prompt will appear as above. Select save. A further message prompt as shown below will appear.

You must now save your project and associated files. You must first save the project and then the program (VI) which is in the project.

a.

b.

(a) Save the project as ex1 make sure the Save as type is Projects (*.lvproj) and select ok. (b) You will now be asked to name the VI call this ex1 make sure the Save as type is Projects (*.lvproj) VIs (*.vi,*.vit) and select OK.

3 AH 2009 V1.0

The LabVIEW front panel and project explorer windows should now appear as below.

2 Creating your first program You will now write a simple program which toggles an LED on the evaluation board every 1 second. From the task bar select Window>>Show Block Diagram

The block Diagram will now appear. This is where we enter the programme.

Right click in the white space on the block diagram and the functions palette will appear. From the Programming>>structures menu select a flat sequence structure and drag this onto the block diagram.

4 AH 2009 V1.0

Right click on the outline of the flat sequence structure and select add frame after. The sequence structure should now be split into 2 sections. Resize the structure so the boxes are approximately equal as shown below.

Now add the VIs to switch on and off the LED. From the functions palette select ARM>>MCB2300>>LED>>MCB2300 turn LED on.vi and drag this into left hand side box of the sequence structure. Right-click the LED number (0-7) input on the MCB2300 turn LED on .VI and select CreateConstant from the shortcut menu. Enter a value of 1 into the blue constant box. Repeat this procedure for the right hand box using the MCB2300 turn LED off.vi. Your block diagram should appear as below.

Place a Wait Until Next ms Multiple function, located on the Programming>>Time, Dialog & Error palette, inside each section of the sequence structure. Right-click the millisecond multiple input and select CreateConstant from the shortcut menu. Enter 500 to wait 500 milliseconds between the execution of each sequence. Your block diagram should appear as shown on the next page.

5 AH 2009 V1.0

Place a While Loop, located on the Programming>>Structures palette, around sequence structure on the block diagram. While Loops repeat the inner subdiagram until the conditional terminal, which is an input terminal, receives a particular Boolean value. Right-click the conditional terminal in the lower right corner of the While Loop and select Create Constant from the shortcut menu. The default Boolean constant in the While Loop is FALSE. Your final diagram should appear as below.

3 Compiling and running your program Select the arrow (play icon) from the taskbar if prompted save your program. The code generation and compilation of your program should now start. This may take several minutes. If your program has no errors the program will be downloaded to the target hardware and automatically start running. A dialog box should appear showing the current status of the system. 6 AH 2009 V1.0

LED 1 on the MCB2300 boards should now be flashing.

LED1

7 AH 2009 V1.0

Lab 2 Reading the analogue input In this lab you will modify ex1.vi to also read the analogue input of the LPC2368. In the Project Explorer window right click on the MCB2300 icon and select New>>Elemental I/O as shown below

The new Elemental I/O window should appear. Open up the Analog Input selection menu by clicking on the + symbol to the left. Select AI0 and add this to the right panel by clicking the right arrow icon. Select OK to close the window.

8 AH 2009 V1.0

You must now add the analogue input to your block diagram. In the block diagram in the functions menu select ARM>>Elemental I/O >> Elemental I/O Node.vi. and place this within the while loop on the block diagram. Right click on the I/O item and select Elemental i/o>>Analog input>>AI0. On the front panel right click and the controls palette will appear. Select Graph Waveform Chart and place it on the front panel. Your front panel should appear similar to the screenshot below. You can resize the chart as and label the axes as necessary.

You must now connect the chart on the front panel to the Analogue input AI0 on the block diagram. On the block diagram place the Waveform chart terminal next to the Elemental I/O node and using the wiring tool connect the output AI0 to the input of the Waveform Chart terminal. Your block diagram should be similar to the one shown below.

9 AH 2009 V1.0

As in the previous example compile and run your program. Your program will now also read from ADC channel 0 and display the output on the front panel graph. AI0 (Analogue input 0) is physically connected to the potentiometer on the MCB2300 board. By rotating the potentiometer the voltage to AI0 will vary between 0 and 3.3V. The corresponding digital value will be displayed on the waveform chart.

Potentiometer connected to AI0

10 AH 2009 V1.0

Anda mungkin juga menyukai