Creating the PLC project

1. Right click to PLC and select Add New Item.
Creating the PLC project 1:
2. Select Standard PLC Project and name the project.
Creating the PLC project 2:
3. Right click to References and select Add Library to add libraries to a PLC project.
Creating the PLC project 3:
4. Select the library Tc3_BACnetRev14.
Creating the PLC project 4:

If you enter the text rev14 in the full-text search field, only this library will be displayed. Select this item and click OK.

Creating the PLC project 5:
5. Double click the POU MAIN in the PLC project.
Creating the PLC project 6:
6. Add the following declaration in the variable window: fbAv : FB_BACnet_AV,
This command creates an instance of the function block FB_BACnet_AV with the name fbAv (which represents an Analog Value object).
7. Add the following entry to the code window: fbAv();
This code is called at regular intervals according to the cycle time (default: 10 ms).
8. Build the project by selecting Build / Build Solution.
Creating the PLC project 7:
Alternatively, you can also call this function by right-clicking on the project name.
Creating the PLC project 8:
9. Check if the build was successful and no error is displayed. If errors are displayed, check the project and correct the errors.
10. After successful compilation the variable Tc3_BACnetRev14.BACnet_Globals.DefaultAdapter.BACnet_AmsNetId is displayed in the process image.
Creating the PLC project 9:

Creating the PLC project 10:
This variable is used to establish the BACnet connection between the PLC program and the BACnet adapter.
11. Right click to this variable and select Change Link.
Creating the PLC project 11:
12. Select the variable of the same type in the BACnet adapter and create a link with OK.
The connection is indicated by a connection icon.
Creating the PLC project 12:
Creating the PLC project 13:
13. You can check the link at any time with the function Go To Link Variable.
Using this function, the cursor moves to the connected variable.

Creating the PLC project 14:

Creating the PLC project 15:
14. Activate the project using the function Activate Configuration in the TwinCAT menu.
Creating the PLC project 16:
Alternatively this function is also available in the TwinCAT toolbar.
Creating the PLC project 17:
15. Check that the correct target system is selected and click OK.
Creating the PLC project 18:
If no licenses are available on the target system, so-called trial licenses can be generated. Trial licenses are valid for a period of 7 days. The Beckhoff Information System provides further information on TwinCAT licensing.
Creating the PLC project 19:
16. Enter the 5 letters from the upper field into the lower field.
The entry is case sensitive.
Creating the PLC project 20:

Creating the PLC project 21:
17. To complete this process, TwinCAT requests a restart of the PLC. Click OK.
With these few and simple steps, a fully functional BACnet server was created. The server and the contained objects are now available in the BACnet network.