PDA

View Full Version : Time to transfer data in EasyHID



Demon
- 21st August 2006, 02:06
Does anyone else have a slight lag when transmitting data from the PC to PIC? Oddly enough transferring data from the PIC to PC is extremely fast.

I'm wondering if it's just me and my lousy coding abilities or if the USB bus on my PC has a lot of overhead (I would expect that to affect traffic both ways).

Robert
:)

Demon
- 21st August 2006, 06:52
Yup, it was me.

The transfer is faster than the human eye in both directions, awesome!

Robert
:)

mister_e
- 21st August 2006, 16:17
Robert, i guess it's time for you to have a break and relax ;) Hey, there's still 56.2 years remaining now for your project? :D

I have some Truck-mechanic problem and i will have to stay here for few days. Most of those pending job are on the test bench. I'm about to begin a 'Easy USB for dummies' short tutorial to be posted here. If i finish this house-bench-cleanning soon, i should have time to do it and post it here this week. I guess it could be handy for few guys here. Well i guess.

Demon
- 21st August 2006, 18:21
I finally got everything up and running. VB6 is fun once you get into the hang of things, but there's so many tricks, so much flexibility. Programming the PC interface is going to be another project in itself.

Now I'm getting back in that VB6 tutorial I started a few months ago; I'm at the database access section. I defined a basic database for my application in Access (saved in 2000 format), but I'm getting an error when I try to use it in VB6; something about unknown database format. I figure VB6 can only read an older format like Access97 which probably means having to work in Windows '98 again.

Looks like I might have to set up that other PC with dual partition after all (Win XP and '98). I've been putting that off for a while now, ugh...

Robert
:)

keithdoxey
- 21st August 2006, 19:56
Now I'm getting back in that VB6 tutorial I started a few months ago; I'm at the database access section. I defined a basic database for my application in Access (saved in 2000 format), but I'm getting an error when I try to use it in VB6; something about unknown database format. I figure VB6 can only read an older format like Access97 which probably means having to work in Windows '98 again.


Access 2000 works fine with VB6.

Add in Component "Microsoft ADO Data Control 6.0 (OLEDB)"

I have the following declarations in my project

Dim adoConn As New ADODB.Connection
Dim adoRS As New ADODB.Recordset

strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
strConn = strConn & "K:\HTML\db\KAT5AV.mdb"
adoConn.ConnectionString = strConn
adoConn.Open

Its a couple of years since I wrote that program but I am pretty sure that your problem is the provider. I think Access 2000 needs Jet4 whereas Access97 was Jet 3.5.

You definately dont need to revert to Win98 as I am running XP.

I actually have a web front end for the database which I use for entering and editing data, my VB app only reads the database for sending commands out of a Comm port although there is no reason why it could be done the opposite way round with VB receiving data and inseeting records into a database that could then be read on a web browser.

Any updates you need including service packs for VB6 should be on the Microsoft website.... somewhere!!!! :)

HTH

Demon
- 21st August 2006, 20:11
Thanks much!

I tried installing Office 97 on Win XP, not a good idea. :lol:

I'll try your suggestion after I spend some time with my girls.

Robert
:)

Demon
- 21st August 2006, 21:29
Ooops, missed that statement:

"Add in Component "Microsoft ADO Data Control 6.0 (OLEDB)""

I looked for it but I don't have it, at least not spelled that way. Can you tell me what the file name is for that reference? You can see it when you click on the reference. I might have better luck finding it that way.

Robert
:)

keithdoxey
- 21st August 2006, 22:16
Hi Robert,

I was thinking about this as I was out driving and realised I hadnt checked what references I had included.

Microsoft DAO 3.6 Objects Library
Microsoft ActiveX Data Objects 2.7 library

You have added MDAC 2.8 which is newer than MDAC 2.7 that I have included but I have just tried with 2.8 and it works fine.

Make sure you are using the JET4.0 provider not JET3.51

http://www.devx.com/vb2themax/Tip/18535

I just changed my code to

strConn = "Provider=Microsoft.Jet.OLEDB.3.51;Data Source="
strConn = strConn & "K:\HTML\db\KAT5AV.mdb"
adoConn.ConnectionString = strConn
adoConn.Open

and got the error you are getting.

http://support.microsoft.com/kb/q238401/

says that This problem was first corrected in Visual Studio 6.0 Service Pack Service Pack 4

Service pack available here

http://msdn.microsoft.com/vstudio/downloads/updates/sp/vs6/sp6/default.aspx

Demon
- 21st August 2006, 22:32
Thanks Keith, tried with them and I still get the error.

I'm downloading service pack 6 now.

Robert
:)

EDIT: Nope, same error, unrecognized database format. :( Tried with Microsoft ActiveX Data Objects 2.7 library, I also tried inverting the 2 references in case priority was important, same error.

Demon
- 21st August 2006, 22:50
I put the code when I load the form, is that ok?

Private Sub Form_Load()
Dim adoConn As New ADODB.Connection
Dim adoRS As New ADODB.Recordset

strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
strConn = strConn & "E:\EasyHID\Xk1 v2\USBProject\VisualBASIC\Modified code\NR2003.mdb"
adoConn.ConnectionString = strConn
adoConn.Open
End Sub

Or should I make another subroutine for this?

Robert
:)

keithdoxey
- 21st August 2006, 23:04
Ooops, missed that statement:

"Add in Component "Microsoft ADO Data Control 6.0 (OLEDB)""

I looked for it but I don't have it, at least not spelled that way. Can you tell me what the file name is for that reference? You can see it when you click on the reference. I might have better luck finding it that way.

Robert
:)

Its a COMPONENT not a REFERENCE

Project>>Components (or CTRL+T)

C:\Windows\System32\MSADODC.OCX

keithdoxey
- 21st August 2006, 23:11
I put the code when I load the form, is that ok?

Private Sub Form_Load()
Dim adoConn As New ADODB.Connection
Dim adoRS As New ADODB.Recordset

strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
strConn = strConn & "E:\EasyHID\Xk1 v2\USBProject\VisualBASIC\Modified code\NR2003.mdb"
adoConn.ConnectionString = strConn
adoConn.Open
End Sub

Or should I make another subroutine for this?

Robert
:)

Thats exactly where I put it !



Private Sub Form_Load()
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
strConn = strConn & "K:\HTML\db\KAT5AV.mdb"
adoConn.ConnectionString = strConn
adoConn.Open
MSComm1.CommPort = 3
If MSComm1.PortOpen = False Then MSComm1.PortOpen = True
End Sub


Having said that, the one big difference I see is that you declare your adoConn and adoRS within the subroutine therefore they are not global variables and once you leave Form_Load they arent accessable.

Mine are declared in General Declarations.

Demon
- 21st August 2006, 23:52
Ok, fixed the Components and the code, still got the same error. Do you have more components or references?

Robert
:)

Demon
- 21st August 2006, 23:56
I checked in Access and I have version 2000 set by default. 2002 is there but not enabled.

Robert
:)

keithdoxey
- 22nd August 2006, 00:00
Ok, fixed the Components and the code, still got the same error. Do you have more components or references?

Robert
:)

Just checked, the only other Component is Microsoft Comm Control 6.0 but that is for the serial port so is irrelevant.

I do have one more reference.... OLE Automation ... maybe that is the problem. c:\windows\system32\stdole2.tlb

If that doesnt work can you email me a copy of the database and I will see if I can open it.

keith at diyha dot co dot uk

Demon
- 22nd August 2006, 00:04
Nope, not it, but I did notice one thing while I was checking Access. It says SP3 even though I just ran SP6. I think I screwed up the update.

When the download says "Where do you want to extract the files?", where do I want it to go? Here?
E:\Microsoft Office\Office10

I had extracted to a temporary folder and ran SETUP.

Robert
:)

keithdoxey
- 22nd August 2006, 00:25
Nope, not it, but I did notice one thing while I was checking Access. It says SP3 even though I just ran SP6. I think I screwed up the update.

When the download says "Where do you want to extract the files?", where do I want it to go? Here?
E:\Microsoft Office\Office10

I had extracted to a temporary folder and ran SETUP.

Robert
:)

Just looked at my Laptop and Help>>About didnt seem to indicate a service pack version so I looked in the VB98 directory and all the files were dated 1998.

I had the VB6 service pack on another machine so I extracted it to
c:\temp\vb6sp6\
and ran setupsp6.exe which installed the service pack. Didnt even have to reboot. Now the spash screen indicates SP6 and so does Help>>About

Why are you going to the MS office folders when you are trying to update Visual Basic ?

What I dont understand is why my laptop was working when I didnt have any service packs installed unless Windows XP already has some updated files that VB used.

Before I installed the service pack I created a very basic project from scratch using just the components and references already discussed and using just the ado declarations and setup in Form_Load and that didnt produce any error.

Beats me :(

I'm wondering if it is the database that is messed up rather than VB

Demon
- 22nd August 2006, 02:56
D'uh, 'cause I was rushing on my way out the door for an appointment and I looked at the wrong application. I just checked VB6, it is SP6.

I'll mail you the database and see if you can run it. I click START and get that error.

Robert
:)

EDIT: Keith, I've uploaded the files to my site so you can download them whenever you want (details in email).


GOT IT!


Just above the database name in the Form Properties box there is an item called Connect. That had Access, I changed it to Access 2000 and it works. Thanks Keith!

keithdoxey
- 22nd August 2006, 12:27
GOT IT!

Just above the database name in the Form Properties box there is an item called Connect. That had Access, I changed it to Access 2000 and it works. Thanks Keith!

Dont you just love the way Microsoft have about 15 different ways to do everything !!!!

I dont have either "Connect" or "DatabaseName" in my form properties so you must be using an object or control that I dont use.

Glad its sorted :)

Demon
- 22nd August 2006, 15:54
Sorry, it wasn't on the Form, it was on the Data item with the left/right scroll bars in the middle of the screen.

Hopefully we'll get a place where we can discuss this subject without polluting other threads. I don't consider it off-topic either 'cause it is very relevant to USB and EasyHID:
http://www.picbasic.co.uk/forum/showthread.php?t=4490

Robert
:)

keithdoxey
- 22nd August 2006, 17:06
Sorry, it wasn't on the Form, it was on the Data item with the left/right scroll bars in the middle of the screen.

Ah!

I dont have one of those in my project. Just added one and could see the properties you were referring to.