Basic - MPUSBAPI.DLL

 
Vista:

MPUSBAPI.DLL

Publicado por Oceano (2 intervenciones) el 31/05/2010 01:12:51
Hello!

How to translate to FreeBasic DLL (microchip) "mpusbapi.dll? I'm interested only five basic functions of the 10 he has:

* MPUSBOpen
* MPUSBRead
* MPUSBWrite
* MPUSBClose
* MPUSBGetDeviceCount

I tried to do the translations of VB or C++ to FreeBasic but without success:

(Is in FreeBasic)

[code]
Cls

Const MPUS_FAIL = 0
Const MPUSB_SUCCESS = 1
Const MP_WRITE = 0
Const MP_READ = 1
Const MAX_NUM_MPUSB_DEV = 127

Const Vid_Pid = "VID_04D8&PID_000A"
Const Outpipe = "\\MCHP_EP3"
Const Inppipe = "\\MCHP_EP3"

Dim As UInteger MyInpPipe
Dim As UInteger MyOutPipe

Dim As Integer Count

Dim As Any Ptr hLib

hLib = DylibLoad( "mpusbapi.dll" )
If hLib = 0 Then End

Dim Version As Function () As UInteger
Dim OpenUSB As Function ( ByVal As UInteger, ByVal As String, ByVal As String, ByVal As UInteger, ByVal As UInteger) As Integer
Dim ClosUSB As Function ( ByVal As String ) As Integer
Dim DevCont As Function ( ByVal As String ) As Integer

Version = DyLibSymbol( hLib, "_MPUSBGetDLLVersion" )
OpenUSB = DyLibSymbol( hLib, "_MPUSBOpen" )
ClosUSB = DyLibSymbol( hLib, "_MPUSBClose" )
DevCont = DyLibSymbol( hLib, "_MPUSBGetDeviceCount" )

Count = DevCont(Vid_Pid)

If (Count > 0) Then
MyOutPipe = OpenUSB( 0, Vid_Pid, Outpipe, MP_WRITE, 0 )
MyInpPipe = OpenUSB( 0, Vid_Pid, Inppipe, MP_READ, 0 )
Else
Print "Failed to open data pipes.!"
Sleep
End
EndIf

ClosUSB ( Outpipe )

Sleep

End
[/code]
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

MPUSBAPI.DLL

Publicado por Democrito de Abdera (2 intervenciones) el 29/10/2012 13:06:23
The answer here:

http://www.freebasic.net/forum/viewtopic.php?p=136968

or (spanish)

https://sites.google.com/site/proyectosroboticos/encoder/encoder-por-software/USB-MPUSBAPI-Bulk-Transfer
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar