Jump to content
  • 0

Initial counter setting in the pattern generator with AD2.


Kawai

Question

Hello.

 

I’m trying to generate the custom data by using pattern generator in Analog Discovery 2. Although I set the digital output mode as custom, the output data is depend on the setting of the FDwfDigitalOutCounterInitSet. For example, I try this code and the custom data is not come from the pattern generator.

 

rg(0) = &HAFAFAFAF

FDwfDigitalOutTypeSet(hdwf, 7, 1)

FDwfDigitalOutDataSet(hdwf, 7, rg(0), 32)

 

Then I add the FDwfDigitalOutCounterInitSet and the output data is successfully generated.

 

rg(0) = &HAFAFAFAF

FDwfDigitalOutTypeSet(hdwf, 7, 1)

FDwfDigitalOutCounterInitSet(hdwf, 7, 1, 10)

FDwfDigitalOutDataSet(hdwf, 7, rg(0), 32)

 

What does the FDwfDigitalOutCounterInitSet mean when the output mode is custom?

Link to comment
Share on other sites

10 answers to this question

Recommended Posts

Hi @Kawai

The FDwfDigitalOutCounterInitSet is intended to be used with pulse mode, to specify initial pulse length, to create different phase between channels.
Applying this in custom mode it will set the start index of the pattern, like specifying 10 for 32 bit pattern it will start with bit 22 (32-10)

The custom pattern should work without counter init, like it is working from Python or C application...
Could you send me the VBA project to test it?

Link to comment
Share on other sites

Hi @Kawai

It seems the dwf.dll can't be used directly from VBA. This does not support C functions only WIN API.

I modified your example to use the dwfw.dll, copied this to C:\Windows\SysWOW64\ . On 64bit Windows this is the 32bit System directory when viewed with 64bit application.
The hAF output is as expected.

AD2_PG_Debbug.xlsm

dwfw.dll from: https://shop.trenz-electronic.de/en/Download/?path=Digilent/27069-Analog Discovery 2

i1.png.cc763c5052de17d7c004774ac9567f41.png

Link to comment
Share on other sites

Hi Attila

 

I tried your excel but it doesn’t work.

In my condition, I have to change declare sentence like this because of the 64bit excel.

 

Public Declare PtrSafe Function FDwfDeviceOpen_ Lib "dwfw.dll" (ByVal idxDevice As Long, ByRef phdwf As Long) As Long

 

And I put the dwfw.dll and excel macro into the folder C:\Windows\SysWOW64\ .

But it doesn’t work because dwfw.dll is not found.

Do you confirm VBA in 64bit excel ?

Link to comment
Share on other sites

Hi attila,

The dwfw.dll file that you attached does not work.

The error message is that FDwfDeviceConfigOpen_ is not found in  the DLL file.

 

The dwfw.dll file in the web page

https://shop.trenz-electronic.de/en/Download/?path=Digilent/27069-Analog Discovery 2

also does not work.

The error message is that dwfw.dll is not found.

 

I think your VBA code works well by using 32 bit excel in 64bit OS and dll file in the web page. I want to use 64bit excel and the both dll file does not work well.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...