Camera Register Access
This group contains function blocks for reading and writing camera registers or memory areas.
Function blocks
UDINT register (4 bytes)
ULINT register (8 bytes)
REAL register (4 bytes)
Larger 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 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.
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 (!fbReadOrWrite.bBusy)
{
// Function block execution is complete or error occurred.
// Next write-command can be issued.
}
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 (0x71E)
if the function block is busy (bBusy == true
).
The hexadecimal value of the error code can be extracted as follows:
if (fbReadOrWrite.bError)
{
// Show relevant error code for debugging purposes:
nErrorCode = fbReadOrWrite.nErrorId & 0xFFF;
}