Currently this demo is available in build 3.42.0.47392 only

Be sure you are using a supported version of Visual Studio. See Compatibility—Visual Studio.

Use this procedure to demonstrate creating a VMC, building it, and creating ports (harnessing). This demonstration shows a specific case of harnessing SIL. For more general information, see MxVMC - The Virtual MicroController.

1.In MxVDev, select Help->Copy Samples from the MxVDev main menu.

2.Select CruiseControlDemo from the list of samples, then click Copy and Close.

3.Create a new MxVDev project.

a.Create a new folder, GuidedDemo.

b.Select SIL. Do not check the boxes to include a sample project or start MxTransit.

NewProject-SIL

c.Click Finish.

4.Disconnect the Harness.

5.Start MxTransit.

6.Click on the VMC Transform to select it, then in the VMC Properties box (above the Launch Project verb), set the Auto Export Signals property to True.

7.Click the Launch Project verb (link) to open Visual Studio.

GHD-LaunchProject-marked

8.If a Retarget dialog similar to this is displayed, click OK, then ensure the Solution is selected in the Solution Explorer and click the Save button. See Retargeting a Visual Studio Solution.
 
Important: Click Save, not Save All.

ReTarget

9.In Windows Explorer, browse to MxSuiteSamples\CruiseControlDemo\VMC. This is the sample you copied in step 1.

10.Copy the Source folder (and its contents) to the \SUT subfolder in the GuidedDemo folder you created in step 3. This is the folder that contains the solution (.sln) file. After copying the path should be: \GuidedDemo\SUT\Source

11.The source code of the SIL must be added to the Visual Studio solution. In Visual Studio, right-click on Source and select Add->Existing Item...

GHD-AddExisting

12.Add the following files from the SUT\Source folder:

CruiseControl.c

CruiseControl.h

ledfuncs.h

ledfuncs.c

TargetInit.c

13.The SIL code must provide an initialization function. Add the following code to appif_sutfuncs.h before void SUT_Init(void):

#include "../Source/CruiseControl.h"

extern void TargetInit(void);

14.In the same file, inside SUT_Init, add:

TargetInit();

CruiseControlInit();

 

This is the function that is called during initialization.

15.The cyclic loop (main loop) of the SIL must include a cyclic function or a tick function. Inside SUT_Tick(), add the following code:

CruiseControlTick();

After entering the code, the appif_sutfuncs.h file should look like this:

GHD-appifsutfunc-marked

16.Build the solution.
 
The solution must build successfully before you can proceed. If the build has errors, see Using VMCs—Troubleshooting.

17.In MxTransit, click the Guided Harness verb in the VMC Transform's Properties box.

VMC-GuidedHarnessVerb-marked

18.Add the ports and select the appropriate properties.

GHD-SelectSignals

Adding and Defining Ports

Use the Add button to add the following ports and select their properties:

Name

Direction

Type

Mode/AutoTick Rate or
Init/Min/Max

SUT_Tick

Input

TaskInfo

Call Automatically, 50

ToggleCruiseOnRisingEdge

Input

Discrete

0, 0, 1

Speed_mph

Input

Continuous Floating Point

0, 0, 120

CCPedalPercent

Output

Continuous Floating Point

0, 0, 100

This image shows the dialog after the Signals above are selected and also shows the Properties fields for a Discrete Signal:

GHD-addingPorts

Task Signals

Task Signals are organized in a tree structure under the Functions node as shown below. The Mode option controls how the task is called. If Call From TestCase is selected, the task is controlled by a Event Signal in a TestCase. If Call Automatically is selected, you must also select the AutoTick Rate. The method (task) is invoked periodically at that rate while the test is running.

GHD-taskport

After you have selected the ports to harnessed and exported:

1.Click OK and wait for the rebuild to finish.

2.Save the Harness.

3.In MxVDev, connect the Harness.

4.You can use the Signals to create TestCases in MxVDev.

 

Related Topics:

Using VMCs

MxVMC - The Virtual MicroController