K8055D.dll function ReadBackAnalogOut(AnalogOut) howto



I’m new in this forum and have the following problem:

I 've written a Module K8055N.py with Python V3.7.4 and I am using the original K8055D.dll from VELLEMAN (V5.0.0.0) with ctypes to control the USB-board on Windows 32-bit.

All functions work fine except the following one: ReadBackAnalogOut
and I have no idea on how to use this in Python.
I think, this function has the goal, to receive-back the momentary data from the two PWM’s when reconnecting the board. Am I right?
I 'm a little bit confused about the use of the expression “(*Buffer)” mentioned in the synthax-declaration in the dll-manual:

void ReadBackAnalogOut(int *Buffer);

Can anyone instruct me, how to code this function?
An example in Python3 would be appreciated.

Thanks in advance

int * Buffer is pointer to an array of two 32-bit integers where the data will be read.

Here an example in Delphi:

procedure TForm1.Button10Click(Sender: TObject);
var out_digital: integer;
out_analog: array[0..1] of integer;
  CheckBox6.checked:=(out_digital and 1)>0;
  CheckBox7.checked:=(out_digital and 2)>0;
  CheckBox8.checked:=(out_digital and 4)>0;
  CheckBox9.checked:=(out_digital and 8)>0;
  CheckBox10.checked:=(out_digital and 16)>0;
  CheckBox11.checked:=(out_digital and 32)>0;
  CheckBox12.checked:=(out_digital and 64)>0;
  CheckBox13.checked:=(out_digital and 128)>0;

Thank you for your answer VEL255.

But I do not know Delphi and as a Python-beginner too, I’m not able to figure out how to translate your suggestion in adequate Python-code.
Sorry - but this was the reason why I posted my wish to get an example in Python3 …

So I’m really dependent on a precise and eventually also commented example in Python3.

Here is an example written in Python 3:

import ctypes
from ctypes import *
import time

K8055dll = ctypes.WinDLL("K8055D.dll")

p0 = ctypes.c_long(0)

print ("\nOpening Device\n")

rc = K8055dll.OpenDevice(p0)

if (rc == -1):
	print ("Card was not found")

print ("\nTesting the Analog Output Channels\n")
print ("OutputAllAnalog(50, 200)")
K8055dll.OutputAllAnalog(50, 200)

print ("\nTesting  ReadBackAnalogOut()")
IntArray2 = c_int * 2
ia = IntArray2(0, 0)

print ("the value of Analog Channel 1 is: ")
print ("the value of Analog Channel 2 is: ")

print ("\n\nClosing Device\n")



Opening Device

Testing the Analog Output Channels

OutputAllAnalog(50, 200)

Testing  ReadBackAnalogOut()
the value of Analog Channel 1 is: 
the value of Analog Channel 2 is: 

Closing Device


Good morning VEL255,

thank you very much for your post.

I modified the code in my module accordant to your example and all works fine - and I’ve understood the operation of the buffer finally !

I’m so happy.

Have a nice day !

No problem. I’m glad the issue is now resolved.