R
Ron
I'm running Excel 2000 on a Windows 2000 PC. I want to read data from a meter through a serial com port, and store the results in a spreadsheet. I can use the VBA code:
Open "COM1: 9600,N,8,1" for Input As #1
Input #1, A$
Close 1
but only if I first use "HyperTerminal" to initiate the connection to the meter. Why?
If I start HyperTerminal, connect to the meter, and then exit HyperTerminal, the Excel macro works fine (well, almost). If I just start Excel and run the macro, Excel never suceeds in connecting to the meter.
Also, if I put a For-Next loop around the "Input #1, A$" command to keep reading data from the meter, the connection fails after about 25 minutes. Restarting the macro reestablishes the connection just fine. If I put the For-Next loop around the Open/Close portion, then port doesn't time out - but I get garbage data every once in a while
I read KB article 148857 - but I don't see how to read from the COM port, only write to it. The WriteFile function is created in a Declare Function statement, but there isn't a corresponding ReadFile function
Can you offer any help? Thanks, Ron
Open "COM1: 9600,N,8,1" for Input As #1
Input #1, A$
Close 1
but only if I first use "HyperTerminal" to initiate the connection to the meter. Why?
If I start HyperTerminal, connect to the meter, and then exit HyperTerminal, the Excel macro works fine (well, almost). If I just start Excel and run the macro, Excel never suceeds in connecting to the meter.
Also, if I put a For-Next loop around the "Input #1, A$" command to keep reading data from the meter, the connection fails after about 25 minutes. Restarting the macro reestablishes the connection just fine. If I put the For-Next loop around the Open/Close portion, then port doesn't time out - but I get garbage data every once in a while
I read KB article 148857 - but I don't see how to read from the COM port, only write to it. The WriteFile function is created in a Declare Function statement, but there isn't a corresponding ReadFile function
Can you offer any help? Thanks, Ron