LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Programming NI PCI 1588

Is anyone familiar with adding .lib files to a project in VC++  I have tried everything I can think of in the properties menu.

The online manual says its located at "Link>>General>>Object/Library Modules" but those instructions are for a different version.
0 Kudos
Message 11 of 21
(2,193 Views)
Hey HNelson,

You can add additional libraries to a VS2005 project by right clicking on your project in the Solution Explorer and going to properties.  This should open up your project properties window, and from here go to Configuration Properties>>Linker>>General.  You will need to add the directory that your lib file is located in if it's not in the project directory into "Additional Library Directories".  Then you will need to go to the "Input" menu item, and add the names of the libs to include under "Additional Dependencies".  Hope this helps!
Pat P.
Software Engineer
National Instruments
0 Kudos
Message 12 of 21
(2,180 Views)
After adding the folder containing the .lib files to the "Additional Library Directories" box, none of the libraries contained in that folder appear in the "Additional Dependencies" dialog box. 
0 Kudos
Message 13 of 21
(2,188 Views)
Hi HNelson,
You still have to add the names of the libs to include under "Additional Dependencies".  It doesn't automatically add them.


Pat P.
Software Engineer
National Instruments
0 Kudos
Message 14 of 21
(2,180 Views)
When i go to the additional dependencies option, I click on the "..." located at the far right and in the list of .lib files none of the .lib files i need are in that list.
0 Kudos
Message 15 of 21
(2,178 Views)
Hi HNelson,

They are not going to appear in the list.  You will need to put the names of the lib files there (for example test.lib, daq.lib, etc.).  You should just be able to type in the names.

Message Edited by Patrick P. on 08-02-2007 01:46 PM

Pat P.
Software Engineer
National Instruments
0 Kudos
Message 16 of 21
(2,167 Views)
I see..  Everything is working now.  I will expiriment with some other functions and see what i can do.  Thanks everyone for the help
0 Kudos
Message 17 of 21
(2,162 Views)
Here's a suggestion on programming the PCI-1588.  Start off by creating an application that calls niSync Init and then niSync Start PTP.  Create a while loop that runs every few milliseconds while calling niSync Get Time and reading the 1588 Clk State and 1588 Offset from Master attributes.  Note that the offset from master will only change when the board becomes a slave device.  You can run this application to see if the PCI-1588 will sync another PCI-1588 or other 1588 devices in your network.

Once you are able to get PTP started and the offset from master settles you should be able to start performing I/O.  I would suggest playing around with the niSync Create Clock, niSync Create Future Time Event, and niSync Enable Timestamp Trigger.  When using the create clock and future time event functions, make sure you use Get Time and then add a few seconds to that in order to come up with a future time input.  If you set the time to far in the future you may have to wait a long time.

Let us know how it goes.  If you have access to LabVIEW I would suggest giving that a try.  It includes around 8 shipping examples for the PCI-1588 and LabVIEW has a built in control for displaying time in a pretty format where you can easily see the date, time, and milliseconds in a format that is easy to read.  It even allows you to autocorrect for timezones and daylight savings.  I've attached a picture of one of the shipping examples to give you a better idea of what they look like.

-Josh
0 Kudos
Message 18 of 21
(2,155 Views)
Thanks for giving me some ideas for getting started.  I have taken you advice and have completed everything in your first paragraph.  For now I have just done this for one card and have yet to try it with 2 cards at the same time.  Here is my code that executes after niSync_StartPTP

     while (i<100) {

    //GET LOCAL 1588 CLOCK TIME
    status = niSync_Get1588Time (myVi, &TSec, &TNano, &TFNano);
        cout << "Time: " << TSec << "." << TNano << "." << TFNano << endl;

    //GET STATE OF LOCAL 1588 CLOCK
    status = niSync_GetAttributeViInt32 (myVi, "", NISYNC_ATTR_1588_1588_CLK_STATE, &int32);
        cout << "State = ";
        if (int32 == -1) { cout << "Not Defined (" << int32 << ")" << endl; }
        else if (int32 == 0) { cout << "Initializing (" << int32 << ")" << endl; }
        else if (int32 == 1) { cout << "Faulty (" << int32 << ")" << endl; }
        else if (int32 == 2) { cout << "Disabled (" << int32 << ")" << endl; }
        else if (int32 == 3) { cout << "Listening (" << int32 << ")" << endl; }
        else if (int32 == 4) { cout << "Pre-Master (" << int32 << ")" << endl; }
        else if (int32 == 5) { cout << "Master (" << int32 << ")" << endl; }
        else if (int32 == 6) { cout << "Passive (" << int32 << ")" << endl; }
        else if (int32 == 7) { cout << "Uncalibrated (" << int32 << ")" << endl; }
        else { cout << "Slave (" << int32 << ")" << endl; }
   
    //CHECK OFFSET FROM MASTER CLOCK   
    status = niSync_GetAttributeViReal64 (myVi, "", NISYNC_ATTR_1588_OFFSET_FROM_MASTER, &real64);
        cout << "Offset = " << real64 << endl;



    Sleep(250);
    i++;
    cout << endl;

    }

    }


A couple questions:

Is there a way to convert the seconds outputted into the date or at least hours:minutes:seconds?
Also, is there a way to code this loop in C++ so that it executes until I press a key to stop?

For now I am going to get this up and running on PC #2 and see how they communicate.


Message Edited by HNelson on 08-03-2007 10:46 AM

0 Kudos
Message 19 of 21
(2,149 Views)
Hi HNelson,

I don't believe there is any function to automatically convert the time.  You should be able to just convert it normally.  I believe it returns the time in nanoseconds.

As far as having it run until the user presses a button, I can't think of an easy way to do this off the top of my head without using multi-threading.  There might be a windows system function to do it.  I would recommend checking msdn or google for non blocking user input functions.
Pat P.
Software Engineer
National Instruments
0 Kudos
Message 20 of 21
(2,109 Views)