AT ^ SYSINFO和一个C ++终端程序 [英] AT^SYSINFO and a C++ terminal program

查看:1548
本文介绍了AT ^ SYSINFO和一个C ++终端程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了一个程序,用USB 3g调制解调器串行调试。当我打开港口并写入AT命令

I have written a program that comminucates serially with a USB 3g Modem. When I open the port and write the AT command

AT

对于调制解调器,我得到正常的OK响应,并可以使用串行读取函数读取它。在终端中,当我写命令

To the modem, I get the normal "OK" response and can read it using a serial read function. In a terminal, when I write the command

AT^SYSINFO

我得到以下响应:

^SYSINFO:#,#,#,#,#,#

#是数字。但是,当我尝试使用我的程序串行编写相同的命令时,我只读取这个响应:

With the #'s being numbers. However, when I attempt to write the same command serially using my program, I read only this reponse:

AT^SYSINFO

我尝试读取另一行传入数据,但没有数据。
任何人都可以帮我这个吗?

I try to then read another line of incoming data, but no data comes. Can anyone help me with this? There is information in the ^SYSINFO message that I need to extract.

推荐答案

必须终止一个AT命令行与 \r ,没有别的(除非你修改了 ATS3 ,但你不应该) 1 。引用 V.250规范: / p>

You MUST terminate an AT command line with \r and nothing else (unless you have modified ATS3, but you should not)1. To quote the V.250 specification:

5.2.1   Command line general format

A command line is made up of three elements: the prefix, the body, and
the termination character. The command line prefix consists of the
characters "AT" or "at", or, to repeat the execution of the previous
command line, the characters "A/" or "a/". The body is made up of
individual commands as specified later in this Recommendation. Space
characters are ignored and may be used freely for formatting purposes,
unless they are embedded in numeric or string constants (see 5.4.2.1
or 5.4.2.2). The termination character may not appear in the body. The
DCE shall be capable of accepting at least 40 characters in the body.
The termination character may be selected by a user option (parameter S3),
the default being CR (ASCII value 13).

DCE表示调制解调器。

DCE means modem.

删除了上面引用的IA5引用,因为这只是混淆)

(I removed the IA5 references in the quote above as that is only confusing)

1
终止与 \r\\\
通常会工作,但这是因为125ms中止超时延迟,使额外的 \ n 不会中止命令。

1 Terminating with \r\n will usually work, but that is only because of the 125ms abort timeout delay that makes the extra \n not abort the command.

这篇关于AT ^ SYSINFO和一个C ++终端程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆