I am trying to use the USB-3102 device to generate analog output currents. I followed the C example code, however I cannot get the output currents to match the dac setting. So using the 0-20mA setting, a DAC value of 32768 should yield 10mA. However, I see around 10.50mA. I used to see 12.30mA @ 32768, before I applied fix mentioned further down in this post.
Now, if I use the InstaCal program with the same DAC value, I get 10mA exactly. This is with a 100 ohm load and 24V supply. So there is something the InstaCal program is configuring that I do not see in the example programs. I did look at the CB.cfg file that instacal generates, and it contains the following config settings:
I added this call to my example program, and it reduced the error @ 32768 from 12.30mA to 10.50mA. So there is still some config call that I am missing.
My first question is, what are options 10, 11, 14, 14, and 16. Do they fine tune the range?
Below is a rough pseudocode of my program that sets the output current:
out_type_ch[chan] == AMPS ? range = MA0TO20 : range = UNI10VOLTS;
err_handling = cbSetConfig(BOARDINFO, board_id, chan, BIDACRANGE, range);
///Converts a single precision voltage (or current) value in engineering
//units to an integer count value. This function is typically used to obtain a data value from a voltage value for output to a D/A with functions such as //cbAOut().
err_handling = cbFromEngUnits(board_id, range, (float)out_value[chan], &output_val_counts[chan]);
err_handling = cbAOut(board_id, chan, range, output_val_counts[chan]);
It should be noted that I forced the cbAOut function to use 32768 via hardcoding, so it is NOT an issue with cbFromEngUnits.
Question
dylanjp
Hello,
I am trying to use the USB-3102 device to generate analog output currents. I followed the C example code, however I cannot get the output currents to match the dac setting. So using the 0-20mA setting, a DAC value of 32768 should yield 10mA. However, I see around 10.50mA. I used to see 12.30mA @ 32768, before I applied fix mentioned further down in this post.
Now, if I use the InstaCal program with the same DAC value, I get 10mA exactly. This is with a 100 ohm load and 24V supply. So there is something the InstaCal program is configuring that I do not see in the example programs. I did look at the CB.cfg file that instacal generates, and it contains the following config settings:
Misc Option[0]: 204
Misc Option[1]: 204
Misc Option[2]: 204
Misc Option[3]: 204
Misc Option[10]: -13344
Misc Option[11]: 531
Misc Option[14]: 0
Misc Option[15]: -13344
Misc Option[16]: 2
So the "204" means MAT0TO20, which sets the DAC to 0 to 20mA range via:
cbSetConfig(BOARDINFO, board_id, chan, BIDACRANGE, MAT0TO20);
I added this call to my example program, and it reduced the error @ 32768 from 12.30mA to 10.50mA. So there is still some config call that I am missing.
My first question is, what are options 10, 11, 14, 14, and 16. Do they fine tune the range?
Below is a rough pseudocode of my program that sets the output current:
out_type_ch[chan] == AMPS ? range = MA0TO20 : range = UNI10VOLTS; err_handling = cbSetConfig(BOARDINFO, board_id, chan, BIDACRANGE, range); ///Converts a single precision voltage (or current) value in engineering //units to an integer count value. This function is typically used to obtain a data value from a voltage value for output to a D/A with functions such as //cbAOut(). err_handling = cbFromEngUnits(board_id, range, (float)out_value[chan], &output_val_counts[chan]); err_handling = cbAOut(board_id, chan, range, output_val_counts[chan]);
It should be noted that I forced the cbAOut function to use 32768 via hardcoding, so it is NOT an issue with cbFromEngUnits.
Edited by dylanjpLink to comment
Share on other sites
3 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