Hi!
Do you know how I can reset the K8090 card?
or
Do you know how I can stop/restart the USB power supply (e.g. “COM6”) with a VB.NET command?
or
Do you know a MS-DOS command to stop/restart the USB power supply?
I created an VB.NET application (for the K8090) and sometimes, I have an “AccessViolationException” error.
(error message in french : tentative de lecture ou d’écriture de mémoire protégée. Cela indique souvent qu’une autre mémoire est endommagée.)
It happens when someone disconnect and reconnect the USB cable without sending the K8090.Disconnect() and K8090.Connect() VB.NET command.
The only way I found to reset the K8090 card is to disconnect and reconnect the USB cable again… but I would like to do this with a VB.NET command (or MS-DOS command).
Could you help me?
Thank you!
Oww, disconnecting a USB device while it is in use is a big no-no. There is no way that I know of to stop/restart an USB host, since this is not something a lot of people would want to do.
Windows does provide an API to detect if a device has been pluggin in / unplugged. It is not easy to use, but maybe .NET has created nice wrapper classes for it. The basic Windows API function is RegisterDeviceNotification.
Thank you!
In fact, I use the K8090 card to record times machining on CNC machines… (also to power up a stack light).
I know that disconnecting the USB device is not a good idea… but when the time machining is bad, the operators do this to stop the record (unfortunately it happens (rarely))!
With the VB.NET command “Try… Catch”, I can detect if the USB cable is disconnected and when it’s the case, I send this message on the screen: “the USB card is disconnected!”… and sometimes, another operator reconnect it.
In this case, the USB cable is reconnected but my program doesn’t work anymore (I can’t record anything)…
Could you tell me what happens on the K8090 at the point 5 below… What is the difference between the point 3 and 5 (memory reset)?
- the K8090 is correctly connected
- someone disconnect the USB cable
- someone reconnect the USB cable (the K8090 doesn’t work anymore)
- someone disconnect the USB cable again
- someone reconnect the USB cable again => the K8090 works correctly again.
Is that possible to reset the card (by sending data (VB.NET)) at point 3 (to do the same thing that happens on point 5)?
I’m afraid that everything that happens between point 2 and 5 is internal to Windows. The only thing the K8090 does is open a file handle to the COM port, which is almost identical to opening a regular file, so nothing special there. Windows probably recuperates between step 3 and 4.
The best way would be to detect when it’s being disconnected so you can close the connection in time.
OK understood!
Thank you for your help!
(and thank you for having created this K8090 card! Except this little problem, it works very good!)