Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Recipe Management

Info123
2012-04-23
2012-08-20
  • Info123 - 2012-04-23

    Hi,

    I'm trying to work with Recipe Management on Codesys V3.
    I showed 3s example to start ("RecipeDemo").

    The RecipeManCommands.GetRecipeNames or .SetRecipeValues accept pointer to array of string as parameter.

    I use an array of string to read recipe name or save values, but i need convert one by one my parameter to array of string.

    I have a struct composed by different parameter and I have to convert Type_to_string.

    Is there a function to put values of a struct in array of string and the opposite?

    Mystruct.a (INT) = 100      -->int_to_string()             array[0] = '100'
    Mystruct.b (BOOL) = TRUE    -->bool_to_string()        array[1] = 'TRUE'
    Mystruct.c (STRING) = 'TEST'                                    array[2] = 'TEST'
    

    My struct --> array of string --> recipe file.

    For the moment I use a pointer of byte to point on the first element of my instance of struct, and I move the pointer in base of type of data to copy data from array of string to my struct.
    I have an other problem, when I read an Integer value by my array of string I read the ASCII character corrispondent (for example char= 'W' int value = 87).
    Is possible to convert the ascii character to value code?

    Thank to all for your reply.
    Matteo

     

    Related

    Talk.ru: 1
    Talk.ru: 2

  • balajimct - 2012-08-20

    Hi Matteo,

    I think your structure is like this

    Struct
    Rec_Name : String;
    Var1 : Int
    .
    .
    Varn : Int
    End_Struct

    Once if you are entering the new value to receipe name then you can run the loop in the first element and you can find the string is there or not
    if it is there then the instance will be having the value, with the help of the instance value move all the values in the present to required array

    I think some codesys library contains this function TBL_RDWR, This function will do all this operations

    If you want code then you can mail me to the below ID
    e balajimct@gmail.com e

     

Log in to post a comment.