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,441 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,440 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,419 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,395 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,393 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,388 Views)

hello ,thank you very much for your answer!

if that is what you said, in newValue = ((u16)(_softCopy & 0xfffe)) | (((u16)fieldValue << 0x0) & ~0xfffe); )    ,   does (_softCopy & 0xfffe)) has meaning because of _softCopy=0?   why do you use newValue = (((u16)fieldValue << 0x0) & ~0xfffe) instead of

 newValue = ((u16)(_softCopy & 0xfffe)) | (((u16)fieldValue << 0x0) & ~0xfffe); )  ?  i think (_softCopy & 0xfffe)=0 according to what your said.Maybe what i think is wrong. i really don't understand,please help me. 

beilei
0 Kudos
Message 7 of 10
(12,379 Views)

I build the project when i set active configuration project as win32 debug ,it success! but when i set active configuration project as win32 RTss Release ,it has two error:

rtapi_rtss.lib(startup.obj) : error LNK2005: __fltused already defined in rtxlibcmt.lib(fpinit.obj)
Pxi___Win32_RTSS_Release/Pxi.rtss : fatal error LNK1169: one or more multiply defined symbols found

 

why?? do i need to rewrite code for  win32 RTss Release?

 

do i set the  environment is wrong?

beilei
0 Kudos
Message 8 of 10
(12,365 Views)
Solution
Accepted by topic author 张蓓蕾

Hello Beilei,

 

Yes, the _softCopy starts out at 0.  However, please remember that the _softCopy isn't always 0.  After the line you mention runs, a value is saved in newValue...after flushing newValue to the register, that value is also saved in _softCopy.  Basically, this proceedure ensures that the other bit fields in _softCopy are not modified unintentionally.

 

If you have any doubts about what is happening, I would recommend stepping through the code while it is running so that you can see what is happening in that line (you may wan to break it out into multiple lines).

 

~~~~~

 

Regarding the errors you are getting in RTX, please follow the readme for building the examples with this OS interface.  The Readme says that it was tested with RTX 6.1.  If you are using a later version, you may need to contend with any changes that may have happened with this operating system.  If you work through any issues, please post back to let us know what went wrong.  We welcome any feedback about this OS interface!

 

Thanks,

Steven T

0 Kudos
Message 9 of 10
(12,308 Views)

hello steven T.

During these days, I can not open the page " same page as the MSeries DDK ".

I don't kown the reason. And now I really need to download some examples about pxi6509.i

Can you send the examples to my e-mail: beileifly314@126.com

Thank you very much.

beilei
0 Kudos
Message 10 of 10
(12,255 Views)