Jump to content

As of July 17, 2015, the LabJack forums here at forums.labjack.com are shut down. New registrations, topics, and replies are disabled. All forums are in a read-only state for archive purposes.

Please visit our current forums at labjack.com/forums to view and make new posts. To post on the current forums, use your labjack.com login account. Your old LabJack forums login credentials have been retired. There are no longer separate logins for labjack.com and LabJack forums.


Photo

program Labjack with C++


  • Please log in to reply
6 replies to this topic

#1 rafik_mak

rafik_mak
  • Members
  • 4 posts

Posted 17 July 2013 - 12:39 PM

Hi

I have to write a program with C++ to connect a graphical user interface  to labjack U6 .There are  two inputs (time and power) and  I don't know how to begin . How can I connect this inputs to the inputs of labjack. What's a request and how to link it with my project. Is there any tutorial.

 

Thanks for your help and sorry for my bad english 



#2 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 18 July 2013 - 10:26 AM

Start by reading Section 4 of the U6 User's Guide which covers the Windows driver:

 

http://labjack.com/s...6/users-guide/4

 

In particular, eAIN() is an easy way to read a voltage from an analog input:

 

http://labjack.com/s...ers-guide/4.3.9

 

Then get the VC6_LJUD archive and check out the example "U6_EFunctions":

 

http://labjack.com/s...ud/examples/vc6



#3 rafik_mak

rafik_mak
  • Members
  • 4 posts

Posted 07 August 2013 - 04:18 AM

hi

I have many questions for my project could you help me  :unsure:

1) what's the difference between AddRequest(lngHandle, LJ_ioGET_DIGITAL_BIT, 0, 0, 0, 0)  and eDI(lngHandle,0, &lngState)

2) the voltage is proportional to the input (y = (-1 /200) x * + 5); How can I program it ?

thank you  :rolleyes:



#4 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 07 August 2013 - 11:14 AM

1.  The following are all equivalent:

 

        eDI (lngHandle, 0, &lngState)

 

... is the same as:

 

        eGet (lngHandle, LJ_ioGET_DIGITAL_BIT, 0, &lngState, 0)

 

... is the same as:

 

        AddRequest (lngHandle, LJ_ioGET_DIGITAL_BIT, 0, 0, 0, 0)

        GoOne (lngHandle)

        GetResult (lngHandle, LJ_ioGET_DIGITAL_BIT, 0, &lngState)

 

2.  Are you saying that your scaled value is equal to ((-1/200)*volts)+5?  If so, then you just want code such as:

 

        eAIN (lngHandle, 0, 199, &dblVoltage, LJ_rgBIP10V, 0, 0, 0, 0, 0)

        scaled =  ((-1/200)*dblVoltage)+5

 

3.  Don't forget errorchecking.  It is not shown in the pseudocode above, but you should check for an error after every function call to the UD driver.



#5 rafik_mak

rafik_mak
  • Members
  • 4 posts

Posted 07 August 2013 - 12:48 PM

I mean the result of expression volts=((-1/200)*my_input)+5 



#6 rafik_mak

rafik_mak
  • Members
  • 4 posts

Posted 28 August 2013 - 02:15 AM

Can I use eDac insted eAin ? if so how ?



#7 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 28 August 2013 - 07:19 AM

Yes, you can use any of the functions available in the UD driver.  The function eDAC is an easy way to set an analog output (DAC0 and DAC1):

 

http://labjack.com/s...users-guide/2.7

 

http://labjack.com/s...rs-guide/4.2.18

 

http://labjack.com/s...ers-guide/4.3.9

 

In the VC6_LJUD archive check out the example "U6_EFunctions" which makes a call to eDAC:

 

http://labjack.com/s...ud/examples/vc6




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users