09-07-2021 05:11 AM
Есть такой код:
Fmt (send_data, "%s", SET 1 3 5 7 8 2 4 6\n");
if(err_code=ComWrt (10, send_data, 20)!=20){
RS232Error_Disp();
return 0;
}else{
SetCtrlVal(panel_handle, PANEL_TEXTBOX, send_data);
byte_count=ComRd(10, read_data, 19);
if(byte_count!=19)
RS232Error_Disp();
else{
SetCtrlVal(panel_handle, PANEL_TEXTBOX_2, read_data);
Как сделать так, чтобы последовательность ("SET 1 3 5 7 8 2 4 6\n") я вводил не в коде, а в самом текстовом поле при запуске программы, соответственно последовательность цифр может меняться и на конце нужно учесть символ '\n'? Заранее спасибо.
There is such a code:
Fmt (send_data, "%s", SET 1 3 5 7 8 2 4 6\n");
if(err_code=Com Wrt (10, send_data, 20)!=20){
RS 232 Error_Disp();
return 0;
}else{
SetCtrlVal(panel_handle, PANEL_TEXTBOX, send_data);
byte_count=ComRd(10, read_data, 19);
if(byte_count!=19)
RS 232 Error_Disp();
else{
SetCtrlVal(panel_handle, PANEL_TEXTBOX_2, read_data);
How to make the sequence ("SET 1 3 5 7 8 2 4 6\n") I did not enter it in the code, but in the text field itself when starting the program, respectively, the sequence of numbers may change and the character '\n ' must be taken into account at the end? Thank you in advance.
09-07-2021 05:35 AM
Hello, I'm not sure I understand you correctly, because this seems quite a basic task:
There must be something unclear to me for you to ask: may you clarify better your situation? Is this somewhat related to your other discussion?
Additionally, I may add that I have rarely found a device that needs a linefeed as a termination character: a carriage return is most common, followed by a CR-LF pair.
09-08-2021 04:50 AM
Извиняюсь..просто трудно сформулировать. В общем ошибка заключается в чтении, в переменную read_data ничего не приходит. Хотя по количеству байт если выводить последовательность программно через SetCtrlVal всё получается
Apologize..it's just hard to formulate. In general, the error is in reading, nothing comes to the read_data variable. Although by the number of bytes if you output the sequence programmatically via SetCtrlVal everything turns out
09-08-2021 09:52 AM
Just a guess: what if the message has simply gone out of sight?
I mean, if the returning string terminates with a newline or carriage return character and your textbox is single-line the visible part of the message may be simply scrolled off!
You can test it by clicking on the control and pressing the Up key, or by setting the textbox to show 2 lines.