Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • If you have followed the steps in the above linked FAQ exactly, then
    - add a BACnet object of type BACnet Calendar to the BACnet Server in the device tree
    - delete the exisiting BACnet Analog Value

  • Adapt the "PLC_PRG" as follows:


    Section


    Column
    width7

    Declaration


    Column
    width93


    Code Block
    themeConfluence
    
    VAR
    	xAddCalendar		: BOOL;
    	// API does not check dayOfweek!!! == >> DAY_OF_WEEK_UNSPECIFIED
    	bacDate				: CmpBACnet.IEC_BACNET_DATE := (year := 2020, month := 2, dayOfMonth := 7, dayOfWeek := CmpBACnet.IEC_BACNET_DAY_OF_WEEK.DAY_OF_WEEK_FRIDAY);
    	bacDate2			: CmpBACnet.IEC_BACNET_DATE := (year := 2020, month := 2, dayOfMonth := 14, dayOfWeek := CmpBACnet.IEC_BACNET_DAY_OF_WEEK.DAY_OF_WEEK_UNSPECIFIED);
    	bacDateStartRange	: CmpBACnet.IEC_BACNET_DATE := (year := 2020, month := 2, dayOfMonth := 17, dayOfWeek := CmpBACnet.IEC_BACNET_DAY_OF_WEEK.DAY_OF_WEEK_UNSPECIFIED);
    	bacDateEndRange		: CmpBACnet.IEC_BACNET_DATE := (year := 2020, month := 3, dayOfMonth := 25, dayOfWeek := CmpBACnet.IEC_BACNET_DAY_OF_WEEK.DAY_OF_WEEK_UNSPECIFIED);
    	
    	udiCnt				: UDINT;
    	xMatchCurDay		: BOOL;
    END_VAR
    
    






    Section


    Column
    width7

    Implementation


    Column
    width93


    Code Block
    themeConfluence
    BACnet_Calendar.GetEntryCount(count => udiCnt);
    xMatchCurDay := BACnet_Calendar.PresentValue;
    IF xAddCalendar THEN
    	xAddCalendar := FALSE;
    	BACnet_Calendar.AddBACnetDate(bacDat := bacDate);
    	BACnet_Calendar.AddBACnetDate(bacDat := bacDate2);
    	BACnet_Calendar.AddBACnetDateRange(bacStartDat := bacDateStartRange, bacEndDat := bacDateEndRange);
    END_IF
    
    








  • Download the project to the controller and set the xAddSchedulexAddCalendar variable to TRUE.
    If successful, the entry count for the BACnet Calendar will increase by three.







...