Private Sub MSComm1_OnComm()Dim t As String, i As Long, tline As String Select Case MSComm1.CommEvent Case comEvReceive: t = MSComm1.Input 'ShowText t rxbuffer = rxbuffer & t Do While True 'parse receive data here i = InStr(1, rxbuffer, vbCr) 'look for enter If i > 0 Then tline = Mid(rxbuffer, 1, i) rxbuffer = Mid(rxbuffer, i + 1) ser_parse2 tline Else Exit Do End If Loop End SelectEnd SubPrivate Sub connect_comm()Dim t As IntegerOn Error GoTo err m_busy = False 'Debug.Print "Port:", CommPort If MSComm1.PortOpen = False Then t = CInt(Trim("0" & Mid(CommPort, 4))) Debug.Print "COM PORT: " & t With MSComm1 .CommPort = t .Settings = "115200,n,8,1" .Handshaking = comNone .InBufferSize = 1024 .OutBufferSize = 0 .RThreshold = 1 .SThreshold = 0 .InputLen = 0 .EOFEnable = False .NullDiscard = False .RTSEnable = True .DTREnable = True .PortOpen = True End With End If rxbuffer = "" 'CmdReset_Click Exit Suberr: MsgBox "Communications Error!" Exit SubEnd Sub
Snippet from an old vb proj using mscomm.Code: [Select]Private Sub MSComm1_OnComm()Dim t As String, i As Long, tline As String Select Case MSComm1.CommEvent Case comEvReceive: t = MSComm1.Input 'ShowText t rxbuffer = rxbuffer & t Do While True 'parse receive data here i = InStr(1, rxbuffer, vbCr) 'look for enter If i > 0 Then tline = Mid(rxbuffer, 1, i) rxbuffer = Mid(rxbuffer, i + 1) ser_parse2 tline Else Exit Do End If Loop End SelectEnd SubPrivate Sub connect_comm()Dim t As IntegerOn Error GoTo err m_busy = False 'Debug.Print "Port:", CommPort If MSComm1.PortOpen = False Then t = CInt(Trim("0" & Mid(CommPort, 4))) Debug.Print "COM PORT: " & t With MSComm1 .CommPort = t .Settings = "115200,n,8,1" .Handshaking = comNone .InBufferSize = 1024 .OutBufferSize = 0 .RThreshold = 1 .SThreshold = 0 .InputLen = 0 .EOFEnable = False .NullDiscard = False .RTSEnable = True .DTREnable = True .PortOpen = True End With End If rxbuffer = "" 'CmdReset_Click Exit Suberr: MsgBox "Communications Error!" Exit SubEnd Sub
sa excel po b mismo mkikita ung ms comm?
paran gnito po ung lumalabas na stream sa hyperterminal na gsto po sna nmin dalhin sa excel.... 7179-717908234-234576238904-7179-717908234-234576238904prang ganyan po sya. example ko lng po ung bnigay bnigay ko. nsa laptop po kc ng grupm8 ko ung data.
Example A B C7119 717908234 2345762389047179 717908234 234576238904
#!/usr/bin/pythonimport syss = sys.stdin.read()ls = s.split('-')for line in ls: print line;
#include <stdio.h>int main(void){ int c; while ((c=getc(stdin))!=EOF) { if (c=='-') { putchar('\r'); putchar('\n'); } else putchar(c); }}
tnx po...salamat po sa mga tumutulong sa amin... sir try po muna uit nmin, ngloko po bla ug hrdware nmin eh....
nagamit ko sa C# .NET (pwede rin sa VB.net) using COM objects... yung data na dumeretcho sa excel... may serialport class na din ang .NET... possible yan...