10-13-2010 09:33 PM
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
Solved! Go to Solution.
10-13-2010 09:39 PM
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!
10-14-2010 09:17 AM
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.
10-15-2010 05:44 AM
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!
10-15-2010 07:21 AM
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!
10-15-2010 08:45 AM
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.