Driver Development Kit (DDK)

cancel
Showing results for 
Search instead for 
Did you mean: 

DAC Direct Addressing for M Series

Hello,

I am writing drivers using register level access for the M series cards (particularly the 6259) and would like to directly access the DAC registers (ie., via the DAC_Direct_Data[i] registers) using immediate update mode. I have been unable to get them outputing a voltage.

I have the ddk examples, but I am unsure about the offsets for these registers and the corresponding AO_Config_Bank registers. Also, the mseries_registermap.doc does not contain these registers (in particular the register contents for the Config_Bank).

If you could point me in the direction of the register addresses and their contents I would much appreciate it.

Many thanks,
Ern
Message 1 of 10
(10,808 Views)

Hi Ern-

The AO_Config_Bank registers begin at 0xC3 for DAC0.  You can see this in the tMSeries::_initialize() in tMSeries.cpp implementation that ships with the DDK documentation.  The associated register IDs are shown in tMSeries.h (kAO_Config_Bank0Id starts at ID 133).

As for the necessary contents for all of the configuration registers, I would encourage you to look at the example aoex1.cpp from the DDK.  The aoConfigureDAC() function shows the necessary settings and field descriptions for the AO_Config_Bank registers.  That example also shows how to address the DAC_Direct_Data registers.

I just tested aoex1 with my PCI-6259 and the AO updates seem to be working correctly.  Can you please clarify exactly what behavior you're seeing?

Thanks-

 

Tom W
National Instruments
Message 2 of 10
(10,782 Views)
Hi Tom,

Thanks for the reply.

It would seem that I had forgotten that "unground AO reference" step. It would make sense that all I ever saw was 0V.

The reason that I asked for the register contents was because it is not always abundently clear to me what the bit fields and meanings are for the registers (for example, setting the waveformorder to 0xF).

Thanks again,
Ern


Message 3 of 10
(10,762 Views)
I just posted a thread with a comment similar to Ern's last statement.  It is pretty hard to decipher the intent of much of the example code.

Any tips for slogging through it Tom????

0 Kudos
Message 4 of 10
(10,740 Views)
Message 5 of 10
(10,703 Views)
Alright, so I've got my analog ins and EEPROM data working just fine, but I don't seem be able to get an analog out signal to move.

Is it true that the 32 bit DAC_Direct_Data registers (0xC0, 0xC4....)  overlap the AO_Config_Bank (0xC3, 0xC7...) and Waveform_Order (0xC2, 0xC6...) registers?  I feel like I'm missing something here.

I can't seem to come up with any good questions.  I'm trying to simple do immediate updates, and I have no idea why nothing is happening.  I know the board works under windows with the DAQmx software.

Any tips would be great.


0 Kudos
Message 6 of 10
(10,624 Views)
Did you ever get a responce to this question.  I'm having the same problem.  I'm running a PCI-6010 (similar to the PCI-622x) and can get analog inputs fine but cannot write to the analog outputs.  I also thought that something was wrong with the 32-bit DAC_Direct_Data registers being at 0xC0, 0XC4 with the 8-bit values of AO_Config_Bank (0xC3, 0xC7) and Waveform_Order (0xC2, 0xC6) so I tried changing the DAC_Direct_Data registers to 16-bit but still nothing happens.  When I set AO_Calibration to zero (to unground the output), the output voltage jumps to about 9V but setting values in the DAC_Direct_Data registers (first two only) does nothing.  I used the example aoex2.cpp in the HDK for the M-series boards.
0 Kudos
Message 7 of 10
(9,890 Views)

Hi Pennells-

The 6010 is indeed similar to a 622x in AI terms, but in AO it's quite different.  For AO, the 6010 uses the STCII general purpose PWM channels to create the AO data.  I haven't had time to create an example yet, but here are some notes that might help you get started.

Each AO channel uses two of the Gen_PWM instances defined in tMSeries.h.  For the sake of discussion, the PWM channels will be referred to upper and lower.  These are the PWM channel values for their corresponding AO channels:

  • AO 0
    • upper = 0
    • lower = 2
  • AO 1
    • upper = 1
    • lower = 3

The actual register values to write to these PWM channels are as follow (where 'value' represents a normal 16-bit binary value, i.e. not 2's complement):

upperPWMValue = ((value >> 7) & 0x1FF) + 256;
lowerPWMValue = ((value & 0x7F) * 1564) / 1000 + 768;

Hopefully this helps-

Tom W
National Instruments
0 Kudos
Message 8 of 10
(9,861 Views)
Thanks, that helped tremendously.  I now only have one outstanding issue.  I'm not to worried about the AO scaling since I'm just setting both outputs to 5V.  As for the analog inputs, reading the calibration from the eeprom as described in the MSeries HDK scale.cpp/scale.h samples does not seem to work.  I do find the calOffset to be 400 but the resulting scale variables are all 0.  The modeOffset is found to be 429 (modeIdx = 0 (default)) and the intervalOffset is found to be 492 using intervalIdx = 1 (+/-5V).  I'm using the same constants for offset locations as found in the scale.cpp file for the M Series board.  Is the eeprom mapping the same as the M Series?
0 Kudos
Message 9 of 10
(9,844 Views)
Never mind...  I guess that I've been working on this so long that I starting making silly mistakes.  The code that I created had a mistake in it.  I can read the calibration fine now.
0 Kudos
Message 10 of 10
(9,840 Views)