Home

Profibus

Net Theory

Service

Products

Download Docu

EC32

RTC-32

SMB New

New: Preventive Maintenance Issues

Support New

Disclaimer


RTOS-32


Statistic

Private

Translate

 


ICS

Industrielle Automatisierungssysteme GmbH

 
           
Home News Products Company Profile EC32-Info Download Contact
 

Renumbering the trace location fields in all software source files automatically

If you follow the recommended strategy for the trace messages, which shows the exact place from where an event was triggered within the source code, you will need the following source in your program code:

At each location where you want to set a flag for a status machine use the call:

function      macro       channel-ID    flag-ID                  location

 DoCmd_A(__FILE__, CHANGD_A, SHOW_STATUS, 1000);

In the include file you need at least:

  • The corresponding flag definitions:

#define SHOW_STATUS  0
#define SHOW_MESSAGE 1
#define EDIT_PKN     2
#define SHOW_HELP    3
#define SHOW_FIFO    4
#define SHOW_LOG     5
#define GD_ED_A      6
#define GD_ED2_A     7
#define SHOW_CPULOAD 8

  • The channel-ID definitions:

#define CHANPMON_D1 0
#define CHANPMON_LZ 1
#define CHANGD_A    2
#define CHANDBF_A   3
#define CHANDBF_LOG 4

  • The action states of the main program:

_EXT_ PSTR ActionState[5]
#ifdef ASSIGN_VALUE
= {
  "IDLE ",
  "Wait for KANR ",
  "Wait for FIS ",
  "Release convey.",
  "Wait for F3 "
  }
#endif
;

  • The channel names

 _EXT_ PSTR ChanNames_A[5]
#ifdef ASSIGN_VALUE
= { "DATA", "LIFESIGN", "GD", "DBF", "LOG"}
#endif
;

The function DoCmd_A() looks like this:

SWORD DoCmd_A(PSTR file, SWORD Ch, SWORD Cmd, SWORD Loc)
{
  if (Ch == CHANGE_STATE){
    if (AppRes_EC[Handle_A]->TraceLevel > 2){
       sprintf(ac_Temp_A,"%s> State <%s> --> <%s> Loc: %d", file,

       ActionState[A_Info.State], ActionState[Cmd], Loc);
       ECTraceMsg(Handle_A, NOCHAN_EC, TRCINFO_EC, F_GEN_STRING, ac_Temp_A);
    }
  A_Info.State = Cmd;
  }
  else {
    if ( (Ch >= 0) && (Ch < NumChan_A) ) {
       Chan_A[Ch]->Flags[Cmd] = TRUE;
       if (Ch == CHANGD_A) {
       }
       else  {
         if (AppRes_EC[Handle_A]->TraceLevel > 3) {
           sprintf(ac_Temp_A,"%s> Flag %d set for <%s> , Loc: %d",

                   file , Cmd,   ChanNames_A[Ch], Loc);
           ECTraceMsg(Handle_A, NOCHAN_EC, TRCINFO_EC, F_GEN_STRING, ac_Temp_A);
         }
       }
    }
    else {
        if (AppRes_EC[Handle_A]->TraceLevel > 1)  {
           sprintf(ac_Temp_A, "%s: Flag for inv. chan. %d, Loc:%d",

                              file, Ch, Loc);
           ECTraceMsg(Handle_A, NOCHAN_EC, TRCERROR_EC, F_GEN_STRING,ac_Temp_A);
        }
    }
  }
}
This feature produces entries in the logfile similar to the following line:

10:39:35 APP1> A_appl.c> Flag 9 set for <LOG>, Loc: 1004

It shows

  • from which source file the command originated,

  • which flag was set,

  • which task has been commanded and

  • at which location within the source file the command was given.

During the development process these numbers are generated automatically by a specific utility, which updates all source files of a software project.

Updating the location in the line

 DoCmd_A(__FILE__, CHANGD_A, SHOW_STATUS, 1000);

must not be done manually. Simply use the renumloc utility in a command box.

     
 

back to previous page
 

 

         
Home Search Sitemap Our friends Security FAQ Contact

 

 

© 2004 ICS GmbH. All rights reserved. - Last update: December 12, 2004 - Webadmin: service@ics-control.com