Driver Development Kit (DDK)

cancel
Showing results for 
Search instead for 
Did you mean: 

Programming Analog Input Registers for MSeries NI-6280 under rtx

Solved!
Go to solution

I have an example of aiex1.cpp,I kown it write some bit in some register,I want to translate it into RTX.but I found some register is only wirte and I also dont kown what the default bits  in registers is,so use " *(u16*)addr_tmp|= (1 << 7);" is wrong, what can I do about writing some bits in register under RTX? please help me

beilei
0 Kudos
Message 1 of 10
(12,464 Views)

I really dont  kown how to write some bits in register  under rtx ,bucause some register is " only wire" ,i can not to read it and do some operation for keep other bits unchanging,please some one can tell me what I can do  .thanks!

beilei
0 Kudos
Message 2 of 10
(12,463 Views)

Hello Beilei,

 

The MSeries DDK provides the files that will allow your program to interface with M Series hardware.  It shows how to set specific registers and bitfields in the tMSeres.ipp and tMSeries.h files.  When the MSeries files are built with an Operating System Interface, you get a working driver that can demonstrate how to interface with the hardware.  One of the available operating system interfaces is RTX, so why you are not just building the driver for RTX?

 

The RTX OS Inteface can be downloaded from the same page as the MSeries DDK.

 

The DDK Readme talks about how the OS Layer works and how it should be built.

 

Lastly the tMSeries class demonstrates how to write to the different registers in the hardware.

 

I hope this helps,

Steven T.

0 Kudos
Message 3 of 10
(12,442 Views)

hello Steven T,thank you for your answer! I have looked tMSeries.ipp , i found a question .for example ,inline tMSeries::tAI_Command_1& tMSeries::tAI_Command_1::setAI_CONVERT_Pulse(u16 fieldValue, nMDBG::tStatus2* s)
{
   if (s && s->isFatal()) return *this;
   u16 newValue;   newValue = ((u16)(_softCopy & 0xfffe)) | (((u16)fieldValue << 0x0) & ~0xfffe);
   setRegister(newValue, s);
   return *this;
}  ,I have found this register calledt AI_Command_1 is "write only",so how  _softCopy are read from this register?is it right like doing that?please help me! thank you!

beilei
0 Kudos
Message 4 of 10
(12,418 Views)

now i have another question,when i run the example in rtx,it has an error"cannot open input file "rtxlibcmt.lib",why?i think the rtxlibcmt.lib is written by c, how c++ can call .lib written by c. I am really in trouble,please help me ! thank you very much!

beilei
0 Kudos
Message 5 of 10
(12,416 Views)

Hello,

 

Using AI_Command_1 is a good register for a demonstration.  When the tMSeries object is constructed, it calls the _initialize() method [1].  This method sets up the initializes the hardware registers and calls the reset() [2] method to place them all into a known value.  The first action that the reset method performs is setting the AI_Command_1 register to 0 [3].  This action results in the soft copy of the register to be set to 0.  So, the _softcopy is never read from the register.

 

At this point, each time that a value is written to the AI_Command_1 register, the soft copy is modified and saved.  If this is done correctly, there is no need to read the current value of the register, because your soft copy has the value that was last written to the register.

 

[1] Line 18 of tMSeries.cpp, tMSeries constructor calls _initialize()

[2] Line 351 of tMSeries.cpp, tMSeries _initialize() method calls reset()

[3] Line 26 of tMSeries.cpp, setting the register to 0.

 

I need to look into your other issue some more.

 

Thanks,

Steven T.

0 Kudos
Message 6 of 10
(12,411 Views)