As far as the "Short Message through the serial port", I will exchange some technical problems with netizens and discuss some of the technical issues to be included in the following text. I hope this article can help more friends interested in SMS. Since I am amateur hobby, time and money are limited, there is no power to test a lot of models of mobile phones and modules, there may be such errors, I hope that the high people in the line will be criticized.
Q I wrote a SMS sender, send it to the PDU format, and the program is not used in Guangzhou, but I can't send it in Henan. I don't know why, the text message "How are you?" The format is as follows:
Henan: 0891683108200005F011000D91683170031618F20008A9064F60597D5417
Guangzhou: 0891683108301705F011000D91683170031618F20008A9064F60597D5417
A When sending a text message, you should use the SIM card to the SMSC number. If it is in Guangzhou, even in the field or use Guangzhou's SMSC number. The SMSC number in your two SMS is different, but it is the same SIM card. I don't know if it is this reason.
Q Can the number of SMS could use the number in the SIM card directly, not user input? The SMS software I have used seems to be a SMSC number.
A has a "AT CSCA" instruction that can be used to set up or query the service center number. If this number already exists in your phone, there are two solutions:
Use the "At CSCA?" Instruction to query it and then automatically write this number into the SCA of the PDU. PDU's SCA field only writes a "00": "08 91 68 31 ..." -> "00" can set the service center number with the "At CSCA = XXXXXXXX" instruction. Q On the super terminal, send a short message with AT CMGS, the format does not seem to have an error, but always returns "Error". I entered like this: AT cmgs = 30
> 0891683108100005F011000D91683118405057F000000006C8329BFD0E01 What is the reason? A "At CMGS" instruction is very special, and you need to enter data after entering you. Here is "CR", not "CRLF", pay attention to the direct carriage return in the super terminal to generate two characters (view settings). Like the "At CMGL" instruction, even if the last input "CRLF" is also tight. Your problem is in length. The length is not just written, in your example, the length should be 21. The SMSC segment (0891683108100005F0) was removed from "11" (ie "11000d91683405057f000000006C8329BFD0E01"), divided by 2. The correct way to write should be AT cmgs = 21
> 0891683108100005F011000D91683118405057F00000000006C8329BFD0E01 (">" is a mobile phone reminder, not input) q I have recently compiled a procedure about short message, in your "Short Pitch Short Message", "Text Mode is a plain text, you can use Different character sets, from technology can also be used to send Chinese short messages, but domestic mobile phones are basically not supported, mainly for Europe and America. "Is it saying that I use AT command" AT cmgf = 1 "or" AT CMGF = 0 "There is no impact on me later sent and receiving short messages? A Text Mode is simple, directly sending the original text, sending non-ASCII code content, but you need mobile phone support to display correctly. For example, many characters of German, the code is greater than 0x80, they are used with text mode. What is the difference between the character encoding? TEXT MODE? There is a dedicated character set setting command "AT CSCS". It can be set to the expansion character set "UCS2". SIEMENS TC35 / TC37 provides, its "AT CSCS" supports "UCS2" character set, but I have no chance to go to personally experiment. Friends who are using TC35 / TC37 modules may try it. According to I understand that Chinese short messages, all kinds of mobile phones sold in China only support PDU MODE, which has become a fact. In fact, the PDU Mode is really easy to use, and it is estimated that Text Mode will shrink. We wrote the program, I recommend only PDU Mode, even if it is pure English information, the encoding is flexible to take 7bit or UCS2, because the length of the 7bit can be twice the length of UCS2 (in terms of pure English only). If you send pure data, you don't need your phone to display, you can use 8bit. Q In your SMSTRAFFIC class, is it in a large loop in your SMSTRAFFIC class, is it to put all received messages into a message queue, then execute the delete program? If I have a big amount, the gateway has a lot of short messages waiting to enter the phone. After reading all short messages, during the deletion, because the order of the short message is, it is misused (for example, I am now There are 1-15 short messages in the mobile phone, and then after I delete the first two, the third will automatically fill the first one, and the new short message, 16 rows of the third, but by Cancel What?) I tried it as a short message arrangement is not the same every time? (When receiving, the same short message is sometimes 14, sometimes Article 15) how can this solve? There is a physical serial number in the mobile phone, and the serial number is read, and the deletion is also deleted according to the serial number. "Physics" is critical. This serial number is equivalent to the ID, no matter how much it is deleted in front, how many messages have been deleted, and will not change. If there is 1-15, it has been removed from 1 and 2, and there is two messages in the mobile phone. Some put in Article 1, some are placed in Article 16, I have seen it. . In fact, it is willing to put in which free place. But no matter what, it will not cause confusion, because what is the serial number of the read, it deletes what serial number. Before executing the delete command, the message is still in that place, and will not be overwhelmed.
If the gateway has a lot of short messages waiting to enter the phone, the amount is large, this processing mode is not high, because AT CMGL takes a long time, this time the phone cannot receive new messages from SMSC. The "real-time" receiving method I said is better, and the news is directly passed, and the process of writing to the phone is not written. Q I use the NOKIA 8210 serial data cable, connect the computer's COM1 port, use the SMSTest running prompt "No Modem", track discovery gsminit () detection serial AT command does not respond "OK". According to your prompt, I installed the NOKIA MODEM driver, (Win2000 Server System) Virtual Exam 8210 MODEM device in the COM3 port, call SMSTEST again or prompt "No Modem". However, with a serial line, the phone can perform the corresponding picture LOGO, SMS send operation via the LogoManager mobile phone management software. A NOKIA phone itself does not have a modem function, using a professional term, does not have a TA (Terminal Adapter) interface, requiring driving conversion, whether it is true serial port, USB or infrared interface, anyway, it can virtualize "Standard Modem" serial port. The AT command can only communicate with standard asynchronous. In my impression, NOKIA 8210 needs to communicate with PC with an infrared interface. It is estimated that the driver you installed is IR-> COM conversion, not drive the serial port data cable, maybe your computer does not have an infrared interface, so COM3 can't even connect? To try (virtual) whether the serial port is connected correctly, it is very simple, use Windows self-contained "Super Terminal" to connect to the specific virtual port, knock a "AT" Enter, see if there is any reaction, correct answer should be "ok". The NOKIA data line runs "Nokia" - NOKIA proprietary protocol data, not a universal / extended AT command set. LogoManager can listen, can say "Nokia", so you don't need to install the driver. Nokia has a free "Nokia PC Connectivity SDK" for developing NOKIA phones. As for the development package of LogoManager, it is unknown. Q In SMSTest, issue an AT command, then receive a response, such as WriteComm ("AT CMGF = 0 / R", 10); Readcomm (ANS, 128); then call Readcomm after the WriteComm function, is it too urgent, The readcomm function here is a single character or incomplete string in reading returned or in which a single character or incomplete string? How much is the timeout control? A About the read serial port, the program sets the timeout control: commandTimeouts Timeouts = {// Serial port timeout control parameters
100, // Read characters interval timeout: 100 ms
1, // read the time of each character: 1 ms (n characters for N ms)
500, // Basic (extra) Read time: 500 ms
1, // Write the time of each character: 1 ms (n characters for N ms)
100}; // Basic (extra) Write time: 100 ms readcomm When is it? Press this timeout setting, if n = 128 (the second parameter of the Readcomm), if there is no data, wait 500 1 * 128 = 628 milliseconds. In other words, if there is no connection to the phone, there is no response, and the readcomm will continue to block 628 milliseconds, and then return. If the data is continuously transmitted, the character interval has not exceeded 100 milliseconds, but the time has reached 628 milliseconds, returns the read character (string). The received may be an incomplete string. If the character interval exceeds 100 milliseconds (the first character is not counted), returns to the read character (string). The received should be a complete string. In the case where the phone is properly connected, it is mainly the final role. A section of data is continuously transmitted. If the baud rate is 9600bps, it can calculate the character interval is about 0.1 milliseconds, far less than 100 milliseconds, and return to one byte or part of the data; usually, it may be waiting after the data is completed. 100 The situation returned milliseconds. For example, if "OK / R / N" is received 150 milliseconds after executing readcomm (ANS, 128), additional 100 milliseconds are required, that is, the function will return after 250 milliseconds. The time to transmit 4 byte data here is ignored. If you think it is too urgent, you can make a basic (additional) read timeout time. However, there is no response in 500 milliseconds, which may be caused by the connection failure. It is necessary to pay special attention to the "AT CMGL" instruction and its response. It may be due to the need to scan all storage areas, the mobile phone will only be delayed for a few seconds to send the last "OK" after sending a short message one by one. Of course, it can be achieved by setting long (such as 20 seconds) by setting the basic read timeout, and read long data (such as 2000). In this way, the function blockage time is too long. If you want to quit it like this, you will find "the program is unresponsive". Solution in SMSTEST is: loop read the serial port data, put the data read each time, and finally get a complete response. GSMGETRESPONSE () Passes some data each time, add new data to the read data, and detects "OK" or "Error" to determine if complete data has been read. [Related Resources] Kernel Studio: www.kernelstudio.com Published: 2004-03-16