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

LabJack U6 with cb37 terminal board and LJTick-Dac


  • Please log in to reply
6 replies to this topic

#1 JamesY

JamesY
  • Members
  • 4 posts

Posted 20 June 2013 - 07:35 PM

Hi, I have a Labjack U6 with cb37 terminal board connected to two LJTick-Dac. I am using Matlab and was wondering if there is a tutorial/sample code on how to send a voltage to AINO,AIN1,AIN2 and AIN3 (inputs) on the cb37 board and read the voltage at the FIO0, FIO1, FIO2 and FIO3 (outputs via LJTICK-DAC). Thanks James

#2 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 21 June 2013 - 10:04 AM

To correct your last sentence, you will want to "read a voltage from AIN0,AIN1,AIN2 and AIN3 (inputs) on the cb37 board and send voltage through FIO0, FIO1, FIO2 and FIO3 (outputs via LJTICK-DAC)".

Take a look at the MATLAB examples as they provide example code to read analog inputs:

http://labjack.com/s...examples/matlab

Note that AIN0-AIN3 screw terminal signals are shared with the CB37's AIN0-AIN3 screw terminals.

We do not have a LJTick-DAC MATLAB example, but the LJTick-DAC datasheet provides example pseudocode using the UD driver, and the MATLAB examples will demonstrate how to use the UD driver in MATLAB:

http://labjack.com/s...k-dac/datasheet

#3 JamesY

JamesY
  • Members
  • 4 posts

Posted 22 June 2013 - 03:04 PM

Thanks, with your sources I was able to set voltages within Matlab to DACA and DACB for the first LJTickDAC (thus providing voltages for AIN0 and AIN1) 1) How would I set the voltage for the second LJTickDAC's DACA and DACB. Not sure which channel I would require to access it. [codebox][ljerror, ljhandle] = ljudObj.OpenLabJack(LabJack.LabJackUD.DEVICE.U6, LabJack.LabJackUD.CONNECTION.USB, '0', true, 0); ljudObj.ePut(ljhandle, LabJack.LabJackUD.IO.PUT_CONFIG, LabJack.LabJackUD.CHANNEL.TDAC_SCL_PIN_NUM, 0, 0); %Set DACA1 to 1.5 volts. ljudObj.ePut(ljhandle, LabJack.LabJackUD.IO.TDAC_COMMUNICATION, LabJack.LabJackUD.CHANNEL.TDAC_UPDATE_DACA, 1.5, 0); %Set DACB1 to 2.3 volts. ljudObj.ePut(ljhandle, LabJack.LabJackUD.IO.TDAC_COMMUNICATION, LabJack.LabJackUD.CHANNEL.TDAC_UPDATE_DACB, 2.3, 0);[/codebox] 2)When reading FIO0 and FIO1 with a volt meter I get 5 volts regardless of the input. Is this expected? 3)When displaying FIO0 is it possible to display voltage instead of bit? [codebox] %Read digital input FIO0. ljudObj.AddRequest(ljhandle, LabJack.LabJackUD.IO.GET_DIGITAL_BIT, 0, 0, 0, 0);[/codebox]

#4 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 24 June 2013 - 10:04 AM

1. Your first call tells the driver that the TDAC SCL pin number is 0, so that is for an LJTDAC connected to FIO0/FIO1. To use an LJTDAC connected to FIO2/FIO3 make another call to set the SCL pin number to 2.


2. Are you saying that you are using a DMM to measure the voltage from FIO0 to GND and see 5 volts? That is not right. Rather if FIO0 is set to input or output-high you should see 3.3 volts, and if FIO0 is set to output-low you should see 0.0 volts.

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


3. No, FIO0 on the U6 is a digital I/O only. You can't use it as an analog input.

http://labjack.com/s...is-analog-input

http://labjack.com/s...-are-digital-io

#5 JamesY

JamesY
  • Members
  • 4 posts

Posted 24 June 2013 - 01:05 PM

Thanks Labjack support was able to address the second and third LJTick-Dac and understand flexible input/output. For 2) Yes when using a DMM I see 5 volts from FIO0 to GND. However, this when I run the matlab program and set nothing to FIO0. I have made no changes to the default settings. But when I set FIO0 to high using [codebox]ljudObj.AddRequest(ljhandle, LabJack.LabJackUD.IO.PUT_DIGITAL_BIT, 1, 1, 0, 0);[/codebox] I read the voltage to be 3.5 volts. And when I set FIO0 to low using [codebox]ljudObj.AddRequest(ljhandle, LabJack.LabJackUD.IO.PUT_DIGITAL_BIT, 1, 0, 0, 0);[/codebox] I read the voltage to be 0.47 volts -> For FIO1-FIO5 (ones that contain a LJTICK-Dac) I did not specify high or low but it reads 5 volts by default? FI06-FIO7 has a voltage reading of 0.03 volts(ones without LJTick-DAC). Just wondering if this is expected. Thanks, James

#6 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 24 June 2013 - 02:20 PM

Do you have something connected to FIO0? Remove all connections to FIO0 except the DMM, and then confirm that if FIO0 is set to input or output-high you 3.3 volts and if FIO0 is set to output-low you see 0 volts. Let us know about your connections to FIO0 and we can try to explain the voltages you see with those connections.

#7 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 24 June 2013 - 02:31 PM

But when I set FIO0 to high using ...
I read the voltage to be 3.5 volts.

And when I set FIO0 to low using...
I read the voltage to be 0.47 volts

Yes, This is the correct output. Our devices have 5V available on the VS pins. Our devices however use 3.3V logic so you will see 3.3V and 0V when you set the FIO/EIO/CIO channels.

For FIO1-FIO5 (ones that contain a LJTICK-Dac) I did not specify high or low but it reads 5 volts by default? FI06-FIO7 has a voltage reading of 0.03 volts(ones without LJTick-DAC).

Yes, this output is also expected. When you install a LJTIC-DAC on a device it is adding pull-up resistors on the corresponding FIO channels.
http://labjack.com/s...ACdatasheet.pdf
When you have the channels set to inputs those pull-up resistors will drive the digital I/O channel to 5V which is exactly what you are seeing.


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users