如何使用非交互式程序发送AT coomands [英] How do I sent AT coomands with a non-interactive program

查看:163
本文介绍了如何使用非交互式程序发送AT coomands的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好。我正在努力制作一个程序,将AT命令发送到我的PCI内部调制解调器。

我尝试使用以下命令:



ECHO ATDT0445534567898> COM3



但没有任何反应(COM3是我查找调制解调器属性时显示的串口)



所以我在旧的Borland TurboC 3.0编译器上开发了这个程序:



#include< bios.h>

#include< stdio.h>

#include< dos.h>





#define COM1 0

#define COM2 1

#define COM3 2





#define READY 0x100

#define SETTINGS(0x80 | 0x02 | 0x00 | 0x00)

/ *波特1200

7数据位

无奇偶校验

1个停止位* /







void main()

{



int status,i,x = 17;

char * atcommand =ATDT0445534567898;





bioscom(0,SETTINGS,COM3);





status = bioscom(3,0,COM3);



if(status& READY)

{

for(i = 0; i< x; i ++)>

{

bioscom(1,atcommand [i],COM3);

}

}

}





再次, 没啥事儿。打开程序,好像它真的一个接一个地将字符发送到该端口,但

没有拨号操作完成。我试过ATDT0445534567898; (我的意思是,AT命令的结尾;但是

它不起作用。



我想要它它可以是最简单的。我在DOS环境下运行它,但它不起作用。

Dos环境来自与Windos Xp一起提供的cmdDOS仿真程序。

但是我在旧的MS-DOS OS计算机上运行相同的程序同样的结果。



实际上,据我所知,AT命令完全由调制解调器解释,因此没有软件模块(Windos XP Os或
调制解调器驱动程序。因此,我认为sendig直接将相应的AT命令发送到调制解调器

就足够了。



调制解调器工作正常AT命令使用Hyperteminal完美运行。



所以我想知道发生了什么。



感谢提前

Hi, everybody. I'm traying to make a program to send AT commands to my PCI internal modem.
I tried with the following command:

ECHO ATDT0445534567898 > COM3

but nothing happened (COM3 is the serial port which is shown when I look for modem properties)

So I developed this program on the old Borland TurboC 3.0 compiler:

#include<bios.h>
#include<stdio.h>
#include<dos.h>


#define COM1 0
#define COM2 1
#define COM3 2


#define READY 0x100
#define SETTINGS ( 0x80 | 0x02 | 0x00 | 0x00)
/*baud 1200
7 data bits
no parity
1 stop bit*/



void main()
{

int status,i,x=17;
char *atcommand="ATDT0445534567898";


bioscom(0, SETTINGS, COM3);


status = bioscom(3, 0, COM3);

if (status & READY)
{
for(i=0;i<x;i++)>
{
bioscom(1, atcommand[i], COM3);
}
}
}


Again, nothing happened. Debuging the program, seems like it is really sending characters one by one to that port but
none dialing action is done. I tried with "ATDT0445534567898;" (I mean, an ending ";" of the AT command), but
it did not work.

I want to make it the simplest it can be. I run it on a DOS environment, but it didn´t work.
Dos environment comes from the "cmd" DOS emulation program which comes along with Windos Xp.
However I've run the same program in an old MS-DOS OS computer too, with same results.

Actually, as far as I know, AT commands are interpreted entirely by modem, so none software module (of Windos XP Os or
modem driver) should be involved. Therfore, I think that sendig directly the corresponding AT commands to the modem
should be enough.

The modem is working fine since the same AT command works perfectly using Hyperteminal.

So I'd like to know what´s going on.

Thanks on advance

推荐答案

Bioscom真的是一个时间扭曲。

你没有发回车票。



尝试:



Bioscom is truly a time warp.
You are not sending carriage return.

Try:

int status,i,x=18;
 char *atcommand="ATDT0445534567898\r";





见这里:

http://www.abecedarical.com/timewarp/timewarp_dos_08.html [ ^ ]


这篇关于如何使用非交互式程序发送AT coomands的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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