PF_Control
PF_Control is called when the system needs the hopper or user lighting to turn on or off. This callback function is used to control the following devices installed in the system:
- Hopper
- User lighting
When using user lighting, select "Custom front light" in Epson RC+ 8.0 Menu - [Tools] - [Part Feeding] - [Lighting].
Syntax
Function PF_Control(part ID As Integer, Control As Integer) As Integer
' (Hopper operations)
' (External lighting operations)
Fend
Parameters
- Part ID
The part ID (integer number from 1 to 32) goes here.
When multi-part operation, the active part goes here. - Control
The type of operation (integer number) goes here.
Operation | Value (defined in PartFeeding.inc) |
---|---|
Hopper operation (when the feeder contains no parts) | PF_CONTROL_SUPPLY_FIRST |
Hopper operation (when the feeder contains parts, and parts can be added) | PF_CONTROL_SUPPLY |
User lighting On | PF_CONTROL_LIGHT_ON |
User lighting Off | PF_CONTROL_LIGHT_OFF |
Return values
Under normal circumstances, set the PF_CALLBACK_SUCCESS constant (defined in PartFeeding.inc).
When an error occurs, set a user-defined error number (8000 - 8999). This value is passed back as a PF_Status callback function parameter.
Description
Use the Select...Send descriptor text to describe processes by device.
Hopper operation (when the feeder contains no parts)
There are no parts in the feeder. Turn on the hopper to supply parts to the feeder.
You can optimize robot movement by setting the number of parts supplied to the value obtained when calibrating for the optimum number of parts (retrieved with the PF_Info command).Hopper operation (when the feeder contains parts, and parts can be added)
There are parts in the feeder, and more parts can be added. Adding parts at this timing increases the number of parts that can be detected with the vision system, and improves robot operation efficiency.
As an example, assume the number of parts supplied is equal to the number of parts removed by the robot.User lighting On
This indicates the timing to turn user lighting on for vision imaging. Operate the user lighting to turn it on. Operate the user lighting to turn it on.User lighting Off
This indicates the timing to turn user lighting off when vision imaging has ended. Operate the user lighting to turn it off.
Describe the following processes in user-prepared code. Have these run before PF_Start.- Connect to the hopper, and adjust settings, etc.
- Connect to the external lighting, and adjust settings (brightness), etc.
Program Example
The following program example shows how to control a hopper and external lighting.
Connect one Gen.2 hopper to the IF-240 and control it with the PF_Hopper command.
In this example, the optimum number of parts is 60.
The hopper is adjusted on the hopper calibration screen to supply 60 parts per 3 seconds of operation.
Assume that the external lighting is set to a standard IO.
' ** IO Label (Output) **
' O_FrontLight External lighting
Function PF_Control(partID As Integer, Control As Integer) As Integer
Integer hopperOnTime
Select Control
' Hopper operation. When the feeder contains no parts
Case PF_CONTROL_SUPPLY_FIRST
PF_Hopper 1,partID, 3000
Wait 3
' Hopper operation. When adding parts to the feeder
Case PF_CONTROL_SUPPLY
hopperOnTime = PF_QtyAdjHopperTime(partID, 60, 3000)
PF_Hopper 1, partID, hopperOnTime
Wait hopperOnTime / 1000
' User lighting On
Case PF_CONTROL_LIGHT_ON
On O_FrontLight
' User lighting Off
Case PF_CONTROL_LIGHT_OFF
Off O_FrontLight
Send
PF_Control = PF_CALLBACK_SUCCESS
Fend