Here is the situation. I have a piece of hardware that reads machine pulses and sends data to the serial port of a Windows 2000 server. I can't say that I know what to expect when I monitor this port. Eventually, I want to add records to a SQL database, based on what the serial port receives.
I found some sample code. I went to the manufacturer's site to get the configuration data
When I have the rate set at 9600, I get a string of unreadable characters (such as a y with line above it). Is that Uncode? When I have the rate set a 19200 I get a series of vertical bars separated by an astrisk-like character. Neither case does me any good.Code:With MSComm1 'make sure the serial port is not open (by this program) If .PortOpen Then .PortOpen = False 'set the active serial port .CommPort = 1 'set the badurate,parity,databits,stopbits for the connection .Settings = "19200,N,8,1" 'set the DRT and RTS flags .DTREnable = True .RTSEnable = True 'enable the oncomm event for every reveived character .RThreshold = 1 'disable the oncomm event for send characters .SThreshold = 0 'open the serial port .PortOpen = True End With 'MSComm1
I am using thsi code to read the pulses
I have never tried this before, so I do not know what to expect to see. I was hoping to see a machine number, and a time stamp.Code:Private Sub MSComm1_OnComm() Dim strInput As String With MSComm1 'test for incoming event Select Case .CommEvent Case comEvReceive 'display incoming event data to displaying textbox strInput = .Input Text1.SelText = strInput End Select End With 'MSComm1 End Sub
I'm thinking that I need to do something in the CommEvent code to translate the input.
Any help would certainly be appreciated.




Reply With Quote