LJTick-DAC and Matlab | LabJack
 

LJTick-DAC and Matlab

5 posts / 0 new
Last post
TBM
NickTBM's picture
LJTick-DAC and Matlab

Dear LabJack,

I am trying to control an LJTick-DAC using Matlab and a U6. The LJTick is connected to EIO0, EIO1, VS and GND. 

I can read and write to DIO/AIN ports using my Matlab scripts, but I can't get the pseudocode for the LJTick-DAC to work. 

My code so far:

clc
ljasm = NET.addAssembly('LJUDDotNet');
ljudObj = LabJack.LabJackUD.LJUD;

% Open the first found LabJack U6.
[ljerror_u6, ljhandle_u6] = ljudObj.OpenLabJackS('LJ_dtU6', 'LJ_ctUSB', '0', true, 0);

ljudObj.ePutS(ljhandle_u6, 'LJ_ioPUT_CONFIG', 'LJ_chTDAC_SCL_PIN_NUM',8,0);  

ljudObj.ePutS(ljhandle_u6, 'LJ_ioTDAC_COMMUNICATION', 'LJ_chTDAC_UPDATE_DACA', 1.2, 0); 
 

 

The error message:

No method 'ePutS' with matching signature found for class 'LabJack.LabJackUD.LJUD'.

soloman
soloman's picture
The 'LJ_ch' parameters should

The 'LJ_ch' parameters should be integers rather than strings. For example, the SCL pin config call should be:

ljudObj.ePutS(ljhandle_u6, 'LJ_ioPUT_CONFIG', LabJack.LabJackUD.CHANNEL.TDAC_SCL_PIN_NUM ,8,0);

Alternative to the channel name format above, you could use our StringToConstant function:

LJ_chTDAC_SCL_PIN_NUM = ljudObj.StringToConstant( 'LJ_chTDAC_SCL_PIN_NUM');

TBM
NickTBM's picture
Thank you for your reply,

Thank you for your reply, unfortunately the line:

ljudObj.ePutS(ljhandle_u6, 'LJ_ioPUT_CONFIG', LabJack.LabJackUD.CHANNEL.TDAC_SCL_PIN_NUM ,8,0);

results in the following error:

Unable to resolve the name LabJack.LabJackUD.CHANNEL.TDAC_SCL_PIN_NUM.
 

These lines do not result in an error:

ljudObj.ePutS(ljhandle_u6, 'LJ_ioPUT_CONFIG', ljudObj.StringToConstant('LJ_chTDAC_SCL_PIN_NUM'),8,0);  ljudObj.GoOne(ljhandle_u6);
ljudObj.ePutS(ljhandle_u6, 'LJ_ioTDAC_COMMUNICATION', ljudObj.StringToConstant('LJ_chTDAC_UPDATE_DACA'), 1.2, 0); ljudObj.GoOne(ljhandle_u6);
ljudObj.ePutS(ljhandle_u6, 'LJ_ioTDAC_COMMUNICATION', ljudObj.StringToConstant('LJ_chTDAC_UPDATE_DACB'), 3.8, 0); ljudObj.GoOne(ljhandle_u6);

However, I do not measure 1.2 and 3.8 volts at DACA and DACB. 

What am I doing wrong? 

soloman
soloman's picture
Apologies, the first method I

Apologies, the first method I mentioned is not supported in newer versions of MATLAB (newer than 2018).

Your second set of lines looks okay, except you do not need to call GoOne when using ePut.

I would recommend you start troubleshooting by verifying all of your connections are good and the screw terminals for the EIO/TDAC connection are tightly screwed down, then test the output with our test utility:

https://labjack.com/support/datasheets/accessories/ljtick-dac-utility

A good way to verify the hardware is to test by screwing down a jumper wire between an AIN channel and the DAC output, then read the AIN in our software such as LJControlPanel (you would need to close the TDAC utility program before opening LJControlPanel).

 

NatanieDach
NatanieDach's picture
Thank you for providing

Thank you for providing update solution. It is also useful for me too.

 

with Respect, Natanie