Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > it.comp.lang.visual-basic > #18926

Re: MSComm e USB

From Gulp® <gulp@hotmail.it>
Newsgroups it.comp.lang.visual-basic
Subject Re: MSComm e USB
Date 2016-11-28 23:47 +0100
Organization Aioe.org NNTP Server
Message-ID <o1ic6f$16pn$1@gioia.aioe.org> (permalink)
References <nuncmf$1otd$1@gioia.aioe.org> <lohu0c1qav6e68qkhmh0cnsop8tp75lpj2@4ax.com> <nunjk3$63r$1@gioia.aioe.org> <5emu0c5r4q498dco9fdql8vaverfc86rn2@4ax.com>

Show all headers | View raw


Il 25/10/16 15:19, SB ha scritto:
> Il giorno Tue, 25 Oct 2016 14:36:21 +0200, Gulp® <gulp@hotmail.it> ha scritto:
>
> Potresti avere usato i comandi di sincronismo, RTS\ CTS\, o potrebbe essere il
> protocollo di handshake, il convertitore potrebbe anche mandare la risposta
> quando non lo leggi, devi indagare.

Allora, funziona, o meglio non è sordo come pensavo.
All'arrivo dello squillo si apre la finestra che dovrebbe visualizzarmi 
la scritta con l' ID del chiamante...ma la stringa, a quanto pare, 
risulta uguale a zero e la finestra rimane vuota. Mah.

Questo il "cuore" del codice:

Private Sub CallerID()
On Error GoTo errore
If COM1.PortOpen = True Then Exit Sub
COM1.CommPort = PortaModem
COM1.InputMode = comInputModeBinary
COM1.PortOpen = True
COM1.Output = "ATV1Q0" & vbCr
Wait 1
COM1.Output = "AT#CID=1" & vbCr
Wait 1
COM1.PortOpen = False  'per svuotare il buffer
COM1.PortOpen = True
Exit Sub
errore:
ErrTelef
End Sub

Private Sub COM1_OnComm()
'Evento sulla porta
If COM1.CommEvent = comEvRing Then
Suona App.Path & "\ringin.wav", 1
End If
AscoltaPorta     'legge i dati in arrivo alla porta
frmCaller.Attesa 'mantiene aperto il form finchè squilla il telefono
End Sub

Private Sub AscoltaPorta()
   Dim buffer As Variant
   Dim arr() As Byte
   Dim dato As String
   Dim n As Long
   Dim tsyn As Single

   dato$ = ""
   tsyn = Timer + 10
   While dato$ = "" And Timer < tsyn
     ' Controlla la presenza di dati.
     If COM1.InBufferCount Then
       ' Legge i dati.
       COM1.InputLen = 0   'COM1.InBufferCount
       buffer = COM1.Input
       COM1.InputLen = 0
       arr = buffer
       ' Converte i dati letti in una stringa
       For n = 0 To UBound(arr)
          dato$ = dato$ + Chr$(arr(n))
       Next n
     End If
   Wend
stringas = dato$
If InStr(stringas, "DATE") > 0 Then
Dati
End If
End Sub



-- 
Gulp®
--
"Partimque figuras retulit antiquas, partim nova monstra creavit."
(La Metamorfosi - Ovidio)

Back to it.comp.lang.visual-basic | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

MSComm e USB Gulp® <gulp@hotmail.it> - 2016-10-25 12:38 +0200
  Re: MSComm e USB SB <stNOOObenevSPAM@tin.it> - 2016-10-25 14:03 +0200
    Re: MSComm e USB Gulp® <gulp@hotmail.it> - 2016-10-25 14:36 +0200
      Re: MSComm e USB SB <stNOOObenevSPAM@tin.it> - 2016-10-25 15:19 +0200
        Re: MSComm e USB Gulp® <gulp@hotmail.it> - 2016-11-28 23:47 +0100
          Re: MSComm e USB SB <stNOOObenevSPAM@tin.it> - 2016-11-29 11:26 +0100
            Re: MSComm e USB Gulp® <gulp@hotmail.it> - 2016-12-01 16:22 +0100
              Re: MSComm e USB SB <stNOOObenevSPAM@tin.it> - 2016-12-01 17:45 +0100
                Re: MSComm e USB SB <stNOOObenevSPAM@tin.it> - 2016-12-02 19:28 +0100
            Re: MSComm e USB Gulp® <gulp@hotmail.it> - 2016-12-01 16:28 +0100
              Re: MSComm e USB SB <stNOOObenevSPAM@tin.it> - 2016-12-01 17:35 +0100
  Re: MSComm e USB Franz_aRTiglio <franzgol@N0SPAMtin.it> - 2016-12-02 17:45 +0100

csiph-web