|
Hi,
Thank you for the great lib.
Could you pls point me some code hints with MFC Dialog application?
Thanks
|
|
|
|
|
tx7s0cgmdhdf8 p2j98byv77rfzxd [URL=http://www.170274.com/992092.html] g5rj4hi2tyyuxcmo [/URL] 4qcf9yakpwvd0bs
ocsrgte4hgzh oioinw5x0x [URL=http://www.311321.com/406765.html] enrujhwd [/URL] moben11ie0zcoy
|
|
|
|
|
Hi,
I am running a program try to communicate a PC model card. I can not receive AT responsed although I know it is set.
The Debugmux tool result showed that Pin:'DTR_INACTIVE'
I think it is due to the DCB config?
In my code, I use GetState(dcb); to get device config. info. and reset the config. ( I get fc=Noflowcontrol). So the code exec follow.
switch (fc)
{
case NoFlowControl:
{
dcb.fOutxCtsFlow = FALSE;
dcb.fOutxDsrFlow = FALSE;
dcb.fOutX = FALSE;
dcb.fInX = FALSE;
break;
}
What should I do? Change the DTR before SetState(dcb);?
Thank you very much ahead for any help.
BR
James
|
|
|
|
|
Hi,
Yes, this is certainly the reason, please find hereafter another way of configuring
the serial port
switch (handshake)
{
case 1 : // hardware handshake
dcb.fInX = FALSE;
dcb.fOutX = FALSE;
dcb.fOutxDsrFlow = TRUE;
dcb.fOutxCtsFlow = TRUE;
dcb.fRtsControl = RTS_CONTROL_HANDSHAKE;
dcb.fDtrControl = DTR_CONTROL_HANDSHAKE;
break;
case 2 : // software handshake
dcb.fInX = TRUE;
dcb.fOutX = TRUE;
dcb.fOutxDsrFlow = FALSE;
dcb.fOutxCtsFlow = FALSE;
dcb.fRtsControl = RTS_CONTROL_ENABLE;
dcb.fDtrControl = DTR_CONTROL_ENABLE;
break;
default : // no handshake
dcb.fInX = FALSE;
dcb.fOutX = FALSE;
dcb.fOutxDsrFlow = FALSE;
dcb.fOutxCtsFlow = FALSE;
/* */
dcb.fRtsControl = RTS_CONTROL_ENABLE;
dcb.fDtrControl = DTR_CONTROL_ENABLE;
/* * /
dcb.fRtsControl = RTS_CONTROL_DISABLE;
dcb.fDtrControl = DTR_CONTROL_DISABLE;
/* */
break;
}
Bye
Thierry
|
|
|
|
|
Thierry,
Thank you very much for answer my question.
I tried this
default : // no handshake
dcb.fInX = FALSE;
dcb.fOutX = FALSE;
dcb.fOutxDsrFlow = FALSE;
dcb.fOutxCtsFlow = FALSE;
dcb.fRtsControl = RTS_CONTROL_ENABLE;
dcb.fDtrControl = DTR_CONTROL_ENABLE;
and still not get AT command back( empty string ). I see "Pin: DTR_ACTIVE" now. But then "Channels break".
Any ideal? In what situations, I should pick SW handshake or HW handshake?
Thank You very much for help.
BR
James
|
|
|
|
|
Hi,i'm first message here.
My want to develop a Host like pcAnyWhere Remote Host,use the modem line.The host have many functions like waiting for connection,file transfer,remote control...
Now we can serial communication with modem,but how can we remote control?
Thanks
English is not my native language.
|
|
|
|
|
Hello,
Once the modem has established a connection, bytes that are sent
on one side of the connection appears on the other side.
You can define commands that are executed on reception of
specific bytes.
This can be a long task especially if you have never done
this. In fact you need to create a communication "stack"
with messages, checksum, retransmissions,....
It would take a whole book to explain all this....
Otherwise, look at existing software like Zmodem.
Bye
Thierry
|
|
|
|
|
Thank you Thierry!
I will try it.
|
|
|
|
|
Hi,
i'm here for first time.I am developed one VC++ embedded application software.It's communicating through serial port(It' is directly connected to Embedded system).But now User wants to communicate through Modem.Can anybody show me how to write a "simple" program to communicate with modem (through serial port).Any additional drivers are required to install for that.I am new face to VC++.Please give some solutions.You can send to my personal mail also.
Mail:chandru_soft84@rediffmail.com
Thanks & regards,
Chandrasekar.T
|
|
|
|
|
Hi,
The basic use of a modem is very easy. For more details check your
modem's manual (AT command sets).
-------- Example 1-------------------------------------
For simple operation make
ATDT0041487812781 [+RETURN] (to call that number)
Once you receive a "CONNECT....."
It means that the data you are sending (or
received) are going to the other computer. You're not
talking to your modem anymore (transparent mode)
To stop the communication:
Send nothing during 1 second
Send +++ (without line feed nor carriage return)
and wait at least 1 second
This means you're not talking to the other computer anymore
but to your modem again
Send ATH0 [+RETURN] to stop the communication
---------------------------------------------
To answer a call, send ATA and wait until you get a "CONNECT...."
-------------------------------
With my event driven libray you can get events for incoming call:
event SERIAL_RING
The events SERIAL_CD_ON and SERIAL_CD_OFF indicate you when
you are connected to the other computer (link established)
and when the link is disconnected
--------
I hope this helps
Thierry
|
|
|
|
|
Nice library!
do someone know how to call via serial modem a remote phone number to connect to?
I mean: to write a phone number to the serial i/o buffer and connect to it like Windows hyperterminal does? I have found nothing on the net that implements it. Some excerpt of code will be useful...
Someone could help me?
|
|
|
|
|
this is dial communication :
Port opened by process "svchost.exe" (PID: 1916)
Request: 13/3/2007 23:03:57.75264 (+1995.9063 seconds)
41 54 0D AT.
Answer: 13/3/2007 23:03:57.75264 (+0.0000 seconds)
41 54 0D 0D 0A 4F 4B 0D 0A AT...OK..
Request: 13/3/2007 23:03:57.89364 (+0.0156 seconds)
41 54 45 30 56 31 0D ATE0V1.
Answer: 13/3/2007 23:03:57.89364 (+0.0000 seconds)
41 54 45 30 56 31 0D 0D 0A 4F 4B 0D 0A ATE0V1...OK..
Request: 13/3/2007 23:03:57.03464 (+0.0156 seconds)
41 54 0D AT.
Answer: 13/3/2007 23:03:57.15964 (+0.1250 seconds)
0D 0A 4F 4B 0D 0A ..OK..
Request: 13/3/2007 23:03:57.17464 (+0.0156 seconds)
41 54 53 30 3D 30 0D ATS0=0.
Answer: 13/3/2007 23:03:57.29964 (+0.1250 seconds)
0D 0A 4F 4B 0D 0A ..OK..
Request: 13/3/2007 23:03:57.31564 (+0.0156 seconds)
41 54 0D AT.
Answer: 13/3/2007 23:03:58.44064 (+0.1250 seconds)
0D 0A 4F 4B 0D 0A ..OK..
Request: 13/3/2007 23:03:58.45664 (+0.0156 seconds)
41 54 45 30 56 31 0D ATE0V1.
Answer: 13/3/2007 23:03:58.58164 (+0.1250 seconds)
0D 0A 4F 4B 0D 0A ..OK..
Request: 13/3/2007 23:03:58.59664 (+0.0156 seconds)
41 54 0D AT.
Answer: 13/3/2007 23:03:58.72164 (+0.1250 seconds)
0D 0A 4F 4B 0D 0A ..OK..
Request: 13/3/2007 23:03:58.73764 (+0.0156 seconds)
41 54 44 54 33 34 36 32 39 38 30 33 0D ATDT34629803. <-- telef. number
Answer: 13/3/2007 23:04:30.51864 (+31.7813 seconds)
0D 0A 43 4F 4E 4E 45 43 54 20 32 34 30 30 30 2F ..CONNECT 24000/
41 52 51 2F 56 33 34 2F ARQ/V34/
Request: 13/3/2007 23:04:30.56564 (+0.0469 seconds)
7E FF 7D 23 C0 21 7D 21 7D 20 7D 20 7D 37 7D 22 ~ÿ}#À!}!} } }7}"
7D 26 7D 20 7D 20 7D 20 7D 20 7D 25 7D 26 56 9B }&} } } } }%}&V›
71 B5 7D 27 7D 22 7D 28 7D 22 7D 2D 7D 23 7D 26 qµ}'}"}(}"}-}#}&
7D 25 45 7E }%E~
Answer: 13/3/2007 23:04:31.67464 (+1.1094 seconds)
7E FF 7D 23 C0 21 7D 21 7D 21 7D 20 7D 3F 7D 21 ~ÿ}#À!}!}!} }?}!
7D 24 7D 25 F4 7D 22 7D 26 7D 20 7D 2A 7D 20 7D }$}%ô}"}&} }*} }
20 7D 23 7D 24 C0 23 7D 27 7D 22 7D 28 7D 22 7D }#}$À#}'}"}(}"}
33 7D 29 7D 23 7D 20 D0 52 7D 23 92 70 D8 72 7E 3})}#} ÐR}#’pØr~
Request: 13/3/2007 23:04:31.69064 (+0.0000 seconds)
7E FF 7D 23 C0 21 7D 24 7D 21 7D 20 7D 2D 7D 33 ~ÿ}#À!}$}!} }-}3
7D 29 7D 23 7D 20 D0 52 7D 23 92 70 81 4E 7E })}#} ÐR}#’pN~
Answer: 13/3/2007 23:04:31.69064 (+0.0000 seconds)
7E FF 7D 23 C0 21 7D 24 7D 20 7D 20 7D 27 7D 2D ~ÿ}#À!}$} } }'}-
7D 23 7D 26 AD 36 7E }#}&6~
Request: 13/3/2007 23:04:31.69064 (+0.0000 seconds)
7E FF 7D 23 C0 21 7D 21 7D 21 7D 20 7D 34 7D 22 ~ÿ}#À!}!}!} }4}"
7D 26 7D 20 7D 20 7D 20 7D 20 7D 25 7D 26 56 9B }&} } } } }%}&V›
71 B5 7D 27 7D 22 7D 28 7D 22 BB CE 7E qµ}'}"}(}"»Î~
Answer: 13/3/2007 23:04:31.81564 (+0.1250 seconds)
7E FF 7D 23 C0 21 7D 21 7D 22 7D 20 7D 36 7D 21 ~ÿ}#À!}!}"} }6}!
7D 24 7D 25 F4 7D 22 7D 26 7D 20 7D 2A 7D 20 7D }$}%ô}"}&} }*} }
20 7D 23 7D 24 C0 23 7D 27 7D 22 7D 28 7D 22 88 }#}$À#}'}"}(}"ˆ
75 7E u~
Request: 13/3/2007 23:04:31.83164 (+0.0000 seconds)
7E FF 7D 23 C0 21 7D 22 7D 22 7D 20 7D 36 7D 21 ~ÿ}#À!}"}"} }6}!
7D 24 7D 25 F4 7D 22 7D 26 7D 20 7D 2A 7D 20 7D }$}%ô}"}&} }*} }
20 7D 23 7D 24 C0 23 7D 27 7D 22 7D 28 7D 22 7D }#}$À#}'}"}(}"}
5E 86 7E ^†~
Answer: 13/3/2007 23:04:31.84664 (+0.0156 seconds)
7E FF 7D 23 C0 21 7D 22 7D 21 7D 20 7D 34 7D 22 ~ÿ}#À!}"}!} }4}"
7D 26 7D 20 7D 20 7D 20 7D 20 7D 25 7D 26 56 9B }&} } } } }%}&V›
71 B5 7D 27 7D 22 7D 28 7D 22 50 A7 7E qµ}'}"}(}"P§~
Request: 13/3/2007 23:04:31.84664 (+0.0000 seconds)
....
Data captured using Serial Monitor, http://www.hhdsoftware.com.
|
|
|
|
|
Thanks for the brilliant software. It is a pleasure to use.
Just one correction:
Curently in source:
if ((result_nbr!=0) &&(manager!=0))
manager((uint32) this, SERIAL_DATA_ARRIVAL);
// I automatically restart a new read once the
// previous is completed.
//SetEvent(serial_events[SIG_READ_DONE]);
// BUG CORRECTION 02.06.22
Should be:
if ((result_nbr!=0) &&(manager!=0))
{
manager((uint32) this, SERIAL_DATA_ARRIVAL);
}
else
{
// I automatically restart a new read once the
// previous is completed.
SetEvent(serial_events[SIG_READ_DONE]);
// BUG CORRECTION 02.06.22
}
The SIG_READ_DONE should be triggerd if the normal callback could not be executed.
|
|
|
|
|
How can i send and recieve fax throght modem , please help me.
|
|
|
|
|
This code is very good.I want use it for two or more ports.
question 1:How can I manage events for each ports
question 2:Should I deal rx/tx data with multithread?
Thanks a lot
|
|
|
|
|
I add these two files,Tserial_event.h and Tserial_event.cpp,as a class to my ATL project.When I compile the project, it shew that "tserial_event.cpp(709) : fatal error C1010: unexpected end of file while looking for precompiled header directive". How can that hanppen? And what can i do with it? Many thanks!
|
|
|
|
|
I had this same error with an MFC project, and resolved it by going to the property pages for Tserial_event.cpp and turning off the use of precompiled headers for that file.
And Thierry, thanks for the explanation at the end of your page on how to implement this in an object-oriented C++ program. I was really stuck and began to alter your code to post messages to my main window, until I came across your code showing how to use the callback function.
Paul
|
|
|
|
|
Just add #include "Stdafx.h" at the head, or config to compile with the option "Not using precompiled headers".
|
|
|
|
|
It's just what I want. Thanks!
------------------------
Cheer J. Chen
|
|
|
|
|
Hi there,
very nice, but, how should I send pure Hex data ?
For example, I have to send the following data:
0x0A 0xFF 0xFF 0xFF 0x31 0x31 0x47 0x0D
Since the "sendData" uses "char" i can not send 0xFF.
Or do I miss something ?
Regards, Rudolf
|
|
|
|
|
Hi,
Do you want to send hex data (i.e. text data)
or binary data (values from 0 to 255) ?
Anyway, it's not because the argument is of
type char that you cannot send a value 255.
I should have declared the data as unsigned char.
But in both case, the data is 8-bit wide, so you
can send whatever you want from 0 to 255.
Bye
Thierry Schneider
|
|
|
|
|
Hi, i'm here for first time.
Can anybody show me how to write a "simple" program to communicate with serial port, since i found that many examples are too complicated for me (i'm mechanical base ) ? I got the program in VB, but i need in VC or C/C++.
Thanks.
|
|
|
|
|
Typically as two ends of communication. Sender sends a block of data and expects receiver to respond according to request. But it's very uncommon for sender to decide how many bytes the response would be. It all depends on the receiver. Suppose Sender requests a file download from the receiver with the filename, how can sender know the size of that file?
How do you handle this common situation in real world? Hope to get your response ASAP. (don't know the size yet.;))
|
|
|
|
|
The communication software should not
rely upon the expected data size since
there may be communication errors that
create data loss. This is why I
recommend to specify a RxSize of 1 and
to process each byte after another.
Another possibility is to call
getNbrOfBytes() each time before making
a read. So you would not read more data
than was is available and so your
application will not be blocked.
Anyway, I would not recommend to send
data "as is". But I would encapsulate
them inside messages with a start and
a stop (see http://www.tetraedre.com/mscp/bolep.php3 for example).
Bye
Thierry
|
|
|
|
|
Thank you. Check the received chars one by one by setting RXCHAR event mask doesn't seem like a good idea. Since serial comm is not that fast, if you chck one by one, the speed would slow down dramatically. But recently I thought a idea. that's packet header. Every time receiver waits for a fixed header length, where the actually packet len is in, then decide what size should be wait. I am not sure if there's some problems behind. Seems OK. Any other ideas?
|
|
|
|