Most targets can read sensor data, steer actuators or communicate via other I/O facilities and buses (e.g. a CAN bus) with the environment. You have to connect the inputs and outputs of the model with the inputs and outputs of the selected target. An example is shown in the figure below. The model has two inputs (EncoderLoad and EncoderMotor) and one output (PWM). We have to choose the matching input and output of the target.
Connect the inputs and outputs of a model with the inputs and outputs of the target.
In the inputs list under Modelportname you will see a list of inputs.
1.Select one of the inputs (mouse pointer on top and click the left mouse button).
Now the Connect button will be active.
2.Click the Connect button.
The Connect dialog will appear. In this dialog you can select one out of a set of matching hardware inputs.
Use the Connect dialog to choose a matching hardware input or output.
3.Use the select component drop down box to select the type of hardware input to connect with.
If there is only one hardware input, the second drop down box will be empty. If there are multiple hardware inputs, you must specify in the <port> drop down box which port you want to connect. An example of an input component is an Analog to Digital (AD) converter. This converter could have 4 individual inputs (ports). To connect a model input to a particular AD channel, you need to select first the AD converter component and then the right port.
4.Use the <port> drop down box to connect the input to a specific port.
5.Click OK to close the Connect dialog.
In the inputs list you will see the model input and the connected hardware input. Under Modelportname will find the model inputs. Under Targetportname the connected hardware inputs are shown. Under Targetpins the physical address of the hardware outputs are shown (you can use this name to find the correct pin at the hardware layout).
The model input is now connected with a hardware input.
6.If you have multiple model inputs, you have to repeat these actions until all inputs are connected.
7.The model outputs have to be matched with hardware outputs in a similar way as the inputs.
8.When all inputs and outputs are connected, click the Apply button.
20-sim 4C will now extend the generated C-code with the target-specific C-code to couple the model inputs and output to the just selected hardware ports. The Connect button will change from orange into green . If an error occurs the Connect button will turn into red. The Process tab at the bottom of the window can be selected to view more detailed information.