Home > Back-end >  Help: Delphi use mscomm receive GSM module data, the runtime can't accept, can accept single st
Help: Delphi use mscomm receive GSM module data, the runtime can't accept, can accept single st

Time:10-15

As title, I written in Delphi software to GSM SMS module, speaking, reading and writing.
Reading text procedure is as follows:
If not MSComm1. PortOpen then
exit;
//send the AT + CMGF=1
StrOut:=';
StrOut:='AT + CMGF=1 + CRH (13);
MSComm1. Output:=strOut;
//send the AT + CMGR=1
StrOut:=';
StrOut:='AT + CMGR=1 + CRH (13);
MSComm1. Output:=strOut;
//read the data and display in RichEdit1
StrIn:=';
StrIn:=MSComm1. Input;
LabRev. Caption:='successfully received the data! ';
RichEdit1. Text:=RichEdit1. Text + strIn;
Alone to run the program, RichEdit1 what do not have, but with a single step debugging RichEdit1 of relevant data, and message
Is this how to return a responsibility, how should solve?

CodePudding user response:

Outout and add a waiting time between inPut, total want to give each other a response time

CodePudding user response:

MSComm1. Inputlen:=0;//Input will read the entire content of the receive buffer
Mscomm1. InBufferSize:=1024;//sets the receive buffer bytes
MSComm1. Inbuffercount:=0;
MSComm1. Portopen:=true;
MSComm1. Input;//to proofread the first buffer to remove residual data
Mscomm1. DTREnable:=true;//data terminal ready
Mscomm1. RTSEnable:=true;//request
MSComm1. Output:='AT' + CRH (13);
sleep (300);
Ed_test. Text:=MSComm1. Input;
  • Related