Display

Description

Using the display functions it is possible to output texts to the front display of the controller (FC_DisplayLineWrite(), FC_DisplayMessageWrite() ) or to delete characters from the display (FC_DisplayClear(), FC_DisplayClearLine() ). For this purpose, a specific mode is available (ET_DisplayModeSelect.IecMode), which can be activated by using the function FC_DisplayModeSet().

In the default setting, the system is in DISPLAY_SYSTEM_MODE. In this mode, only the PacDrive firmware has write access to the display. The currently set mode can also be queried by using the function FC_DisplayModeGet(). During a program reset, the mode setting switches automatically to standard mode.

If the display is not modified during call-up, that is, if a write function is called, but the text is not different from the text shown on the display, the text in the display is not affected and the function FC_DisplayRefreshed() immediately returns TRUE.

The display functionality of the controller may only be used after the boot process of the controller has been completed.

NOTE: Use the function FC_GetPacDriveBootState() to ensure that the boot procedure for the PacDrive controller has been completed.

With the boot process completed, the output is effected asynchronously to the task calling. If the display functions are already called in advance (FC_GetPacDriveBootState() = 0), a synchronous output is effected. That is, the task is decelerated for the duration of the processing time of the display output. Due to slow processing, this may take up to one second in the case of the controllers.

The following functions are affected:

oFC_DisplayClear()

oFC_DisplayClearLine()

oFC_DisplayLineWrite()

oFC_DisplayMessageWrite()

oFC_DisplayModeSet()

oFC_DisplayRefreshed()

Example

 PROGRAM SRC_Display
VAR
   diState : DINT := 0;  (*State*)
   sDisplayMessage : STRING(80) := 'Test'; (*display-message*)
   diResult : DINT := 0;  (*Result of the display functions*)
   diResultDisplayRefreshed : DINT := 0;  (*Result of the DisplayRefreshed-function*)
   xDisplayStatus : BOOL := FALSE;  (*Display refreshed?*)
   xError : BOOL := FALSE;  (*Error*)
   xEnableWriteDisplayMessage : BOOL := FALSE;  (*enable writing the DisplayMessage*)
   xEnableClearDisplay : BOOL := FALSE;  (*enable clearing the display*)
END_VAR
CASE diState OF
0 :  (*Wait on PacDrive Controller ready*)
   IF FC_GetPacDriveBootState()=1 THEN
      diState := diState + 1;
   END_IF;
1 :  (*Wait on user input*)
   IF xEnableWriteDisplayMessage THEN
      diState := diState + 1;
   END_IF
   IF xEnableClearDisplay THEN
      diState := diState + 1;
   END_IF
2 :  (*Actual Display-mode?*)
   IF (FC_DisplayModeGet() = ET_DisplayModeSelect.IecMode) THEN
      diState := diState + 2;
   ELSE
      diState := diState + 1;
   END_IF
3 :  (*Switch on IEC-Mode*)
   IF( FC_DisplayModeSet(ET_DisplayModeSelect.IecMode) = 0) THEN
      diState := diState + 1;
   END_IF
4 :  (*Write or Clear Display*)
   IF xEnableWriteDisplayMessage THEN
      diResult := DisplayMessageWrite(1, 1, sDisplayMessage, TRUE);
      xEnableWriteDisplayMessage := FALSE;
      diState := diState + 1;
   END_IF
   IF xEnableClearDisplay THEN
      diResult := FC_DisplayClear();
      xEnableClearDisplay := FALSE;
      diState := diState + 1;
   END_IF
5 :  (*Display refreshed?*)
   diResultDisplayRefreshed := DisplayRefreshed(xDisplayStatus);
   IF( (diResultDisplayRefreshed = 0) AND ( xDisplayStatus = TRUE) ) THEN
      diState := diState + 1;
   END_IF
6 : IF(diResult <> 0) THEN
      xError := TRUE;
      diState := 10;
   ELSE
      diState := 1;
   END_IF
10:  (*error state*)
   ;  (*do nothing*)
END_CASE