The USB 231 has two analog output channels.
I am storing voltages to be outputted in python lists. For example :
array1 =[1,2,3]
array2 =[4,5,6]
array1 in intended for channel number 0 and array2 is intended for channel number 1. I wish to send each voltage as a square wave of 200 Hz (the square wave oscillates between +voltage and -voltage). Going ahead with the above example, I wish to send :
1V to channel 0 at 200 Hz,
4V to channel 1 at 200 Hz,
2V to channel 0 at 200 Hz,
5V to channel 1 at 200 Hz
so on and so forth.
😔 What exactly is the problem ?
Voltages appear in each channel, but the voltage sign is not consistent. So, if my array contains 1V, I can see only +1V and I can't see -1V at all. I have done the interleaving of voltages to output each array for the corresponding channel. So, the final interleaved array has +1V and -1V repeated 200 times. But the -1V is not outputted by the DAQ at all. Sometimes one channel outputs only positive voltages and other only negative voltages.
👨💻 What have I done till now ?
Created a script based on the a_out_scan.py example script to achieve the goal. Since I didn't get the expected output, I have tried the following:
Changing ul.win_buf_alloc to ul.scaled_win_buf_alloc
Changing the ctype array from u_short to other types.
I prefer to use the ul.a_out_scan method instead of ul.a_out method, since I can specify the rate as a parameter in ul.a_out_scan method. Using ul.a_out_scan is a better way to generate precise signals than using the ul.a_out along with something like Python's time.sleep() method.
🔬 Any other observations ?
I have observed that the sign of output voltage varies when I change the rate parameter of ul.a_out_scan. I don't think this is an expected behavior.
Question
Sid_1
⚙️ Hardware details
I am using the USB-231 USB data acquisition (DAQ).
💻 Software details
🤔 What am I trying to do ?
The USB 231 has two analog output channels.
I am storing voltages to be outputted in python lists. For example :
array1 in intended for channel number 0 and array2 is intended for channel number 1. I wish to send each voltage as a square wave of 200 Hz (the square wave oscillates between +voltage and -voltage). Going ahead with the above example, I wish to send :
1V to channel 0 at 200 Hz,
4V to channel 1 at 200 Hz,
2V to channel 0 at 200 Hz,
5V to channel 1 at 200 Hz
so on and so forth.
😔 What exactly is the problem ?
Voltages appear in each channel, but the voltage sign is not consistent. So, if my array contains 1V, I can see only +1V and I can't see -1V at all. I have done the interleaving of voltages to output each array for the corresponding channel. So, the final interleaved array has +1V and -1V repeated 200 times. But the -1V is not outputted by the DAQ at all. Sometimes one channel outputs only positive voltages and other only negative voltages.
👨💻 What have I done till now ?
Created a script based on the a_out_scan.py example script to achieve the goal. Since I didn't get the expected output, I have tried the following:
But I had no success with these.
🔎 Script/code ?
Here is a link to my script.
📝 Any specific note ?
I prefer to use the ul.a_out_scan method instead of ul.a_out method, since I can specify the rate as a parameter in ul.a_out_scan method. Using ul.a_out_scan is a better way to generate precise signals than using the ul.a_out along with something like Python's time.sleep() method.
🔬 Any other observations ?
I have observed that the sign of output voltage varies when I change the rate parameter of ul.a_out_scan. I don't think this is an expected behavior.
Edited by Sid_14 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now