94
Manual – IPOSplus®
6
Cam controllers
Position Detection and Positioning
Example solved in
the Compiler
/*
======================================================================
Program frame for applications with expanded cam function
======================================================================
*/
#include <const.h>
#include <io.h>
// Variable structure for the cam controller defined externally in *.h
#include <camdef.h>
CamStructure CamData0;
ControlStructure MyCamControl;
/*=============================================
Main function (IPOS initial function)
===============================================*/
main()
{
/*-------------------------------------
Initialization
--------------------------------------*/
MyCamControl.CamControl=0x80000002; // exp. function active
MyCamControl.CamOutShiftLeft=1;
MyCamControl.CamForceOn=//Mandatory activation of mask
MyCamControl.CamForceOff=0; // Mask: Mandatory deactivation of outputs
MyCamControl.CamSource=numof(ModActPos) ¦ (1<<31);
// Actual position value in modulo format
MyCamControl.CamDestination=481; // Basic unit outputs
MyCamControl.CamOutputs=1; // Number of cam discs (max. 8)
MyCamControl.CamDataStr0=numof(CamData0);
// Start of the cam structure 1 (output bit 0)
CamData0.DeadTime=0;
CamData0.CamAreas=3; // 3 cam ranges due to modulo overflow in the win-
dow
°°CamData0.LeftLimit1= 64626; °°°// 355° at load = 360° x 64626/65536
°°CamData0.RightLimit1= 65536; °°°// 360° at load
°°CamData0.LeftLimit2= 0; // 0° at load
CamData0.RightLimit2= 910; // 5° at load
CamData0.LeftLimit3= 31858; // 175° at load
CamData0.RightLimit3= 33678; // 185° at load
CamData0.LeftLimit4= 0; // not used
CamData0.RightLimit4= 0; // not used
_Go0( GO0_U_W_ZP );
_GetSys( MyCamControl.CamControl ,GS_CAM );
/*-------------------------------------
Main program loop
--------------------------------------*/
while(1)
{
}
}