Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hi, I want know the detail about using protocol 104 to write float and 32bits string。 #160

Open
nanqiu123 opened this issue Sep 19, 2024 · 2 comments

Comments

@nanqiu123
Copy link

nanqiu123 commented Sep 19, 2024

hi, I using thoese programs to writing data to 104 server,
InformationObject sc = (InformationObject)SingleCommand_create(NULL, 10, false, false, 0);
printf("Send control command C_SC_NA_1\n");
CS104_Connection_sendProcessCommandEx(con, CS101_COT_ACTIVATION, 1, sc);
InformationObject_destroy(sc);

    sc = (InformationObject)SingleCommand_create(NULL, 10, true, false, 0);
    printf("Send control command C_SC_NA_1\n");
    CS104_Connection_sendProcessCommandEx(con, CS101_COT_ACTIVATION, 1, sc);
    InformationObject_destroy(sc);

    sc = (InformationObject)DoubleCommand_create(NULL, 30, 0, false, 0);
    printf("Send control command C_SC_NA_1\n");
    CS104_Connection_sendProcessCommandEx(con, CS101_COT_ACTIVATION, 1, sc);
    InformationObject_destroy(sc);

    sc = (InformationObject)DoubleCommand_create(NULL, 30, 1, false, 0);
    printf("Send control command C_SC_NA_1\n");
    CS104_Connection_sendProcessCommandEx(con, CS101_COT_ACTIVATION, 1, sc);
    InformationObject_destroy(sc);

    sc = (InformationObject)DoubleCommand_create(NULL, 30, 2, false, 0);
    printf("Send control command C_SC_NA_1\n");
    CS104_Connection_sendProcessCommandEx(con, CS101_COT_ACTIVATION, 1, sc);
    InformationObject_destroy(sc);

    sc = (InformationObject)DoubleCommand_create(NULL, 30, 3, false, 0);
    printf("Send control command C_SC_NA_1\n");
    CS104_Connection_sendProcessCommandEx(con, CS101_COT_ACTIVATION, 1, sc);
    InformationObject_destroy(sc);

    sc = (InformationObject)StepCommand_create(NULL, 50, 2, false, 0);
    printf("Send control command C_SC_NA_1\n");
    CS104_Connection_sendProcessCommandEx(con, CS101_COT_ACTIVATION, 1, sc);
    InformationObject_destroy(sc);

    sc = (InformationObject)StepCommand_create(NULL, 50, 3, false, 0);
    printf("Send control command C_SC_NA_1\n");
    CS104_Connection_sendProcessCommandEx(con, CS101_COT_ACTIVATION, 1, sc);
    InformationObject_destroy(sc);

    sc = (InformationObject)SetpointCommandNormalized_create(NULL, 70, -1, false, 0);
    printf("Send control command C_SC_NA_1\n");
    CS104_Connection_sendProcessCommandEx(con, CS101_COT_ACTIVATION, 1, sc);
    InformationObject_destroy(sc);

    sc = (InformationObject)SetpointCommandNormalized_create(NULL, 70, 0.1234, false, 0);
    printf("Send control command C_SC_NA_1\n");
    CS104_Connection_sendProcessCommandEx(con, CS101_COT_ACTIVATION, 1, sc);
    InformationObject_destroy(sc);

    sc = (InformationObject)SetpointCommandNormalized_create(NULL, 70, 1, false, 0);
    printf("Send control command C_SC_NA_1\n");
    CS104_Connection_sendProcessCommandEx(con, CS101_COT_ACTIVATION, 1, sc);
    InformationObject_destroy(sc);

    sc = (InformationObject)SetpointCommandScaled_create(NULL, 90, -32.768, false, 0);
    printf("Send control command C_SC_NA_1\n");
    CS104_Connection_sendProcessCommandEx(con, CS101_COT_ACTIVATION, 1, sc);
    InformationObject_destroy(sc);

    sc = (InformationObject)SetpointCommandScaled_create(NULL, 90, 0, false, 0);
    printf("Send control command C_SC_NA_1\n");
    CS104_Connection_sendProcessCommandEx(con, CS101_COT_ACTIVATION, 1, sc);
    InformationObject_destroy(sc);

    sc = (InformationObject)SetpointCommandScaled_create(NULL, 90, 32.767, false, 0);
    printf("Send control command C_SC_NA_1\n");
    CS104_Connection_sendProcessCommandEx(con, CS101_COT_ACTIVATION, 1, sc);
    InformationObject_destroy(sc);

    sc = (InformationObject)SetpointCommandShort_create(NULL, 110, 1.2347, false, 0);
    printf("Send control command C_SC_NA_1\n");
    CS104_Connection_sendProcessCommandEx(con, CS101_COT_ACTIVATION, 1, sc);
    InformationObject_destroy(sc);

    sc = (InformationObject)SetpointCommandShort_create(NULL, 110, 2.4567, false, 0);
    printf("Send control command C_SC_NA_1\n");
    CS104_Connection_sendProcessCommandEx(con, CS101_COT_ACTIVATION, 1, sc);
    InformationObject_destroy(sc);

    sc = (InformationObject)Bitstring32Command_create(NULL, 120, 123456);
    printf("Send control command C_SC_NA_1\n");
    CS104_Connection_sendProcessCommandEx(con, CS101_COT_ACTIVATION, 1, sc);
    InformationObject_destroy(sc);

but ,in last two page program, sc = (InformationObject)SetpointCommandShort_create(NULL, 110, 2.4567, false, 0);
printf("Send control command C_SC_NA_1\n");
CS104_Connection_sendProcessCommandEx(con, CS101_COT_ACTIVATION, 1, sc);
InformationObject_destroy(sc);

    sc = (InformationObject)Bitstring32Command_create(NULL, 120, 123456);
    printf("Send control command C_SC_NA_1\n");
    CS104_Connection_sendProcessCommandEx(con, CS101_COT_ACTIVATION, 1, sc);
    InformationObject_destroy(sc);`

I can‘t using the program to write data , the messages to server are listed below。
I find those message are not 32bits string message or float message but scaled num message, so it write fail, I want to know the reason about it please.
image
image
image
image

@nanqiu123
Copy link
Author

OH, there is not any help for me?

@zzz9h
Copy link

zzz9h commented Oct 24, 2024

You must first send the selection command, and then send the execution command.

/**

  • \brief Create a single point command information object
  • \param[in] self existing instance to reuse or NULL to create a new instance
  • \param[in] ioa information object address
  • \param[in] command the command value
  • \param[in] selectCommand (S/E bit) if true send "select", otherwise "execute"
  • \param[in] qu qualifier of command QU parameter(0 = no additional definition, 1 = short pulse, 2 = long pulse, 3 = persistent output)
  • \return the initialized instance
    */
    SingleCommand
    SingleCommand_create(SingleCommand self, int ioa, bool command, bool selectCommand, int qu);

like thise

sc = (InformationObject)SingleCommand_create(NULL, 10, true, true, 0);
printf("Send control select command C_SC_NA_1\n");
CS104_Connection_sendProcessCommandEx(con, CS101_COT_ACTIVATION, 1, sc);
InformationObject_destroy(sc);

sc = (InformationObject)SingleCommand_create(NULL, 10, true, false, 0);
printf("Send control execute command C_SC_NA_1\n");
CS104_Connection_sendProcessCommandEx(con, CS101_COT_ACTIVATION, 1, sc);
InformationObject_destroy(sc);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants