-
Using a DAQ + VB6.0
Hey everyone,
I'm very new to VB and I'm doing a school project very similar to the "Dance Dance Revolution" game with a dance pad along with a USB-1024LS data acquisition board (DAQ) and then programing the actually game/GUI using VB6.0. (Just a quick background on the dance if people don't know about it, the user has to step on a dance square whenever the an arrow is displayed on a GUI. At the end the game will show the user's score... higher the score the more correct dance steps were taken.) I actually tested my board and I received the voltages from my homemade dance pad I made.
Now the problem is that I'm using the MSComm control to read the outputs of the voltages but I'm having a hard time figuring this out... I looked at the microsoft website and they have a sample code using MSComm with a microcontroller but I get errors for the settings code at the top of the code saying "object required." I placed just a textbox and the MSComm control because I want the program to read the output voltages (in ASCII?) in the textbox.
Code was found from the microsoft website:
Private Sub Form_Load()
Form1.Caption = "App2"
With MsComm2
.CommPort = 2
.Handshaking = 2 - comRTS
.RThreshold = 1
.RTSEnable = True
.Settings = "9600,n,8,1"
.SThreshold = 1
.PortOpen = True
' Leave all other settings as default values.
End With
Text1.Text = ""
End Sub
Private Sub Form_Unload(Cancel As Integer)
MsComm2.PortOpen = False
End Sub
Private Sub MSComm1_OnComm()
Dim InBuff As String
Select Case MSComm1.CommEvent
' Handle each event or error by placing
' code below each case statement.
.
' Errors
Case comEventBreak ' A Break was received.
Case comEventCDTO ' CD (RLSD) Timeout.
Case comEventCTSTO ' CTS Timeout.
Case comEventDSRTO ' DSR Timeout.
Case comEventFrame ' Framing Error.
Case comEventOverrun ' Data Lost.
Case comEventRxOver ' Receive buffer overflow.
Case comEventRxParity ' Parity Error.
Case comEventTxFull ' Transmit buffer full.
Case comEventDCB ' Unexpected error retrieving DCB]
' Events
Case comEvCD ' Change in the CD line.
Case comEvCTS ' Change in the CTS line.
Case comEvDSR ' Change in the DSR line.
Case comEvRing ' Change in the Ring Indicator.
Case comEvReceive ' Received RThreshold # of chars.
InBuff = MSComm1.Input
Call HandleInput(InBuff)
Case comEvSend ' There are SThreshold number of
' characters in the transmit buffer.
Case comEvEOF ' An EOF character was found in the
' input stream.
End Select
End Sub
Sub HandleInput(InBuff As String)
' This is where you will process your input. This
' includes trapping characters, parsing strings,
' separating data fields, etc. For this case, you
' are simply going to display the data in the TextBox.
Text1.SelStart = Len(Text1.Text)
Text1.SelText = InBuff
End Sub
If anybody knows how to use MSComm with a DAQ board please help me out :) :)
Thanks!!
-
Re: Using a DAQ + VB6.0
Maybe a stupid question but is yoru comm control actually named MSComm2?
If not that could be the error.
The line .Handshaking = 2 - comRTS will not work properly and in effect it will turn the handshaking off as 2 - comRTS = 0
Which line is shown as triggering the object error?
-
Re: Using a DAQ + VB6.0
Or, your OS, or you Firewall, but I suspect the port.
I think you deleted MSCOM1 and created a new one, making it MSCOM2
Your code doesn't see that.
Start the project again, or change the settings.
Press F8 to start the app, one step at a time. Should be easier to diagnose
-
Re: Using a DAQ + VB6.0
Dear Sir / Madam,
hi this my fill project for clubs members
i used a DAO sorry for that
please i need to use ADO but don't know and when i try ADO the record count return -1
please help me and tell me what is your opinions about my code this code run on 6 computers but database size more it not work good
i want one form from my forms run with ADO
thank you
You have successfully uploaded a file to Uploading.com service, please find links for the file management below:
File name: send.rar
Download link: http://uploading. com/files/ get/877d3e2b/ send.rar/
Edit/Delete link: http://uploading. com/files/ edit/3f94ed7m/
HTML code: <a href="http://uploading. com/files/ get/877d3e2b/ send.rar/">Download send.rar for free on uploading.com< /a>
Forum/BB code: [url=http://uploading. com/files/ get/877d3e2b/ send.rar/] Download send.rar for free on uploading.com[ /url]
Thank you for using Uploading.com file hosting service. Should you have any questions about your files please contact our support team.
Regards,
Uploading Team.
-
Re: Using a DAQ + VB6.0
Here you go. Look at this link and download ths code attachment.
Run it, and read the article again.
DAO is very old. ADO is newer, but sill old.
-
Re: Using a DAQ + VB6.0
It was MSComm1 before but i got an error so i changed the 1 to a 2 and i didn't get an error for it. It told me MSComm1 was an invalid port.
Thank you everyone for replying! I really appreciate it!
-
Re: Using a DAQ + VB6.0
To get the recordcount of an ado recordset use a client side cursor.
Connection.Cursor=adUseClient
-
Re: Using a DAQ + VB6.0
Hey,
I was reading that MSComm doesn't work using a USB bus... I got Visual Studio and I'm trying to use the serial port component. Does anybody know how to use this component? I tried using sample codes from the microsoft website but nothing seems to work. Does anybody have any suggestions/simple code that will help me just read the voltage values my dance mat generates?