Guidance
指路人
g.yi.org
software / rapidq / Examples / Devices / RS232 Serial Port / dial.bas

Register 
新用户注册
Search 搜索
首页 
Home Home
Software
Upload

  
'Here is a program I posted a while back that makes regular voice phone calls
'using the modem.  It requires the new comport component available in the
'groups files section
'I think this is what you are looking for  For more information you need to
'make your searches to contain "vls modem at commands"   or just search using
'any of the at or vls commands included in the code below and you are well on
'your way.
'After all I am the guy the drives the phone truck
'John Graves aka laddie@bellsouth.net
'http://www.geocities.com/Standstiladdie
'Change "COM3" to whatever comport your computer uses
'Requires Pete Klienshmidt's comport.include

'$TYPECHECK ON
     $OPTIMIZE ON
     $INCLUDE "RAPIDQ.INC"
     $INCLUDE "COMPORT.CMP"
' Copy and paste into your program
     DECLARE SUB Button1Click (Sender AS QBUTTON)
     DECLARE SUB Button2Click (Sender AS QBUTTON)
     DECLARE SUB Button3Click (Sender AS QBUTTON)
     DECLARE SUB Button4Click (Sender AS QBUTTON)
     DECLARE SUB Button5Click (Sender AS QBUTTON)
     DECLARE SUB Button6Click (Sender AS QBUTTON)
     DECLARE SUB Button7Click (Sender AS QBUTTON)
     DECLARE SUB Button8Click (Sender AS QBUTTON)
     DECLARE SUB Button9Click (Sender AS QBUTTON)
     DECLARE SUB Button10Click (Sender AS QBUTTON)
     DECLARE SUB Button11Click (Sender AS QBUTTON)
     DECLARE SUB Button12Click (Sender AS QBUTTON)
     DECLARE SUB Button13Click (Sender AS QBUTTON)

     DECLARE SUB ComError(strErrorMessage AS STRING)
     DECLARE SUB PortOpen
     DECLARE SUB PortClosed
     DECLARE SUB StringWritten
     DECLARE SUB StringRead

     DIM dwBaud AS DWORD
     dwBaud = 9600
     DIM bParity AS BYTE
     bParity = "NOPARITY"
     DIM bDataBits AS BYTE
     bDataBits = 8
     DIM bStopBits AS BYTE
     bStopBits = "ONESTOPBIT"
     DIM strPort AS STRING
     DIM MyPort AS COMPORT
     MyPort.OnComError = ComError
     MyPort.OnOpen = PortOpen
     MyPort.OnClose = PortClosed
     MyPort.OnWriteString = StringWritten
     MyPort.OnReadString = StringRead
'Settings
     strPort = "COM3"
     MyPort.Port = strPort
     MyPort.BaudRate = dwBaud
     MyPort.Parity = bParity
     MyPort.DataBits = bDataBits
     MyPort.StopBits = bStopBits
'Open COM Port
     MyPort.OPEN





     CREATE Form AS QFORM
      CAPTION = "Rapid-Q Code Viewer"
      Width = 523
      Height = 320
      Center
      CREATE Button1 AS QBUTTON
       CAPTION = "1"
       Left = 30
       Top = 24
       Width = 35
       Height = 33
       OnClick = Button1Click
      END CREATE
      CREATE Button2 AS QBUTTON
       CAPTION = "2"
       Left = 86
       Top = 24
       Width = 35
       Height = 33
       TabOrder = 1
       OnClick = Button2Click
      END CREATE
      CREATE Button3 AS QBUTTON
       CAPTION = "3"
       Left = 142
       Top = 24
       Width = 35
       Height = 33
       TabOrder = 2
       OnClick = Button3Click
      END CREATE
      CREATE Button4 AS QBUTTON
       CAPTION = "4"
       Left = 30
       Top = 72
       Width = 35
       Height = 33
       TabOrder = 3
       OnClick = Button4Click
      END CREATE
      CREATE Button5 AS QBUTTON
       CAPTION = "5"
       Left = 86
       Top = 72
       Width = 35
       Height = 33
       TabOrder = 4
       OnClick = Button5Click
      END CREATE
      CREATE Button6 AS QBUTTON
       CAPTION = "6"
       Left = 142
       Top = 72
       Width = 35
       Height = 33
       TabOrder = 5
       OnClick = Button6Click
      END CREATE
      CREATE Button7 AS QBUTTON
       CAPTION = "7"
       Left = 30
       Top = 120
       Width = 35
       Height = 33
       TabOrder = 6
       OnClick = Button7Click
      END CREATE
      CREATE Button8 AS QBUTTON
       CAPTION = "8"
       Left = 86
       Top = 120
       Width = 35
       Height = 33
       TabOrder = 7
       OnClick = Button8Click
      END CREATE
      CREATE Button9 AS QBUTTON
       CAPTION = "9"
       Left = 142
       Top = 120
       Width = 35
       Height = 33
       TabOrder = 8
       OnClick = Button9Click
      END CREATE
      CREATE Button10 AS QBUTTON
       CAPTION = "0"
       Left = 86
       Top = 168
       Width = 35
       Height = 33
       TabOrder = 9
       OnClick = Button10Click
      END CREATE
      CREATE Button11 AS QBUTTON
       CAPTION = "*"
       Left = 30
       Top = 168
       Width = 35
       Height = 33
       TabOrder = 10
       OnClick = Button11Click
      END CREATE
      CREATE Button12 AS QBUTTON
       CAPTION = "#"
       Left = 142
       Top = 168
       Width = 35
       Height = 33
       TabOrder = 11
       OnClick = Button12Click
      END CREATE
      CREATE Edit1 AS QEDIT
       Text = ""
       Left = 34
       Top = 228
       Width = 145
       TabOrder = 12
      END CREATE
      CREATE Button13 AS QBUTTON
       CAPTION = "&Enter"
       Left = 63
       Top = 257
       TabOrder = 13
       Default = 1
       OnClick = Button13Click
      END CREATE
      CREATE RichEdit1 AS QRICHEDIT
       Left = 217
       Top = 17
       Width = 273
       Height = 241
       TabOrder = 14
       AddStrings ""
      END CREATE
     END CREATE
'Insert your initialization code here
     IF Form.SHOWMODAL THEN

      MyPort.WriteString("ATZ" + CHR$(13) +CHR$(10), 1000)
      MyPort.CLOSE
     END IF
'--------- Subroutines ---------
     SUB Button1Click (Sender AS QBUTTON)

      Edit1.Text=Edit1.Text+"1"

     END SUB
     SUB Button2Click (Sender AS QBUTTON)

      Edit1.Text=Edit1.Text+"2"
     END SUB
     SUB Button3Click (Sender AS QBUTTON)

      Edit1.Text=Edit1.Text+"3"
     END SUB
     SUB Button4Click (Sender AS QBUTTON)

      Edit1.Text=Edit1.Text+"4"
     END SUB
     SUB Button5Click (Sender AS QBUTTON)

      Edit1.Text=Edit1.Text+"5"
     END SUB
     SUB Button6Click (Sender AS QBUTTON)

      Edit1.Text=Edit1.Text+"6"
     END SUB
     SUB Button7Click (Sender AS QBUTTON)

      Edit1.Text=Edit1.Text+"7"
     END SUB
     SUB Button8Click (Sender AS QBUTTON)

      Edit1.Text=Edit1.Text+"8"
     END SUB
     SUB Button9Click (Sender AS QBUTTON)

      Edit1.Text=Edit1.Text+"9"
     END SUB
     SUB Button10Click (Sender AS QBUTTON)

      Edit1.Text=Edit1.Text+"0"
     END SUB
     SUB Button11Click (Sender AS QBUTTON)

      Edit1.Text=Edit1.Text+"*"
     END SUB
     SUB Button12Click (Sender AS QBUTTON)

      Edit1.Text=Edit1.Text+"#"
     END SUB
'-----------------End DTMF WAV PLAY--------
     SUB ComError (strErrorMessage AS STRING)
      SHOWMESSAGE strErrorMessage
     END SUB
     SUB Button13Click (Sender AS QBUTTON)
'-- Enter your code here
      MyPort.WriteString ("AT &F E0 H0 Q0 V1 &D2"+CHR$(13) +CHR$(10),1000)
      MyPort.WriteString ("AT X4"+CHR$(13) +CHR$(10),1000)
      MyPort.WriteString ("AT +FCLASS=8; +VRN=0"+CHR$(13) +CHR$(10),1000)
      MyPort.WriteString ("AT +VSP=1; +VTD=8"+CHR$(13) +CHR$(10),1000)
      MyPort.WriteString ("ATM2"+CHR$(13) +CHR$(10),1000)
      MyPort.WriteString("ATDT "+Edit1.Text + CHR$(13) +CHR$(10),2000)

      MyPort.WriteString("AT+VSP=1"+ CHR$(13) +CHR$(10), 1000)
      MyPort.WriteString("AT+VLS=7"+ CHR$(13) +CHR$(10), 1000)
      MyPort.WriteString("AT+VLS=7 ;+VGS=127;+VGM=127"+ CHR$(13) +CHR$(10), 500)
     END SUB


掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Mon 2018-7-23  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2003-12-21 09:29:30