RobotStudio event

How to solve Error trying to use cameradev as a parameter

Options
RobotWare 6.09.02.00:

So I'm trying to use cameradev as a parameter in a routine. Per the datatype details:

>>

Data of the type cameradev must not be defined in the program. However, if it is then an error message will be displayed as soon as an instruction or function that refers to this cameradev is executed. The data type can, on the other hand, be used as a parameter when declaring a routine.

>>

Obviously there are plenty of built in routines and functions that use cameradev as a parameter already.

So what happens is I'm trying to use as follows:

PROC rLoadVisionProg(cameradev CamName ,string ProgName)

...

ENDPROC

And I'll get a semantic error: Type error(83): cameradev not value type

Best Answer

  • XNOR
    XNOR
    Answer ✓
    Options
    Digging deep into the Kernal manual I found the solution in the 'DATA TYPE VALUE CLASSES' section. There is a table that shows 'Possible and impossible combinations of object usage and type value class'. It indicated for parameters of type Non-value or semi-value you need to prefix with a VAR declaration.

    So this worked when I added VAR in front:

    PROC rLoadVisionProg(VAR cameradev CamName, string ProgName)

Answers

  • lemster68
    lemster68 ✭✭✭
    Options
    It might be the case that they use it as a switch parameter.
    The special type, switch, may (only) be assigned to optional parameters and provides a means to use switch arguments, that is arguments that are only specified by names (not values).
    Lee Justice
  • lemster68
    lemster68 ✭✭✭
    Options
    Good job, thanks for sharing.
    Lee Justice