Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem communicating with Digital I/O Card
Message
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Titre:
Problem communicating with Digital I/O Card
Divers
Thread ID:
00395294
Message ID:
00395294
Vues:
143
Hi everyone,

I'm trying to communicate with an I/O card ( modell Advantech PCL-725 ) , but all the samples in the documentation is for Visual C++, Visual Basic, Borland C++ and Borland Delphi.
The sampleprogram I am looking at is the one for VB, because my knowledge in the other languages is about ZERO ( and for VB just a little bit better ). All communications with the
I/O-card is done thru DLL- calls to ADSAPI32.DLL.

The main problems is:

1. Syntax for DLL declarations
2. Samples for VB use structures. How do I use structures in VFP ?


Can someone help me with these two declarations and tell me how it should be done in VFP (there are about 30 more to fix , but I hope
that help with these two , might make it possible for me to fix the main part of the rest myself).



Declare Function DRV_SelectDevice Lib "adsapi32.dll" (ByVal hCaller As Long, ByVal GetModule As Boolean, DeviceNum As Long, ByVal Description As String) As Long

Declare Function DRV_DeviceGetFeatures Lib "adsapi32.dll" (ByVal DriverHandle As Long, lpDevFeatures As PT_DeviceGetFeatures) As Long




Some of the code from module Code.bas :

Type PT_DEVLIST
dwDeviceNum As Long
szDeviceName(0 To 49) As Byte
nNumOfSubdevices As Integer
End Type

Type PT_DeviceGetFeatures
buffer As Long ' LPDEVFEATURES
size As Integer
End Type

Type DEVFEATURES
szDriverVer(0 To 7) As Byte ' device driver version
szDriverName(0 To (MAX_DRIVER_NAME_LEN - 1)) As Byte ' device driver name
dwBoardID As Long ' board ID
usMaxAIDiffChl As Integer ' Max. number of differential channel
usMaxAISiglChl As Integer ' Max. number of single-end channel
usMaxAOChl As Integer ' Max. number of D/A channel
usMaxDOChl As Integer ' Max. number of digital out channel
usMaxDIChl As Integer ' Max. number of digital input channel
usDIOPort As Integer ' specifies if programmable or not
usMaxTimerChl As Integer ' Max. number of Counter/Timer channel
usMaxAlarmChl As Integer ' Max number of alram channel
usNumADBit As Integer ' number of bits for A/D converter
usNumADByte As Integer ' A/D channel width in bytes.
usNumDABit As Integer ' number of bits for D/A converter.
usNumDAByte As Integer ' D/A channel width in bytes.
usNumGain As Integer ' Max. number of gain code
glGainList(15) As GainList ' Gain listing
dwPermutation(3) As Long ' Permutation
End Type


Code from module Global.bas :

Global Const MaxEntries = 255
Global DeviceHandle As Long
Global ptDevGetFeatures As PT_DeviceGetFeatures
Global lpDevFeatures As DEVFEATURES
Global devicelist(0 To MaxEntries) As PT_DEVLIST
Global SubDevicelist(0 To MaxEntries) As PT_DEVLIST
Global ErrCde As Long
Global szErrMsg As String * 80
Global bRun As Boolean

Global lpDioPortMode As PT_DioSetPortMode
Global lpDioReadPort As PT_DioReadPortByte
Const ModeDir = 0 ' for input mode


Thanks in advance

Torgny
/Torgny
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform