Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dll for Kit
#9
I would use this function to open and close. Not tested.

Function KitInit
Code:
Copy      Help
;/
function# [close]

;Opens or closes kit.
;Error if fails to open.
;On Open returns kit card address.
;Can be called many times. If already open, will not try to open again. Error if already closed.

;Call this function before using kit functions:
;<code>KitInit</code>

;Call this function when QM exits, for example in a function with trigger "QM events -> file unloading", or from a destructor of a global variable:
;<code>KitInit 1</code>


dll K8055D
,#OpenDevice CardAddress
,CloseDevice
,OutputAnalogChannel Channel Data
,WriteAllDigital Data
,ClearAllDigital

int+ __g_kit ;;0 not opened, -1 closed, >0 open

if(__g_kit=-1) end "don't call this function after closing"

if close
,if __g_kit
,,__g_kit=-1
,,CloseDevice
,ret

if !__g_kit
,lock
,if !__g_kit
,,__g_kit=OpenDevice(0)+1
,,if(!__g_kit) end "failed to open kit"

ret __g_kit-1


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)