To continue the tone list:
- Are you using the right speed?
- What are the .RThreshold and .SThreshold settings?
- Are other comport settings correct (usually N, 8.1, but there are exceptions)?
- Have you tried to execute the command using the hyperterminal and get the expected response?
- Where in your code do you read MSComm1.Input? in which event?
- Does the device also have an LED that flashes when sending data? is he blinking
- Does the end-char command need vbCrLf or vbCr anything else?
Please place the full function / auxiliary code where you send the command, and please write the full function / sub code where you read MSCOmm1.Input
Take a look at the following test project, in which I send the βATβ command to my modem, which is connected to commport 1 and with which I communicate at a transmission speed of 9600:
'1 form with: ' 1 textbox control : name=Text1 ' 1 command button : name=Command1 ' 1 MSComm control : name=MSComm1 Option Explicit Private Sub Command1_Click() MSComm1.Output = "at" & vbCrLf End Sub Private Sub Form_Load() With MSComm1 If .PortOpen Then .PortOpen = False .Settings = "9600,n,8,1" .CommPort = 1 .RThreshold = 1 'read data per char .SThreshold = 0 'send all data at once .PortOpen = True End With 'MSComm1 End Sub Private Sub Form_Resize() Dim sngWidth As Single Dim sngCmdHeight As Single Dim sngTxtHeight As Single sngWidth = ScaleWidth sngCmdHeight = 315 sngTxtHeight = ScaleHeight - sngCmdHeight Text1.Move 0, 0, sngWidth, sngTxtHeight Command1.Move 0, sngTxtHeight, sngWidth, sngCmdHeight End Sub Private Sub MSComm1_OnComm() Dim strData As String With MSComm1 Select Case .CommEvent Case comEvReceive strData = .Input ShowData strData End Select End With 'MSComm1 End Sub Private Sub ShowData(strData As String) With Text1 .SelStart = Len(.Text) .SelText = strData End With 'Text1 End Sub
When I click on Command1, it will send βATβ and vbCrLf, and the modem answers βOKβ, which is displayed in Text1.
source share