LabJackPython, Function aiStreamStar Error 27 | LabJack
 

LabJackPython, Function aiStreamStar Error 27

6 posts / 0 new
Last post
Fab
Fab's picture
LabJackPython, Function aiStreamStar Error 27

Good morning,

I have a question. I connected a potentiometer from LabJack U12 (AI0) and wrote the following code on Python to know in real-time the voltage.

Import u12 d= u12.U12 d.aiStreamStar(1,[0],200)

And i obtained the error message :

d.aiStreamStart(1,[0],210)

File "c:\python27\lib\site-packages\u12.py", line 2221, in aiStreamStart

if ecode != 0: raise U12Exception(ecode) # TODO: Switch this out for exception

U12Exception: 27

I saw that error 27 corresponds to "Maximun number of stream" but I don't understand...

Thank you for helping me

LabJack Support
labjack support's picture
The U12 only supports 1

The U12 only supports 1 stream at a time, so likely that error means the U12 was already streaming when you called streamstart.

Fab
Fab's picture
Thanks for this answer

Thanks for this answer

How can i stop it ?

I did the function d.aiStreamClose() but it said that streamstar has not been launched.

LabJack Support
labjack support's picture
I assume you mean d

I assume you mean d.aiStreamClear() is failing with error 33, NO_STREAM_FOUND. Did you close your Python application, start it again and run d.aiStreamClear() before starting the stream? That error would be expected in that case. aiStreamClear should be used sometime after using aiStreamStart during run time.

If you try to start the stream again after getting this stream clear/close error does it work? You could put something like this in your code to try to clear a previous stream and then start the stream:

try:
    d.aiStreamClear()
except u12.U12Exception as e:
    print("Stream clear error " + str(e) + ". Ignoring and starting stream.")
d.aiStreamStart(1,[0],210)

If that doesn't help, try power cycling your U12 and restart your Python application. See if that gets the stream start working again.

Fab
Fab's picture
Thank you for this answer. It

Thank you for this answer. It is working !

I have another question. I saw that the function aiStreamRead could return voltage. It returns a matrix 4*4096.

I understand how works  the first lign but i don't understand the three other lign...

Could you explain me ?

Tkank you

LabJack Support
labjack support's picture
voltages[x][0] are the

voltages[x][0] are the samples for the first stream channel, voltages[x][1] are for the second, voltages [x][2] are for the third, and voltages[x][3] are for the fourth. Unused channel samples are will have a value of 9999.0.

If streaming one channel, voltages [x][0] will have valid sample values, and voltages[x][1] to voltages[x][3] will be filled with 9999.0 values.