如何在codesys中调用"at命令"?对于GSM调制解调器?不是标准的send_sms和e.t.c [英] How in codesys call an "at command" for gsm modem? Not standart send_sms and e.t.c
问题描述
我有一个gsm-modem和plc,plc看到一个调制解调器(我使用* .lib和功能块"openPort"),但是例如,我不了解如何在调制解调器中写入"at命令", "ate0".
I have a gsm-modem and plc, plc sees a modem (I use a *.lib and functional block "openPort"), but I don't understand how write in modem an "at command", for example, "ate0".
推荐答案
First, to increase your understanding of AT commands in general, read the V.250 specification. That will go a long way in making you an AT command expert.
然后对于实际的实现,我不知道codesys,因此以下是处理AT命令应具有的结构的伪代码:
Then for the actual implementation, I do not know codesys, so the following is pseudo code of the structure you should have for handling AT commands:
the_modem = openPort();
...
// start sending ATE0
writePort(the_modem, "ATE0\r");
do {
line = readLinePort(the_modem);
} while (! is_final_result_code(line))
// Sending of ATE0 command finished (successfully or not)
...
closePort(the_modem);
无论您做什么,都永远不要使用delay
,sleep
或类似内容代替等待最终结果代码.您可以查看 atinout 的代码,以获取is_final_result_code
函数的示例(您也可以将< ST-Ericsson的U300 RIL 中的c3>和isFinalResponseSuccess
,尽管请注意CONNECT
不是最终结果代码,但它是中间结果代码,因此名称isFinalResponseSuccess并非100%正确).
Whatever you do, never, never use delay
, sleep
or similar as a substitute for waiting for the final result code. You can look at the code for atinout for an example for the is_final_result_code
function (you can also compare to isFinalResponseError
and isFinalResponseSuccess
in ST-Ericsson's U300 RIL, although note that CONNECT
is not a final result code, it is an intermediate result code, so the name isFinalResponseSuccess is not 100% correct).
这篇关于如何在codesys中调用"at命令"?对于GSM调制解调器?不是标准的send_sms和e.t.c的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!