08-23-2009 03:24 AM
hello,Can anybody give me some examples about how to develop the driver of 6230 of Position Measure.
i want to use the Counter/Timer function of 6230 for Position Measurement.who can help me? thank you.
Solved! Go to Solution.
08-24-2009
01:28 AM
- last edited on
01-22-2025
05:07 PM
by
Content Cleaner
Hi Jude,
I think you can just measure position using the counters on 6230. You don't need any other driver but DAQmx
https://www.ni.com/en/support/downloads/drivers/download.ni-daq-mx.html
After installing it, you could find some examples in the Example Finder in LabVIEW. Also you can do some prototype work in Measurement & Automation Explorer.
Xu Zheng
时编辑过了
08-24-2009 03:00 AM
Thank u Mr xuzheng, i want to program a RTX program so i need to program a register level driver for 6230,can u give me some help on driver development? thank u for ur reply.
08-24-2009
04:24 AM
- last edited on
01-22-2025
05:07 PM
by
Content Cleaner
Sorry, Jude. I think all the information I could found is in the MH-DDK webpage: http://sine.ni.com/nips/cds/view/p/lang/en/nid/11737 You would also notice on this page that the DDK is mainly for OEM customers and NI standard phone and e-mail support are not available for NI Measurement Hardware DDK users.
08-24-2009 07:56 AM
Hi Jude-
This post has some tips for programming a 6229 M Series device for quadrature encoder use. The information there should also apply to your 6230 (and all other M Series devices).
Hopefully this helps-
08-25-2009 09:13 PM
08-26-2009 04:38 PM
Hi Jude-
What specific behavior are you seeing when you say that you cannot use the AO function again? Is there an AO voltage being generated that stops when you call this function? In what way do you intend to use the writeG0_Load_A function?
With some more detail on the behavior of the application and the intended use case for the function that appears to be breaking it, we may be able to help you get both subsystems working as you'd expect them to.
Thanks-
Ed
08-26-2009 09:40 PM
thank u for your reply first,i show the program detail to u to know about more about my problem,i am expecting for ur reply .
#ifndef ___pci6230_h___ #include "pci6230.h" #endif //this main function shows the sequence of sub function used main() { Findboard(); initMite(); Button_1.click()//when i click button1 this function excute { DAC_OUT(0,5);//channel 0- out put 5V } Button_2.click()//when i click button2 this function excute { DAC_OUT(0,0);//channel 0-out put 0V } //Button_1.click(),Button_2.click(),if i always use this to function i can get the voltage i want. Button_3.click()//when i click button3 this function excute { myGPCT();;//test } //when i click button3 the program excute Button_3.click().after excute Button_click(),i click button1 or button2,the out put voltage
//keep in the former voltage,i means that before i excute the Button_3.click(),it out put 5v,it keeps,cannt be changed again.untill i reboot the windows system.can any boday tell me why. ShutDown6230(); } //Find and initial the board 6230 int Cpci6230::Findboard() { bus = acquireBoard("PCI1::0xe::INSTR"); if(bus == NULL) { return 1; } //Intitialise Mite Chip. this->initMite(); return 0; } //initial the MITE void Cpci6230::initMite() { tAddressSpace bar0; u32 physicalBar1; //Skip MITE initialization for PCMCIA boards //(which do not have a MITE DMA controller) if(!bus->get(kIsPciPxiBus,0)) return; bar0 = bus->createAddressSpace(kPCI_BAR0); //Get the physical address of the DAQ board physicalBar1 = bus->get(kBusAddressPhysical,kPCI_BAR1); //Tell the MITE to enable BAR1, where the rest of the board's registers are bar0.write32(0xC0, (physicalBar1 & 0xffffff00L) | 0x80); //bar1 = bus->createAddressSpace(kPCI_BAR1); bus->destroyAddressSpace(bar0); } //shut down the board 6230 int Cpci6230::ShutDown6230() { //bus->destroyAddressSpace(bar1); releaseBoard(bus); return 0; } void Cpci6230::test() { u32 serialNumber; serialNumReadMSeries(bus, &serialNumber); printf ("Serial Number: 0x%08X\n", serialNumber); } //Output a voltage signal to chanel,The scaled part was changed,i still don't understand the Eeorom operation~ void Cpci6230::DAC_OUT(int channel,float voltage) { // read eeprom for calibration information /* const u32 kEepromSize = 1024; u8 eepromMemory[kEepromSize]; eepromReadMSeries (bus, eepromMemory, kEepromSize); */ // create register map tAddressSpace bar1; tMSeries *board_tMSeries; bar1 = bus->createAddressSpace(kPCI_BAR1); board_tMSeries = new tMSeries(bar1); // ---- AO Reset ---- configureTimebase (board_tMSeries); pllReset (board_tMSeries); analogTriggerReset (board_tMSeries); aoReset (board_tMSeries); aoPersonalize (board_tMSeries); aoResetWaveformChannels (board_tMSeries); aoClearFifo (board_tMSeries); // unground AO reference board_tMSeries->AO_Calibration.writeAO_RefGround (kFalse); // ---- End of AO Reset ---- // ---- Start A0 task --- /* tScalingCoefficients scale; aoGetScalingCoefficients (eepromMemory, 0, 0, channel, &scale); */ aoConfigureDAC (board_tMSeries, channel, 0xF, tMSeries::tAO_Config_Bank::kAO_DAC_PolarityBipolar, tMSeries::tAO_Config_Bank::kAO_Update_ModeImmediate); // ---- Write to DAC ---- i32 value; //aoLinearScaler (&value, &voltage, &scale); value=(voltage/10.0)*32768; //printf ("voltage: %f (%d)\n", voltage, value); board_tMSeries->DAC_Direct_Data[channel].writeRegister (value);//value // ---- Stop ---- // cleanup delete board_tMSeries; bus->destroyAddressSpace(bar1); return; } void Cpci6230::testt() { cardSpace = bus->createAddressSpace(kPCI_BAR1); board_tTIO = new tTIO(cardSpace); board_tTIO->G01_Joint_Reset_Register.writeG0_Reset(1); board_tTIO->G0_Command_Register.writeG0_Disarm(1); board_tTIO->G0_Load_A_Registers.writeG0_Load_A(0x00000000); board_tTIO->G0_Command_Register.readG0_Disarm(); delete board_tTIO; bus->destroyAddressSpace(cardSpace); } //Counter test void Cpci6230::myGPCT(void) { tAddressSpace cardSpace; tTIO *board; cardSpace = bus->createAddressSpace(kPCI_BAR1); board = new tTIO(cardSpace); //Reset board->G01_Joint_Reset_Register.writeG0_Reset(1); //Disarm board->G0_Command_Register.writeG0_Disarm(1); //load initial value of 0 board->G0_Load_A_Registers.writeG0_Load_A(0x00000000); board->G0_Command_Register.writeG0_Load(1); //set the counting mode to quadrature encoding X4 board->G0_Counting_Mode_Register.setG0_Encoder_Counting_Mode(3); board->G0_Counting_Mode_Register.writeG0_Index_Phase(3); //set source to the internal timebase (20 MHz) board->G0_Input_Select_Register.writeG0_Source_Select(0); //set gate board->G0_Input_Select_Register.writeG0_Gate_Select(2); board->G0_Mode_Register.writeG0_Gate_Polarity(0); board->G0_Mode_Register.writeG0_Gating_Mode(2); board->G0_Mode_Register.writeG0_Trigger_Mode_For_Edge_Gate(3); //set counting direction to Gate IO connector board->G0_Command_Register.writeG0_Up_Down(2); //arm counter printf("counter value is 0x%08lx\n", board->G0_Save_Registers.readRegister()); board->G0_Command_Register.writeG0_Arm(1); //delay long enough for the quadrature encoder to turn a few times { long int i,j; printf("waiting...\n"); for(i=0;i<10;i++) for(j=0;j<30;j++) ; } //read counter value //Use this method to read the value of an armed counter //during non-buffered counting. Since the value of the counter may //change during the read, we make sure that the value is stable. unsigned long counterValue1, counterValue2; counterValue1 = board->G0_Save_Registers.readRegister(); counterValue2 = board->G0_Save_Registers.readRegister(); if(counterValue1 != counterValue2) counterValue1 = board->G0_Save_Registers.readRegister(); printf("counter value is now 0x%08lx\n",counterValue1); //Disarm board->G0_Command_Register.writeG0_Disarm(1); delete board; bus->destroyAddressSpace(cardSpace); }
08-26-2009 09:46 PM
hi Ed W
i want to use 6230 AO function to out put a voltage,and also use the Position Measurement function of GPCT to get the feed back of system from the position sensor (it haves A,B signal).
thank u for ur help.
08-27-2009 01:25 PM
Thanks, Jude. I'm currently looking into the problem, but I have some side questions for you in the mean time. It's clear that you're using Windows - what version are you using, and why did you decide to use the driver development kit? The only reason I ask is that NI-DAQmx will allow you to write software to control and measure with your 6230 without requiring you to develop custom driver. Let me know, and I'll get back to you on the position measurement problem that you're having as soon as I can.
Thanks again,
Ed