Driver Development Kit (DDK)

cancel
Showing results for 
Search instead for 
Did you mean: 

m series register programming in straight C

I'm writing code in a pure C application (not C++) for the m series 6225. The application was originally written for the e series boards. The C++ Chipobject examples don't help much and the register documentation is sketchy. Are there any pure C programming examples for m series? Or is there a register programming manual for the m series? Or a discussion of the programming differences between the e and m series. Even a preliminary manual would help.
0 Kudos
Message 1 of 10
(12,472 Views)

Hi brosner-

 

You may not be able to use the C++ chip objects directly, but the MHDDK examples should still be helpful.  The show the necessary registers/bitfields to hit and in what order, and the mseries_registermap.doc shows the register offsets and bitfield descriptions.  Bitfield values are enumerated in the chipobjects as well.  These two resources should hopefully help you piece together your driver. 

 

Note that the functionality of the E Series (STC) and M Series (STCII) timing controller chips are very similar and that register names may be similar or the same, though their offsets might be different.  Since you're using the 6225, you may also be interested in the tips for accessing the upper 16 channels that I posted in this thread.

 

Out of curiousity, what type of environment are you programming for?

Tom W
National Instruments
0 Kudos
Message 2 of 10
(12,467 Views)
The environment is one of the real time Linux extensions. I'm adding support for the 6225 to a large existing C based data acquisition system.
0 Kudos
Message 3 of 10
(12,441 Views)
We have developed a linux real time driver for the NI 6221 board, using only C. And is Open Source. Have a look. http://spm.polosci.unifi.it
Message 4 of 10
(12,296 Views)

I'm in a similar position with brosner99 except the board is an NI6255.

We were able to translate (into c) the aiex1 cpp code in the mhddk and get it to read known voltages on known channels.

However I have been unsuccessful in getting the translated aoex1 code to generate known voltages.

While I have the register offsets and bit (field) definitions in a .h file, I don't really understand how

the M series ao works. The aoex1 DACConfig code loads the waveformorder with (0xf). What is the waveform order?

We load  DAC_Direct_data[channel] with different codes, but don't seem to be able to generate voltages.

Is there a strobe that needs to be set. It appears there is comprehensive documentation on the STC chip,

is there similar documentation on how the AO subsystem works.

P.S We know the board works as it funtions just fine in a windows environment.

Thanks in advance for your time

Cwernlund

 

 

0 Kudos
Message 5 of 10
(11,660 Views)

Hi Cwernlund-

 

Waveform order is used to indicate to the hardware which order you plan to load data points into the AO FIFO for a generation.  A lower number takes precendence, so it gives a way to adjust the channel ordering as it corresponds to the data in the FIFO.  So if you want to load data in the FIFO in order like ch0, ch1, ch3, ch2 then you need to write (in addition to other settings as show in aoConfigureDAC() 😞

 

AO_Waveform_Order[0] = a;

AO_Waveform_Order[1] = b;

AO_Waveform_Order[2] = d;

AO_Waveform_Order[3] = c;

 

with any numbers such that a<b<c<d.

 

However, for static (non-hardware-timed) AO, you should not need make any settings for AO_Waveform_Order.  What behavior do you see if you run aoex2.cpp from the M Series MHDDK?

 

Hopefully this helps-

Tom W
National Instruments
0 Kudos
Message 6 of 10
(11,615 Views)

Hi

 

We use VISA based Register level programming for E Series DIO channels for one specific purpose. We access only the following DAQ-STC Registers

 

DIO_Control_Register  
DIO_Output_Register   
DIO_Parallel_Input_Register 
Window_Address_Register  
Window_Data_Read_Register 
Window_Data_Write_Register 

The E Series RLP manual provides their address and offset correctly. We want to use the M Series Board and I am unable to find the DAQ-STCII RLP details. I tried the entire NI Site. Please provide the STC II registermap or atleast the register information of the above registers.

 

thanks and regards

Sathish

 

 

0 Kudos
Message 7 of 10
(10,689 Views)
Hi Sathish,

Given how much blatant, undisclosed, and unrepentant cross-posting [1] [2] [3] [4] [5] you've done to ask this question, I gave you the benefit of the doubt that you were new to the NI forums and didn't understand the etiquette of this community. However, looking at your profile, you've been around just over 8 years! How can you be so selfishly impolite?

To your credit, you at least searched the forums to find (somewhat) relevant to which topics to reply, but as you said you 'tried the entire NI Site', I'm surprised that you missed the DDK home page [6] that has a link to the M Series register map.

[1] Re: m series register programming in straight C
http://forums.ni.com/ni/board/message?board.id=90&message.id=1644#M1644

[2] Re: Problems configuring a port in niPXI-6509 card as input port using static DIO Register Level Programmer maual
http://forums.ni.com/ni/board/message?board.id=90&message.id=1645#M1645

[3] Re: Problem with writing to registers
http://forums.ni.com/ni/board/message?board.id=90&message.id=1646#M1646

[4] Re: Is there a Register Level Programming manual for NI 625x PXI
http://forums.ni.com/ni/board/message?board.id=270&message.id=7661#M7661

[5] Re: Where Can I find information about register level programming the PXI 6259?
http://forums.ni.com/ni/board/message?board.id=250&message.id=53551#M53551

[6] Register Level Programming for OEM Customers
http://digital.ni.com/express.nsf/bycode/exyv4w?opendocument
Joe Friedchicken
NI Configuration Based Software
Get with your fellow OS users
[ Linux ] [ macOS ]
Principal Software Engineer :: Configuration Based Software
Senior Software Engineer :: Multifunction Instruments Applications Group (until May 2018)
Software Engineer :: Measurements RLP Group (until Mar 2014)
Applications Engineer :: High Speed Product Group (until Sep 2008)
Message 8 of 10
(10,679 Views)

Hi,

 

Sorry for the confusion in the post even though my notion was different. It is very unfortunate that you didn't understand my question and answered it.

 

Without visiting the NI Register level Programming home page, nobody would have developed any register level program for NI Boards. 

 

For E Series Boards NI had provided two manuals for register level programming.

 

1. E Series Register Level Programmer Manual.

2. DAQ-STC  Technical Reference Manual. 

 

The Register information for accessing DIO lines in E series were given in the DAQ-STC manual with very good explanation. With the knowledge of E series based boards if one approach for M-series, Let see what  document we have.

 

1. mseries_registermap.doc.

 

First of all in the RLP home page they call this document as  "Not a complete Register Level Manual" and inside they show it as preliminary document. It only has table of registermaps without any explanation or help. There is not even a mention about DAQ-STC II in that document.

 

In this same thread in Oct2008, Mr.Tom has mentioned that STC in E Series and STC II in M Series are functionally same but the register names may or may not be the same.

 

Since I didn't find the STC II manual in NI website, I have asked for the equivalent register value information for those which I use in STC.

 

Anyhow now by debugging the NI m series Register level examples (The code without any meaningful comments for the understanding), I have found the values for the digital I/O registers and confirmed it with mSeries_registermap document. My converted program for m series works fine.

 

Here are my observations about DIO registers to this community forum.

 

1. DIO registers are not part of STC as like E series, it is moved to the main register map. (No need for STC registermap document for accessing DIO).

2. DIO register names are different and register sizes are different.

3. The registers for Port1 & 2 are different kind than for Port 0.

 

thanks and regards

Sathish

 

 

0 Kudos
Message 9 of 10
(10,548 Views)
Hi Sathish,

Thanks for your follow-up and feedback: I've logged it in the DDK project plan. Yes, the M Series manual is incomplete, as are a few others. I've given some reasons for this in a different thread [1] if you're curious.

The DIO examples for M Series are not that well commented as you've noted, but they should be simple enough to understand what they do after a careful read (assuming the programmer has register level experience). What kind of information was missing -- what would have made understanding the examples easier?

The DDK is not a full-featured driver, but starting point for customization. The source is plain so that it can port to as many different platforms and applications as possible.

[1] What are the 3-bit field choices for Hw_Arm_Sel in PCI-6601
http://forums.ni.com/ni/board/message?board.id=250&message.id=52959&query.id=38830#M52959
Joe Friedchicken
NI Configuration Based Software
Get with your fellow OS users
[ Linux ] [ macOS ]
Principal Software Engineer :: Configuration Based Software
Senior Software Engineer :: Multifunction Instruments Applications Group (until May 2018)
Software Engineer :: Measurements RLP Group (until Mar 2014)
Applications Engineer :: High Speed Product Group (until Sep 2008)
0 Kudos
Message 10 of 10
(10,525 Views)