Dear community,
I'm facing multiple problems using the LabJack T7 eStream function to read from 2 analog input pins at a rate of 1000Hz... Im programming in MATLAB using a Mac with OS High Sierra v 10.12:
1) Sometimes, after restarting the stream, the input channels are exchanged (I read the signal of pin 1 from where I used to read signal 2 and vice versa)
2) After updating the firmware to the newest version, an interference between the two channels emerged. If one channel reads a higher input, the reading from the other channel is also altered. I had this problem before but could solve it by setting the settling time to 200. Now I'm having the same problem despite not having changed the code. After reinstalling the firmware, the first couple of steams are fine, but then the problem arises.
3) Sometimes, LJM_OpenS is stuck, does not return an error but neither a value and appears to be caught in a loop, so that I have to force quit MATLAB. I know that this specification is quite vague, but I don't know which other details are important for this problem.
I would be extremely thankful for any help, concerning one of there three issues.
Kind regards,
Lukas
1. Let us know if you see this happen again after updating to the latest firmware.
2. Sounds like your signal might have settling issues. A good basic way to test is by jumpering the first channel in your scan to VS or GND, and then make your signal the second channel in the scan. Does the reading from your signal change depending on whether the first channel is jumpered to VS or GND?
3. Leaving this for a Matlab person here.
Thank you for your answer
1) I tried to use the latest firmware. But as mentioned above, the problem (settling issues) just arose after updating to a newer version. I solved the problem by subsequently downgrading to earlier software versions. The latest one that does not have this problem is v1.0229!
2) The first channel was jumpered at all times to GND
Regarding OpenS, what DeviceType, ConnectionType and Identifier are you using? If you use "T7" and "USB" does the function get stuck?
Also, please make sure you're running the latest software:
https://labjack.com/support/software/installers/ljm
I am using the latest software (LJM Driver 1.17, Modbus Map 2017.11.28.A, Kipling 3.1.11).
Until now I was using as DeviceType and ConnectionType 'ANY', but changing them to 'T7' and 'USB' does not have any effect.
For #3:
A) You might as well try the beta version of LJM (LJM 1.1803): https://labjack.com/support/software/installers/ljm.
B) Try using a different USB cable and a different USB port on your computer
C) Try disconnecting everything from your T7 except the USB cable. Does OpenS still hang?
D) As in your other thread, you could try getting a debug log.
I started and stopped the "Stream Basic.vi" example for quite a while without seeing any channel swapping. To get to the bottom of the issues you are seeing we will need to reproduce your test and results.
I am reading from AIN0 and AIN2, while AIN1 and AIN3 are jumpered to the GND.
In my code:
using the functions specified in the attatched LJ_Handle file result in wron readings in run
i = 6 , 11, 19, 55, 56, 88
of the loop stated above. I attached the log file. Perhaps that could help to find the problem...
From your debug log, I see that you start and stop stream in a loop, which causes error messages that aren't really problems.
To capture insightful debug log information for your original issue number #3, you need to:
1. Enable the debug log
2. Call LJM_OpenS
3. Exit the program as soon as possible after the issue occurs
4. Send us ljm.log before running any other LJM-based programs.
Nothing stands out as wrong in the LJ_Handle.m file that you sent, but it appears to be just a class. I would need to see the calls and parameters to see what is going on.
We need to put together a test that we can perform. Can you tell me about the signals connected to AIN0 and AIN2. Sensor type, any conditioning, source impedance etc.
Do you see the same issue when using the T7's DACs as signal sources to AIN0 and AIN2?
Please excuse the long response time. I had to wait until the equipment was available.
gives the output:
So I stoped right after the error occured. I'll upload the debug_log_file again
When using the DACs as sources I also get wrong readings:
Output
Apparently AIN2 gets the same signal strength as AIN0. But perhaps I did something wrong?
I'll look into the log. In the meantime, to address your AIN0 and AIN2 issue, I recommend running Examples\More\Stream\StreamBasic.m to ensure that AIN0 and AIN2 are reading correctly. I suggest running it as written (with AIN1) then find/replacing AIN1 with AIN2.
Connect GND to AIN0 and VS to AIN2 to make sure AIN0 and AIN2 are reading correctly.
You can also use Kipling with GND connected to AIN0 and VS connected to AIN2 (or vice versa) to make sure AIN0 and AIN2 are reading correctly (0V and 5V).
I don't see anything in the Mon, 07/09/2018 - 07:59 debug log that indicates that the OpenS is hanging. Is that still happening?
What error occurred? Is it a new issue? If so, please start a new thread, since this one is already juggling a couple of different topics.
That the readings from the channels were exchanged (not the opening of a handle). Sorry, I should have been more specific!
I tried it again, this time jumpering VS to AIN2 and GND to AIN0. At the second time starting a stream the first stream read of AIN2 is smaller than 0.001 (instead of 5). I'll attatch the log file.
Running your example code is not that easy, because its not written for mac+matlab. So I would have to rewrite the whole thing ... if there is a way to prevent this I would be grateful
I also can now specify the problem a little further:
When expecting 4.5V at AIN2 and 0V at AIN0 the very first reading of the stream is close to 0V for both channels and 0V for AIN2 as well as 4.5V for AIN0 for all further readings when the eror occurs (the channels are exactly exchanged). Changing the input voltages is also reflected in these exchanged readings...
There are a couple of options:
1. Try to replicate the issue using our LJM stream examples (for example our C examples or Python examples). If you'd like an example that streams AIN0 and AIN1 and for all scans, checks that AIN0 is ~0 and AIN1 is between 4.7 and 5.1, I've attached stream_basic.c. For a binary executable for macOS, I've attached the binary version of it (you just need to unzip it). It works for me and AIN0 and AIN1 don't flip.
2. Write your own matlab wrapper/interface e.g. using calllib (https://www.mathworks.com/help/matlab/ref/calllib.html)
3. Send us your code. We may not be able to run it, but we can look it over. No guarantees that we'll find any bugs, either.