dzrong Posted July 29, 2010 Posted July 29, 2010 I have a question in the DemoBox_4X.PowerPmacSuite_sln example in the PPmac IDE. In the pp_proj.h file there are some definition, one of these is '#define mypvar1 8193'. What is it mean? And what the 8193 mean? And in the 'demo box defines.pmh' file there is other definition is 'global mypvar1'. Why is this declared name as the same as the pp_proj.h one? Thanks, Rodder
Sina.Sattari Posted July 29, 2010 Posted July 29, 2010 The pp_proj.h is a header file generated by pp_proj software. Upon downloading of a project from IDE to Power PMAC, all the Global, CSGlobal and Ptr variable definitions in [b]Project/PMAC Script Language/Global Includes/global definition.pmh[/b] file will be parsed and based upon that pp_proj.h is created. Now, why does this need to happen? Although the script PLCs and Programs can access the Global, CSGlobal and Ptr variables just by name, the C applications and CPLCs need to access them through API calls such as GetGlobalVar() and SetGlobalVar(). The argument passed to these APIs using the pp_proj.h header file. When using API calls, user simply uses the same variable name defined in the global definition.pmh file, but before compilation of the CPLCs or Background C programs, these names will be replaced with a number indicating their place holder in the variable table. The number 8193 is the place holder for your variable. If you right click the project in the Solution Explorer and select properties, you'll see a window like this: [attachment=1372:name] This is where you define what the starting number should be for assignment of Global, CSGlobal and Ptr variables. Since the default is 8192, you got a 8193 for your second defined variable.
Recommended Posts