Here it is: MSComm1.InputLen = 10 For I = 1 To 16 DoEvents 'Remember the line someone said don't use? I don't mind losing the points, but I've seen a lot of points go for VERY bad attempts at answers. The only reason I demanded that the question not be locked before I posted was because, a lot of the time, I post a comment that the asker thinks is perfect (or at least good enough) to solve his/her problem but accepts a previously posted answer. Advantages: Allows you to process data as you want Allows you to receive unparsed. Receive data from RS232 to Excel with help of our ActiveX control. Requires Excel on the production PC, if you'll add charts and formulas to an Excel files, then this link will be very slow Requires small VBA knowledge. SzInput = MSComm1.Input If szInput Like '*OK*' Or szInput Like '*AT*' Then ' This is a modem port, don't use it TestComm = False Else ' Assume no modem or terminal attached TestComm = True End If ' End of test, close the port if it was open If MSComm1.PortOpen Then MSComm1.PortOpen = False End If ' Return True or False Exit Function TESTFAIL: ' An error ocurred in opening the port If MSComm1.PortOpen Then ' Close the port if it was opened MSComm1.PortOpen = False End If ' Save the last error LastCommErr = Err.Number ' Clear the error Err.Clear TestComm = False ' Return False End Function. MSComm1.PortOpen = True ' Test to see if this port is a modem MSComm1.Output = 'AT&N6' + Chr$(13) 'Enable our timer so we don't get caught in the loop Timer1.Enabled = True 'Reset the Timeout flag bTimeout = False Do If bTimeout Then 'No characters received Exit Do End If DoEvents Loop Until MSComm1.InBufferCount >= 2 ' Disable the timer Timer1.Enabled = False ' Read the 'OK' or 'AT' response data in the serial port. MSComm1.Settings = '9600,n,8,1' ' Tell the control to read entire buffer when Input is used. Here is a sample I use to test comm 1 thru 4 to see if it is available for use as a serial port (no modem) Function TestComm(Port As Integer) As Boolean Dim szInput As String ' Only test COM1 thru COM4 If Port 4 Then TestComm = False Exit Function End If On Error GoTo TESTFAIL ' Set the com port number MSComm1.CommPort = Port ' 9600 baud, no parity, 8 data, and 1 stop bit. Let the Force be your guide and head on over to the today to download your favorites! And speaking of fun, additional voices can also be found at. (Continue reading below for video samples of Yoda and Darth Vader.) If you're going to be away from your friends and family on travel and want familiar voices to keep you company, it's as simple as using to record them speaking the commands and directions (and they can even have some fun with the phrases).
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |