Creating the PLC project
- 1. Right click to PLC and select Add New Item.
- 2. Select Standard PLC Project and name the project.
- 3. Right click to References and select Add Library to add libraries to a PLC project.
- 4. Select the library Tc3_BACnetRev14.
- 5. Double click the POU MAIN in the PLC project.
- 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.
- Alternatively, you can also call this function by right-clicking on the project name.
- 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.
- 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.
- 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.
- 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.
- 14. Activate the project using the function Activate Configuration in the TwinCAT menu.
- Alternatively this function is also available in the TwinCAT toolbar.
- 15. Check that the correct target system is selected and click OK.
- 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.
- 16. Enter the 5 letters from the upper field into the lower field.
The entry is case sensitive. - 17. To complete this process, TwinCAT requests a restart of the PLC. Click OK.
If you enter the text rev14 in the full-text search field, only this library will be displayed. Select this item and 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.