Banner PresencePLUS Pro COLOR—PROII Camera User Manual

Page 73

Advertising
background image

This example assumes that a Banner PresencePLUS inspection that produces X, Y and Angle offsets has been loaded

into the PresencePLUS Vision Sensor and has been started with the PresencePLUS GUI. These offsets will then be

obtained and stored in the following variables:
• X_offset is the offset (in units set in camera) along the horizontal axis of the image, increases to the right
• Y_offset is the offset (in units set in camera) along the vertical axis of the image, increases downward
• Rz_offset is the angular offset (in degrees) about the Z-axis, increases clockwise
This program implements the following actions:
1. Connect to the RCC.
2. Issue EXEC TRIGGER and wait for inspection to complete.
3. Determine pass/fail condition of the inspection.
4. Get the X, Y, and Rotation about Z-axis offsets.
5. Close the connection to the RCC.
If any failure occurs, such as a TCP communications failure or a RCC command error, then the connection to the RCC

will be severed within this example program.

.PROGRAM banner_vision()
; Global variables
$cmd_del = $CHR(13)+$CHR(10)
$coord_del = ","
tcp_sock_id = -1 ; TCP/IP socket id for the camera

; Local variables
.ret_val = -1
.$cmd_str = "" ; Used for commands to camera
.$rcv_str = "" ; Used for incoming data from camera
.$rsp_str = "" ; Used for response parsing from camera

;
; Open TCP socket and connect to RCC
;
CALL tcp_open(.ret_val, 20000)
IF .ret_val < 0 THEN
PRINT "Unable to connect to RCC"
RETURN
END

;
; Trigger the camera and wait for the inspection to complete
;

; Send Trigger to camera and wait for the inspection to complete
.$cmd_str = "EXEC TRIGGER"+$cmd_del
CALL tcp_send(.ret_val, .$cmd_str)
IF .ret_val < 0 GOTO tcp_error

; Read command response from camera
.$rcv_str = ""
CALL tcp_recv(.ret_val, .$rcv_str)
IF .ret_val < 0 GOTO tcp_error

; Decode command response - a response of zero indicates that
; the command was accepted for processing, a negative value
; indicates that an error has occurred.
.$rsp_str = $DECODE(.$rcv_str, $cmd_del, 0)
.ret_val = VAL(.$rsp_str)
IF .ret_val < 0 GOTO cmd_error ; Trigger failed

;

73

Minneapolis, MN USA

Banner Engineering Corp.

System Setup Dialog

2/2010

Advertising