Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

C code of the Ni-Sync examples TimeStampTrigger.vi and TimeStampClock-Cont.vi

I need the C programs of the NI-Sync examples "Time Stamp Trigger.vi" and "Time Stamp Clock-Cont.vi",
but I don't have Labview.

Could someone please help me?

Thanks,
Lilian

0 Kudos
Message 1 of 10
(6,009 Views)

Lillian,

 

Estes exemplos somente estão disponíveis em linguagem G (linguagem utilizada pelo LV).

Não consegui localizar nada parecido nos exemplos do LabWindows CVI. Caso queira desenvolver sua aplicação em C você terá de criar algo do princípio utilizando a documentação do NI-Sync.

 

Dario Camargo

NI Brazil

0 Kudos
Message 2 of 10
(5,994 Views)
Dario,

Obrigada por procurar os exemplos.

Se a representação gráfica do "Time Stamp Clock-Cont VI" no LabView for muito diferente do "Time Stamp Trigger VI" (Page 4-2 and 4-3, NI-Sync User Manual, August 2007), você poderia enviar as figuras do "Front Panel" e "Block Diagram" do programa "Time Stamp Clock-Cont"?

Lilian
0 Kudos
Message 3 of 10
(5,954 Views)
Lilian,
 
Segue screenshot das telas solicitadas.
 
Dario Camargo
Download All
0 Kudos
Message 4 of 10
(5,946 Views)
Dario,

Consegui fazer os programas em linguagem C, seguindo o help do NI-Sync e os diagramas de blocos. Vou testar os programas quando o PCI-1588 chegar.

Você poderia me enviar o diagrama de blocos deste link? É o último, prometo.

NI-DAQmx: Continuous Analog Input - Start Trigger and Stop After Desired Number of Pulses


Obrigada,
Lilian


0 Kudos
Message 5 of 10
(5,926 Views)

Dario,

Examinei melhor a descrição do exemplo que eu solicitei no último post e acho que este programa não atende os requisitos do meu projeto. Se entendi bem, a aquisição com start trigger e reference trigger não suporta múltiplos triggers e, sendo assim, não posso adquirir os dados após cada trigger, sem reconfigurar o dispositivo.

Para fazer a aquisição de dados usando o PCI-6010 no projeto How to timestamp continuous analog data acquisition using USB-6009 and GPS timing board?,  acredito que a melhor opção é usar o conceito de "retriggering" apresentado no documento Retriggerable Analog Acquisition in NI-DAQmx. Por favor, me corrija se eu estiver errada. 

Você poderia me enviar o screenshot do diagrama de blocos do programa "Multi-Function-Ctr Retrigg Pulse Train Generation for AI Sample Clock.vi" citado no documento acima?

Encontrei um programa muito bom em linguagem C (Retriggerable_AI_Using_Retriggerable_Counter.c) em DAQmx - Retriggerable AI Using Retriggerable Counter.  Se este programa for igual ao programa "Multi-Function...vi", não precisa enviar o screenshot.

Obrigada,
Lilian


0 Kudos
Message 6 of 10
(5,901 Views)

 

Lilian,

Segue o screenshot solicitado e as informações dos passos do VI:

Steps:
1.  Create an analog input voltage channel.  Also, create a Counter Output channel to produce a Pulse in terms of Frequency.  If the Idle State of the pulse is set to low the first transition of the generated signal is from low to high.
2.  Define the parameters for an External Clock Source. Additionally, define the sample mode to be continuous.  Also, use the DAQmx Timing VI (Implicit) to configure the duration of the pulse generation and the number of pulses to generate.
3.  Use the DAQmx Trigger VI to configure a counter trigger to start on a digital edge.
4.  Configure a buffer which is 1000 plus the number of samples per channel.  This is necessary when simulating retriggerable finite transfers with a continuous acquisition because DMA needs a slightly larger buffer than the Samples per Channel.
5.  Use a DAQmx Trigger Property Node to set the operation for retriggerable.
6.  Call the Start VI to begin the acquisition and to arm the counter which begins the pulse train generation.
7.  Use the DAQ Read property node --> AvailSampPerChan to see how many samples have been acquired.  If 'Samples per Channel' number of samples have been acquired, as you can set on the front panel, then Read the data, otherwise continue looping.  This allows the user to stop the program by pressing the 'STOP' button at any time.
8.  Read the waveform data in a loop until the user hits the stop button or an error occurs.
Note: This example reads data from one or more channels and returns an array of data. Use the Index Array function to access an individual channel of data.
9. Call the Clear Task VI to clear the counter Task.
10.  Call the Clear Task VI to clear the AI Task.
11. Use the popup dialog box to display an error if any.

 

Dario Camargo

0 Kudos
Message 7 of 10
(5,877 Views)
Dario,

Aqui está o programa Multi-Function-Ctr Retrigg Pulse Train Generation for AI Sample Clock.c de Retriggerable Analog Acquisition in NI-DAQmx.

No diagrama de blocos, "Samples Per Channel" não está conectado a função abaixo, mas acho que a variável samples pode ter este valor.

DAQmxCfgSampClkTiming (analogTask, counterSource, rate, DAQmx_Val_Rising, DAQmx_Val_ContSamps, samples);


O diagrama não mostra o bloco condicional quando o resultado é verdadeiro. Acredito que o código do bloco-while seja:

do{

        DAQmxErrChk (DAQmxGetReadAvailSampPerChan(analogTask, &samplesRead));

        if(samplesRead >= samples)
        {
            DAQmxErrChk (DAQmxReadAnalogF64(analogTask, samples, 10.0, DAQmx_Val_GroupByScanNumber,
                                                                               data, samples, &numRead, NULL));

        }

        DAQmxErrChk (DAQmxIsTaskDone(analogTask, &isTaskDone));

}while( !kbhit() || !isTaskDone );



Obrigada,
Lilian



PS.: This program was not tested.
0 Kudos
Message 8 of 10
(5,857 Views)

 

Lilian,

Eu havia esquecido do case true, envio em anexo agora.

 

Dario

0 Kudos
Message 9 of 10
(5,832 Views)

Hi Lilian,

Can you Help me in regards Time Sync Card PXI-6683H, as I am looking for the VC++/C++ code to access the PXI-6683H card and its functionality. I have tried to implement the code using LabWindows and VC++ but I couldn't get the results. There is some linking errors and other errors after solving the linking error. Can you please provide the reference code which you have mentioned that you could write the C code for the Time Card. It would be great help if you can help in any form or guide me to access PXI-6683H time sync card. 

Thanks, 

 

With sincerely,

Shravan Kumar Parakala.

0 Kudos
Message 10 of 10
(3,896 Views)