Camera Register Access

This group contains function blocks for reading and writing camera registers or memory areas.

Parameter

The following parameters work in a similar way with all function blocks in this group:

Address

The address nAddress specifies the register of the camera to be read or saved. The type GVCP_REGISTER_ADDRESS is merely an alias for UDINT; therefore, the address must be 4 bytes (or 32 bits) long. For larger memory areas of the camera (see FB_VN_ReadMemory) the address points to the beginning of the area to be read or saved.

Execute the function

The triggers for write and read commands are bWrite and bRead respectively. They are triggered by a rising edge (change from FALSE to TRUE). The relevant input parameters are saved internally so that a parameter change during the execution has no effect. A falling edge of the trigger likewise has no effect.

Camera Register Access 1:

Calling function blocks

Please note that the description of parameters for function blocks only has an effect if the function blocks are actually called.

Timeout

So as not to have to wait a long time for the execution of the function block in the case of an unknown error, the maximum permitted execution time can be set with nTimeout. The execution will be aborted if this time is exceeded without a successful result after triggering the command trigger. The timeout error is then recognizable by the two outputs bError and nErrorId.

Working state

The output bBusy indicates whether the function block is busy. No new command can be triggered if bBusy = TRUE.

By means of a suitable IF query it is possible to determine whether the execution of the function block is completed:

IF NOT fbReadOrWrite.bBusy THEN
    // Function block execution is complete or error occurred.
    // Next write-command can be issued.
END_IF

Error state

The error state is indicated by bError binarily indicating an error and nErrorId outputting the error code (ADS Return Code) if applicable. The error state is reset as soon as a new command is triggered. The error code is PENDING (16#71E) if the function block is busy (bBusy = TRUE).

The hexadecimal value of the error code can be extracted as follows:

IF fbReadOrWrite.bError THEN
    // Show relevant error code for debugging purposes:
    nErrorCode := fbReadOrWrite.nErrorId AND 16#FFF;
END_IF

Samples