Karel question

  • Hi

    I initialized the variables, still does not work

    I had sothing similar running for testing, then I "clean" the code and it's not working, and it;s so simple




    PROGRAM PRcomment


    VAR

    status: INTEGER

    pos_cmt: STRING[30]

    pr_nr:INTEGER

    register_no :INTEGER

    real_flag :BOOLEAN

    int_value :INTEGER

    real_value :REAL

    -- SR[1] will manage the comments names for the registers


    BEGIN

    status=1

    pr_nr=1

    register_no=1

    real_flag=TRUE

    int_value =1

    real_value =1

    pos_cmt = 'aaa'

    -- Read value from register 3, flag it if it is integer or real

    GET_REG(3,real_flag,int_value,real_value,status)

    -- Read comment of an specific position register

    GET_PREG_CMT(int_value, pos_cmt, status)

    -- Write comment from PR to an specific string register

    SET_STR_REG(1,pos_cmt,status)


    END PRcomment

    Retired but still helping

  • Odd. I compiled your code, and it works fine on my machine. I tested it with your values and a few others.


    Maybe try deleting your code and the vr file it leaves, then recompile and see if it works.

    Check out the Fanuc position converter I wrote here! Now open source!

    Check out my example Fanuc Ethernet/IP Explicit Messaging program here!

Advertising from our partners