Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

Clock correction using SMB connector and GPS PPS on 9012, 9104

Hey CarlaU,

I still need to figure out how to make a fake stub so that the library function call to the VxWorks function like Basset H was saying.

He said, "You can call this with a Call Library Node in LabVIEW provided you'll need to make a fake (stub) LabVIEW.dll on the host that defines this function so the CLN will configure properly. It will only work on the RT target (VxWorks or 901x targets), not on the host, since the host has a stub."

I dont really know how to do that. Does anyone know?

 
---------------------------------
[will work for kudos]
0 Kudos
Message 11 of 27
(2,710 Views)
 

Hi Rex,

Sorry, I've been unable to post over the last few days to help out due to some additional projects I've been working on.  However, I'm back now and I think I can help a litte.  So   The process I linked to earlier says to go through these following steps:

  1. Compile and FTP your *.out shared library to the real time target.
  2. Compile a stub DLL using the same function prototypes as those exported by the *.out shared library. A stub DLL typically only contains the function prototype themselves without any implementation (ie, empty functions.) This stub DLL will only be used on your Windows host machine, and must have the same name as the original *.out shared library - for example: foo.dll and foo.out.
  3. Place a Call Library Function Node on your block diagram and specify foo.* as the Library name or path. On the host machine, LabVIEW will find foo.dll, but on the real time target the executable/VI will find foo.out.
  4. The stub DLL must have the same path relative to the VI in the host development environment as the executable/VI on the real time target

I think your okay with Steps, 1, 3, and 4 and your really just asking how do I create a Stub dll right?  So, basically to create a stub you need to compile a stub DLL using the same function names and arguments as those exported by the *.out shared library.  This is also done with our some PDA targets and I found a good example here, with C code to give you the general idea.

Basically the Stub code will look like this (with includes removed):

#define DLLEXPORT __declspec(dllexport)
#define EXTERNC  extern "C"

/* LvSysBatteryInfo - StubDll function that calls to SysBatteryInfo in SysManger.h in PalmOS API. 
      See PalmBatt.c for actual function.*/

EXTERNC DLLEXPORT unsigned short LvSysBatteryInfo (unsigned char set,unsigned short *warnThresholdP,
           unsigned short *criticalThresholdP, unsigned short *maxTicksP,
           unsigned char *kindP, unsigned char *pluggedIn, unsigned char *percentP)
{
 return 0; //Actual code for function is in PalmBatt.c
}

 

And the Associated C code will look something like this (with includes removed):


UInt16 LvSysBatteryInfo (Boolean set,UInt16 *warnThresholdP, UInt16 *criticalThresholdP, Int16 *maxTicksP,
      SysBatteryKind *kindP, Boolean *pluggedIn, UInt8 *percentP)
{
 return SysBatteryInfo (set, warnThresholdP, criticalThresholdP,  maxTicksP, kindP, pluggedIn, percentP);
      
}

The creation of the Stub is really so that LabVIEW RT does not pop up a warning message when you try to deploy your application that it does not recognize the .out file.  I belive you can just ignore the pop up message and everything will run fine provided you have ftped the .out file to your RT target.  Let me know if that makes sense or if you have issues trying to get this up and running.

Regards,

Basset Hound

 

0 Kudos
Message 12 of 27
(2,704 Views)
Well I really appreciate your help. I see now where I was getting confused. I didn't realize this needed to be compiled in C. So... maybe I do need help with all the steps (i know how to ftp of course). Also put the includes in the code, because I will just use your code. Can't thank you enough.


Message Edited by rex1030 on 04-16-2008 03:49 PM
---------------------------------
[will work for kudos]
0 Kudos
Message 13 of 27
(2,688 Views)
I know this is an old thread, but what brand of GPS are you using that outputs PPS ?
0 Kudos
Message 14 of 27
(2,304 Views)

Hi CarlaU,

 

Sorry to disturb you. Just now I also want to use the SMB pin on the CRIO 9074 to connect to the PPS signal from the GPS receivers to synchronize the measurement (not using the PPS to correct the clock drift ). So my problem is now I can't read the PPS signal out by using the SMB pin. And I have checked this article http://digital.ni.com/public.nsf/allkb/173D82D2BFAAEA12862572D1006098B4 , but it doesn't help. Can you tell me how should I do that? 

 

Thanks very much for your help!

 

Regards,

Henry

0 Kudos
Message 15 of 27
(1,529 Views)

Henry,

 

Have you tried using the General Purpose Digital I/O VIs that are included on the page you reference?  If so, and you are still experiencing problems, what issues are you seeing?  If you can provide more information about the trouble you are having, I will be better equiped to help you.

 

Kind regards,

 

Drew T.

Drew T.
Camber Ridge, LLC.
0 Kudos
Message 16 of 27
(1,516 Views)

Hi Drew,

 

Thanks for your reply. I have tried one week to figure out the problem but failed. The thing is when I run the vi called Read Example in the folder I referenced, I get nothing from the program. When I use the probe to detect the data flow of this program. It tolds me the program is not even executed! So I just wonder is it possible that there is some little difference between the cRIOs? Since I am using the cRIO-9074 while that vi maybe for cRIO-901x. Maybe the pin number for the SMB pin is different? Just now I cannot get anything out from the SMB pin.

 

Thanks very much for your help!

 

Regards,

Henry

0 Kudos
Message 17 of 27
(1,505 Views)

Hi Drew,

 

Sorry, I just realized I have used my friend's account to reply to you. Sorry.

 

Regards,

Henry

0 Kudos
Message 18 of 27
(1,502 Views)

Henry,

 

I took a moment to set up a test system just now, and was able to get the VIs you referenced working right away.  The steps I took are below.

 

  1. Connect to cRIO-9074.
  2. Install LabVIEW 2011 and RIO 4.0 software on the cRIO
  3. Connect the SMB pin on the cRIO-9074 to a DAQ device.
  4. Open the cRIO-901x SMB DIO.lvproj.
  5. Right Click the cRIO Target Item and change the IP address to that of your cRIO-9074.
  6. Right Click the cRIO Target and select connect.
  7. Open the Read Example.
  8. Run the Read Example.
  9. Open Test Panels for the DAQ device and apply high and low signals to the output.
  10. See the change on the front panel of the Read Example VI.

Note that steps 3 and 9 will differ based on how you are inputting your digital signal.

 

Two things I would like you to do are:

 

    • Try to use a known source for the DIO such as a DAQ device or a 5V battery source.
    • Retry your attempt using the steps above.
    • If these do not work, please reply with the following

LabVIEW Version

NI-RIO Version

Exact steps you took to try this out.

 

Good Luck!

Drew T.
Camber Ridge, LLC.
0 Kudos
Message 19 of 27
(1,489 Views)

Hi Drew,

 

Thanks for your help and now I can get the PPS signal out of the SMB pin. Basically, I want to use the PPS signal received by the SMB pin to trigger other measurements in the C series module. But the PPS signal read by the SMB pin cannot trigger the FPGA code directly and I need to use the DMA FIFO to transfer the PPS data to the FPGA module code and then trigger the measurement in the FPGA code. But now I failed to transfer the data to the FPGA module using the DMA FIFO. I have created a local variable to store the data read by the SMB pin and transfer it in the DMA FIFO code but I cannot get value out from the local variable. I have attached my project, can you give me some help on this?

 

Thanks very much for your help!

 

Best regards,

 

Henry

0 Kudos
Message 20 of 27
(1,482 Views)