
12 3 SPECIFICATION
3.1 Details of the FB Library
Function description (1) By turning on i_bEN (Execution command), unCamOutput (Cam output data) of M+Global_FX5CPU_CamCtr (Output data of
3CH (Unlatched data)) and uResolution (Resolution), bRotateDirection (Rotation direction), and st48CamCtrAngle (Control
angle data) of M+Global_FX5CPU_CamCtrLatch (Setting data of 3CH (Latch data)) are set.
Also, b48CamCtrAngle (Control angle status) for the cam output number is turned on.
unCamOutput (Cam output data) is set according to the setting value specified by i_uCh (Channel number), i_uCamNo (Cam
output number), and i_bRotateDirection (Rotation direction). After the setting processing is complete, o_bOK (Normal
completion) turns on.
■Setting example of cam output data
When i_uCh (Channel number) = 1, i_uCamNo (Cam output number) = 5, and i_bRotateDirection (Rotation direction) = OFF, the
ON/OFF state is sequentially set as follows: unCamOutput[0].bit4 = ON, unCamOutput[3].bit4 = ON, ... , unCamOutput[84].bit4 =
OFF, ... , unCamOutput[6141].bit4 = ON.
When the cam output data is not set, the ON angle and OFF angle of STEP 0 to STEP 7 become 0. To prevent the ON output
without setting, when the ON angle and OFF angle are the same in a STEP, the corresponding angle outputs OFF.
When the ON angle and OFF angle are the same in different STEPs (for example, when STEP 1 ON angle = STEP 2 OFF angle),
the corresponding angle outputs ON.
(2) When i_bEN (Execution command) is turned on while i_bTableDataSet (Table data set) is on, the following operation is
performed.
• unCamOutput (Cam output data) is generated for all channels based on st48CamCtrAngle (Control angle data) of
M+Global_FX5CPU_CamCtrLatch (Setting data of 3CH (Latch data)).
• The values set in i_uCh (Channel number), i_uCamNo (Cam output number), i_bRotateDirection (Rotation direction),
i_uResolution (Resolution), and i_bTableDataClear (Table data clear) are ignored.
• When the processing of the FB is interrupted before o_bOK (Normal completion) turns on, the generation of unCamOutput (Cam
output data) is interrupted.
(3) When i_bEN (Execution command) is turned on while i_bTableDataClear (Table data clear) is on, the followings are cleared.
• unCamOutput (Cam output data) of M+Global_FX5CPU_CamCtr (Output data of 3CH (Unlatched data)) of the channel
specified with i_uCh (Used channel)
• uResolution (Resolution), bRotateDirection (Rotation direction), b48CamCtrAngle (Control angle status), st48CamCtrAngle
(Control angle data) of M+Global_FX5CPU_CamCtrLatch (Setting data of 3CH (Latch data))
(4) By turning off i_bEN (Execution command), the FB is stopped and the processing is not performed.
(5) When the setting value of i_uCh (Channel number) is out of range, o_bErr (Error completion) turns on, the error code 100
(hexadecimal) is stored in o_uErrId (Error code), and FB processing stops.
For details of the error code, refer to Page 14 Error code.
(6) When the setting value of i_uCamNo (Cam output number) is out of range, o_bErr (Error completion) turns on, the error code
102 (hexadecimal) is stored in o_uErrId (Error code), and FB processing stops.
For details of the error code, refer to Page 14 Error code.
(7) When the setting value of i_uResolution (Resolution) is out of range, o_bErr (Error completion) turns on, the error code 103
(hexadecimal) is stored in o_uErrId (Error code), and FB processing stops.
For details of the error code, refer to Page 14 Error code.
(8) When the setting value of i_u16AngleSet (Control angle) is out of range, o_bErr (Error completion) turns on, the error code 104
(hexadecimal) is stored in o_uErrId (Error code), and FB processing stops.
For details of the error code, refer to Page 14 Error code.
FB compiling method Macro type
FB operation type Pulsed execution (multiple scan execution type)
Application example Refer to Page 33 Program Example.
Item Description
0170
STEP0
Control angle (digit)
(ON angle) (OFF angle)
170 225
STEP1 340 425
STEP2 510 680
STEP3 595 850
STEP4 1020 1110
STEP5 1200 1285
STEP6 1370 1455
STEP7
Cam output data (u3CamOutputData)
1540 85
340 510 680 1020 1200 1370 1540 • • • • 2047
0170
STEP1
Control angle (digit)
(ON angle) (OFF angle)
340
340STEP2 510
425
Cam output data (u3CamOutputData)
340 510 680 1020 1200 1370 1540 • • • • 2047