On Thursday, November 05, 2015 5:43 AM, Ian Abbott wrote:
> On 04/11/15 16:55, H Hartley Sweeten wrote:
>> The analog outputs can use an external reference to create the D/A output
>> range. Add an entry to the comedi_lrange table for it and modify the
>> (*insn_write) to support it.
>>
>> Signed-off-by: H Hartley Sweeten <[email protected]>
>> Cc: Ian Abbott <[email protected]>
>> Cc: Greg Kroah-Hartman <[email protected]>
>> ---
>> drivers/staging/comedi/drivers/adv_pci1710.c | 13 ++++++++-----
>> 1 file changed, 8 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c
>> b/drivers/staging/comedi/drivers/adv_pci1710.c
>> index 86ed288..339130b 100644
>> --- a/drivers/staging/comedi/drivers/adv_pci1710.c
>> +++ b/drivers/staging/comedi/drivers/adv_pci1710.c
>> @@ -65,6 +65,8 @@
>> #define PCI171X_CLRFIFO_REG 0x09 /* W: clear FIFO */
>> #define PCI171X_DA_REG(x) (0x0a + ((x) * 2)) /* W: D/A register */
>> #define PCI171X_DAREF_REG 0x0e /* W: D/A reference control */
>> +#define PCI171X_DAREF(c, r) (((r) & 0x3) << ((c) * 2))
>> +#define PCI171X_DAREF_MASK(c) PCI171X_DAREF((c), 0x3)
>> #define PCI171X_DI_REG 0x10 /* R: digital inputs */
>> #define PCI171X_DO_REG 0x10 /* W: digital outputs */
>> #define PCI171X_TIMER_BASE 0x18 /* R/W: 8254 timer */
>> @@ -111,9 +113,10 @@ static const struct comedi_lrange pci1711_ai_range = {
>> };
>>
>> static const struct comedi_lrange pci171x_ao_range = {
>> - 2, {
>> - UNI_RANGE(5),
>> - UNI_RANGE(10)
>> + 3, {
>> + UNI_RANGE(5), /* internal -5V ref */
>> + UNI_RANGE(10), /* internal -10V ref */
>> + RANGE_ext(0, 1) /* external Vref (+/-10V max) */
>
> Minor niggle:
>
> The comment for the external Vref is slightly confusing. The manual I
> have says:
>
> By inputting an external reference voltage: -xV , where |x| <= 10,
> you will get a output voltage range: 0 to xV.
>
> So the external reference voltage is never positive. How about this?:
>
> /* external -xV ref, |x| <= 10 */
Again it appears we have different manuals.
Mine says:
"The PCI-1710/1710HG card provides two D/A output channels, DA0_OUT
and DA1_OUT. Users may use the PCI-1710/1710HG internally provided
precision -5V (-10V) reference to generate 0 to +5V (+10V) D/A output
range. Users also my create D/A output range through external references,
DA0_REF and DA1_REF. The maximum reference input range is +/-10V.
Connecting with an external reference of -7V will generate 0 to +7V DA
output."
The drawing then shows DA0 using a positive external reference voltage
and DA1 using a negative reference voltage.
The specifications state the output range with external reference as:
0 ~ +xV @ -xV (-10 <= x <= 10)
Hartley
_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel