Difference in analog input and analog output values
i am using 6014 DAQ card for providing motor speed reference voltage to Driver and reading back speed
feedback voltage using LabVIEW 6.0. For this i have used AO Single Update and AI Single scan. Both are in the same while
loop.The loop has a Wait timer of 50ms. When i take a plot of Analog o/p and input, i get a shift
between input and output. Why is the shift or the time not synchrnised..please help..When the while loop wait timer is 200ms instead of 50ms, the shift is not there.
I believe the problem is 2 fold. First if you are using traditional DAQ, or DAQ 6.9.3 or before, the driver is single threaded. Therefore the 2 VIs will not run simultaneous. Try DAQmx and you may be more successful.
The other is that you are using higher level 1 point VIs. In general they are not the best to use in a time sensitive loop. You are better off using hardware timing, rather than software timing. With hardware timing you have more control over the synchronization of the 2.
Similar Messages
-
How to combine the analog input and analog output vi's
Hi !
I have a perfectly running triggered analog input acquisition vi. I have a seperate vi for analog output that's running perfectly too. Can someone tell me how to combine these two operations so that I could get a vi that does simulataneous AI and AO without missing triggers. I have tried all the different kinds of configurations suggested by NI support but nothing seems to work. Can someone help ?
thanks,
Shiva
Attachments:
dac_good.vi 77 KB
adc_good_fw.vi 124 KBShiva;
I'm attaching a good Application Notes that shows how to synchronize multiple DAQ tasks, in Labview.
Hope this helps.
Filipe
Attachments:
Advanced_Sync_Techniques_for_DAQ.zip 166 KB -
I am using the PCI-7344 to control my system. The analog inputs are connected to the output of my system while the analog outputs serve as feedback to the system. The system is a servo. I want to know what is the conversion between the voltage read at the input, to card counts, and finally to the voltage output to the system.
Carole,
If you are trying to do analog feedback with a servo motor, Chapter 14 of the manual talks about how to set up the torque feedback. Also linked below is a LabVIEW example of analog feedback.
Chapter 14
NI-Motion User Manual
Automatic Analog Feedback with FlexMotion example
A. Talley
National Instruments -
Simultaneous Analog In and Analog Out
How to Output on Analog Out and read Analog In at the same time.
I am using a VC++, NIDAQ 7.01.
No LabView.Greetings,
The following example demonstrates how to perform synchronized analog input and analog output:
Synchronizing Analog Input and Output
The example was written in CVI, but modifying it for use in VC++ is fairly straightforward and documented within the code.
Good luck with your application.
Spencer S. -
Analog Input and Output in One Single VI
I need help in setting both analog input and output in one single VI. How do I assign channels to be either input or output? How do I simultaneously uses both in one single VI with a while loop structure?? Which AO am I suppose to use to obtain signal from the function generator I have built to feed into the DAQCard-1200?? Help!!
Attachments:
Test1.vi 48 KBOne thing you'll need to be aware of is that you will need to DMA lines: one for AI and one for AO. If you don't, then you can configure the DAQCard to do without DMA using the Config VI. But you certainly can do this.
As far as your function generator, you will want to do a buffered analog output. You will write your buffer of points to the buffer, and then tell NI-DAQ how fast to update your analog output channel with these values.
So, you can be reading from AI and checking the AO process in the same while loop. Just make sure you handle the while loop execution (the wait it exits) correctly. This can get tricky when you're doing two types of measurements.
J.R. Allen -
Hi everyone,
I am doing simple task in Visual C++ and I am using PCI-6221(37 pin).
Basically, I want to send same signal from 'analog input' to 'analog output'
at the same time (almost), to make it real-time application.
Can someone please provide me sample program.
I would appreciate if you could provide me with the good tutorial which explains
step by step everything about programing NI-DAQmx for C/C++.
Best Regards,
Khassan
Solved!
Go to Solution.This is my code in C++, you can optimize it if it looks too messy. This code reads signal from analog input and outputs it through analog output.
To make this code work additional include directories and library directories must be added from NI.
I hope it helps someone.
#include <stdio.h>
#include <conio.h>
#include "NIDAQmx.h"
#include <math.h>
#define DAQmxErrChk(functionCall) { if( DAQmxFailed(error=(functionCall)) ) { goto Error; } }
int main(int argc, char *argv[])
int32 error=0;
TaskHandle taskHandleRead=0,taskHandleWrite=0;
int32 read=0;
float64 dataRead[1000];
char errBuffRead[2048]={'\0'};
char errBuffWrite[2048]={'\0'};
bool32 done=0;
int32 written;
DAQmxErrChk (DAQmxCreateTask("",&taskHandleRead));
DAQmxErrChk (DAQmxCreateAIVoltageChan(taskHandleRead,"Dev1/ai0","",DAQmx_Val_Cfg_Default,-10.0,10.0,DAQmx_Val_Volts,NULL));
DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandleRead,"",100.0,DAQmx_Val_Rising,DAQmx_Val_ContSamps,0));
DAQmxErrChk (DAQmxCreateTask("",&taskHandleWrite));
DAQmxErrChk (DAQmxCreateAOVoltageChan(taskHandleWrite,"Dev1/ao0","",-10.0,10.0,DAQmx_Val_Volts,NULL));
DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandleWrite,"ai/SampleClock",100.0,DAQmx_Val_Rising,DAQmx_Val_ContSamps,1000));
DAQmxErrChk (DAQmxStartTask(taskHandleRead));
DAQmxErrChk (DAQmxStartTask(taskHandleWrite));
while( !done && !_kbhit() )
DAQmxErrChk (DAQmxReadAnalogF64(taskHandleRead,1,10,DAQmx_Val_GroupByScanNumber,dataRead,1000,&read,NULL));
DAQmxErrChk (DAQmxWriteAnalogF64(taskHandleWrite,read,0,10.0,DAQmx_Val_GroupByChannel,dataRead,&written,NULL));
_getch();
Error:
if( DAQmxFailed(error) )
DAQmxGetExtendedErrorInfo(errBuffRead,2048);
DAQmxGetExtendedErrorInfo(errBuffWrite,2048);
if( taskHandleRead!=0 )
DAQmxStopTask(taskHandleRead);
DAQmxClearTask(taskHandleRead);
if( taskHandleWrite!=0 )
DAQmxStopTask(taskHandleWrite);
DAQmxClearTask(taskHandleWrite);
if( DAQmxFailed(error) ){
printf("DAQmx Error: %s\n",errBuffRead);
printf("DAQmx Error: %s\n",errBuffWrite);
printf("End of program, press Enter key to quit\n");
getchar();
return 0; -
How to synchronize analog input and output from two different USB daq boards
Hi all,
I have two very differnt USB boards the NI USB 6008, which I am using to acquire the data (Analog Input) and a NI USB 9263, it is an Analog Output only board that I am using to deliver a signal (in this case a square pulse). The reason why I am not using the 6008 Analog Ouputs is because I need to deliver negative voltages and need the full +/-10V range.
Looking at similar posts I am pretty sure that I can't use an external trigger or a shared clock, I also tried to use the synchronization of timed structures but no cigar.
I am including a quick vi that I whipped out showing how the signal jitters due to the lack of synchronization. The AO from the 9263 connects to the AI in the 6008 in this example.
Solved!
Go to Solution.
Attachments:
Test Pulse.vi 117 KBI talked to a specialist in the phone and tols me that it is not possible.
-
Can we acquire the Analog input and Digital Input at
Can we acquire the Analog input and Digital Input at
the same time? My sensor data include Analog and
digital signals.Hi Chenchen,
It usually simplifies things greatly if you use analog inputs to monitor both the analog signals AND the digital signals.
If you abosulutely HAVE to use digital lines, then the answer is, DEPENDS....
With the correct hardware and depending on how fast you want to collect data and how closely the measurements have to be syncronized in time, it can be done.
But first, concider using analog inputs to monitor all signals.
If you need to move forward with both analog and digital acquisitions, then post a new quesion and give us details on the hardware you are using and the other details we will need to advise you.
Trying to help,
Ben
Ben Rayner
Certified LabVIEW Developer
www.DSAutomation.com
Ben Rayner
I am currently active on.. MainStream Preppers
Rayner's Ridge is under construction -
Hi all,
This is my first post.
I use an arduino 1 board to read 2 (x & y) analog signals.
I would like to command 1 pwm output on the bases of the 2 analog signals.
The idea is create a table 3x3 in wich x and y axes are based on the values of the analog signals and the output is the pwm output.
I have tried in several modes but no succes.
Can someone help me?
Thanks a lot in advancethanks for the reply.
I woul like to realize a simple PWM controller. I made the same writing the SW in C and it was working, but no flexible and without a graphical interface.
Well...
inputs:
Two analog signals; range 0-5V f(t).It could vary very fast in the time. I use two simple potentiometers to simulate the voltage variations.
output:
PWM: range 0 - 255. connected to a led.
I woul like to have the possibility to change the PWM with a table m X n where m is related to input 1 and n is related to input 2.
I will post the the SW tried by me as soon as possible. Now... dinner!
thanks all and best regards! -
Simultaneously read more than one input and generate output
Is it possible To simultaneously read more than one input and generate outputs depending on these inputs? If this isn't possible what is the best way to go about making some sort of timed loop that will read an input, read the next input, decide whether or not to output and so on. Hope someone can help. Thanks.Message Edited by Esmith13 on 05-25-2005 01:36 PM
Hi,
You should look at the synchronized examples for analog input and output that can be found in the example finder under:
Help>>Find Examples>>Hardware Input and Output>>DAQmx>>Synchronization>>Multi-Function
These will get you started to being able to handle multiple tasks at the same time.
I hope this helps. Have a Great Day!
George -
Synchronization of analogue input and analogue output?
Hi there,
I have a signal synchronization problem:
I am sending two waveforms (i.e choice between sinus square triangle etc see attached VI) to a mechanical system and then I'm reading the acquired signal from this same system (and it should be similar).
The signal I am reading is indeed similar, however, the synchronization is not perfect. Whenever I changes the frequency of the signal the phase of the aquired signal is shiffting...
Does anyone have an idea how I should synchronize both send and aqcuired signal?
Many thanks,
Best,
Renaud
PS: I attached the VI in question
Attachments:
Galvo_Monitor_3.vi 43 KBHi,
As you stated, there is mechanical system inbetween, it is obvious to have delay in response. If you try the same code by direct wiring Analog Input and Output, you will observe no delay in them.
Regards,
DCKAN -
Difference between Batch input and Direct Input
Hi please tell me the difference between Batch Input and Direct Input in BDC?
hi aparna,
<b>DIRECT INPUT</b>
TO ENTER THE DATA INTO THE CORRESPONDING DATABASE TABLES DIRECTLY, THE SYSTEM CALLS A NUMBER OF FUNCTION MODULES THAT EXECUTE ANY NECESSARY CHECKS. IN CASE OF ERRORS, THE DIRECT INPUT TECHNIQUE PROVIDES A RESTART MECHANISM. HOWEVER, TO BE ABLE TO ACTIVATE THE RESTART MECHANISM, DIRECT INPUT PROGRAMS MUST BE EXECUTED IN THE BACKGROUND ONLY. DIRECT INPUT CHECKS THE DATA THOROUGHLY AND THEN UPDATES THE DATABASE DIRECTLY.
TO MAINTAIN AND STRAT THESE PROGRAMS, USE PGM RBMVSHOW OR THE TRANSACTION BMVO.
<b>BATCH INPUT</b>
TYPES SESSION METHOD, CALL TRANSACTION, DIRECT INPUT.
TO SAVE DATA IN THE BDCTAB, USE THE FIELDNAME BDC_OKCODE AND FIELD VALUE OF /11.
BDCDATA
THIS IS A STRUCTURE WHICH CONTAINS THE FOLLOWING FIELDS.
PROGRAM NAME OF TH MOD PROG ASSOCIATED WITH THE SCREEN. SET ONLY FOR THE FIRST RECORD OF THE SCREEN.
DYNPRO SCREEN NUMBER. ALSO SET ONLY FOR FIRST RECORD.
DYNBEGIN INDICATES THE FIRST RECORD OF THE SCREEN. SET X FOR FIRST RECORD OTHERWISE .
FNAM FIELD NAME.
FVAL VALUE FOR THE FIELD NAMED IN FNAM.
THE FIRST STEP IN BDC IS TO UPLOAD DATA FROM THE FLAT FILE OR SEQUENTIAL FILE TO THIS BDCTABLE.
SESSION METHOD
WE USE 3 FUNCTION MODULES IN THIS SESSION METHOD.
1) BDC_OPEN_GROUP
USER NAME: USER NAME
GROUP: NAME OF THE SESSION
LOCK DATE: THE DATE ON WHICH YOU WANT TO PROCESS THE SESSION.
KEEP: THIS PARAMETER IS PASSED AS X WHEN YOU WANT TO RETAIN SESSION AFTER PROCESSING IT OR TO DELETE IT AFTER PROCESSING.
THIS CREATES A SESSION
2) BDC_INSERT
TCODE: TRANSACTION NAME
DYNPROTAB: BDC DATA
THIS CREATES A SEESION AND DATA IS TRANSFERRED O SESSION.
3) BDC_CLOSE_GROUP THIS CLOSES THE BDC GROUP.
ONLY ONE SESSION CAN BE CREATED USING BDC_OPEN_GROUP. BUT MULTIPLE TRANSACTIONS CAN BE PROCESSED USING BDC_INSERT.
CALL TRANSACTION
CALL TRANSACTION <TCODE> USING <BDCTAB>
MODE <A/N/E>
UPDATE <S/A>
MESSAGES INTO <MSGTAB>.
A ALL SCREEN MODE. ALL THE SCREEN OF THE TRANSACTION ARE DISPLAYED.
N NO SCREEN MODE. NO SCREEN IS DISPLAYED WHEN YOU EXECUTE THE TRANSACTION.
E ERROR SCREEN. IF THE SCREEN HAS ERROR RECORD, THEN THAT SCREEN WILL BE DISPLAYED.
S - IF YOU CHANGE DATA OF ONE TABLE THEN ALL THE RELATED TABLES GETS UPDATED. AND SY-SUBRC IS RETURNED I.E., SY-SUBRC IS RETURNED FOR ONCE AND ALL.
A - WHEN YOU CHANGE DATA OF ONE TABLE, THE SY-SUBRC IS RETURNED. AND THEN UPDATING OF OTHER AFFECTED TABLES TAKES PLACE. SO IF SYSTEM FAILS TO UPDATE OTHER TABLES, STILL SY-SUBRC RETURNED IS 0 (I.E., WHEN FIRST TABLE GETS UPDATED
WHEN YOU UPDATE DATABASE TABLE, OPERATION IS EITHER SUCCESSFUL OR UNSUCCESSFUL OR OPERATION IS SUCCESSFUL WITH SOME WARNING. THESE MESSAGES ARE STORED IN INTERNAL TABLE, WHICH YOU SPECIFY ALONG WITH MESSAGE STATEMENT. THIS INTERNAL TABLE SHOULD BE DECLARED LIKE BDCMSGCOLL, A STRUCTURE AVAILABLE IN ABAP/4. IT CONTAINS THE FOLLOWING FIELDS: TCODE, DYNAME, DYNUMB, MSGTYP, MSGID.
DIFFERENCE BETWEEN SESSION AND CALL TRANSACTION
SESSION METHOD CALL TRANSACTION
1. DATA IS NOT UPDATED IN DATABASE TABLE UNLESS SESSION IS PROCESSED. IMMEDIATE UPDATION IN DATABASE TABLE.
2. NO SY-SUBRC IS RETURNED. SY-SUBRC IS RETURNED.
3. ERROR LOG IS CREATED FOR ERROR RECORDS. ERRORS NEED TO BE HANDLED EXPLICITLY
4. UPDATION IN DATABASE TABLE IS ALWAYS SYNCHRONOUS
UPDATION IN DATABASE TABLE CAN BE SYNCHRONOUS OR ASYNCHRONOUS.
5. ASYNCHRONOUS PROCESSING SYNCHRONOUS PROCESSING
6. TRANSFERS DATA FOR SINGLE TRANSACTIONS TRANSFERS DATA FOR MULTIPLE TRANSACTIONS
ERROR HANDLING IN CALL TRANSACTION
1) CREATE AN INTERNAL TABLE SIMILAR TO THE STRUCTURE OF YOUR LOCAL FILE.
2) CREATE BDCTAB LIKE BDCDATA.
3) CREATE BDCMSG LIKE BDCMSGCOLL.
4) CREATE AN INTERNAL TABLE SIMILAR TO THE 1ST INTERNAL TABLE.
5) UPLOAD FN UPLOADS DATA FROM THE LOCAL FILE TO THE ITAB.
6) LOOP AT ITAB.
POPULATE BDCTAB TABLE.
CALL TRANSACTION STATEMENT.
PERFORM CHECK.
REFRESH BDCTAB.
ENDLOOP.
7) FORM CHECK.
IF SY_SUBRC <> 0.
CALL FUNCTION FORMAT_MESSAGE.
APPEND ITAB2.
ENDFORM.
TRANSACTION FOR RECORDING SHDB.
MAX TIME ALLOWED FOR ONLINE EXECUTION 300 SECONDS.
<b>
Pls reward if helpful.</b> -
Xbox digital audio input and then output through MacBook digital audio port
Hi,
Sorry if this has been asked before but I'm trying to output a Dolby Digital (I think AC3) signal from my Xbox 360 into the MacBook's digital audio input and then output it through the digital audio output. I can output 5.1 sound from the MacBook itself but I can't get the Xbox audio to pass through. I don't know if the audio is at a sample rate not supported or needs decoding or what!
Any help would be appreciated!If that doesn't work, I'm not quite sure.
A combination of the Audio MIDI Utility (in Applications/Utilities), SoundSource, LineIn, and Soundflower (http://cycling74.com/products/soundflower/) might work, otherwise I'm stumped. Your best bet is probably a dedicated external USB or FireWire audio interface. -
Difference between parent currency and parent in value dimension
Hi
Dear friends please tell me about following:
1.Difference between <Parent Currency> and <Parent> in value dimension and its significance.
2.Difference between <Parent Currency Adjs.> and <Parent Adjs.> in value dimension and its significance.
Thanks
Mayank
Edited by: mayanka bhusan on Jun 17, 2010 10:08 PMWhen you have an entity which contributes to two or more parent entities, you can specify if an adjustment applies and contributes to all parent entities or the selected entity.
1. Create the adjustment to <Parent Curr Adjs> and the adjustment value contributes to all parents.
2. Create the adjustment to [Parent Adjs] and you can select which parent entity you want the adjustment value to contribute to.
<Parent Currency> is where the translation happens.
<Parent Curr Total> is the total of the translated value plus any adjustments applying to all parents -i.e. <Parent Curr Adjs>
[Parent] simply carries the <Parent Curr Total> numbers to the next level of the value hierarchy
[Parent Total] is the total of the previous level plus any adjustments applying to the specified parent -i.e. [Parent Adjs] -
Digital input and digital output at the same time
Hi all
I have a PCI-6503 board. I have done 2 task that run simultaneously: the first one is port0_16 output and the second one is port2 input.
I get sometimes (not every times...this is strange...) error-200587 saying:
'Requested operation could not be performed, because the specified digital lines are either reserved or the device is not present in NI-DAQmx.
It is possible that these lines are reserved by another task, the device is being used through the Traditional NI-DAQ interface, or the device is being reset. You might also get the error if the specified resource is currently in use by LabVIEW network variables bound to the DAQ Channel, or if the DAQ Channel is being used in any OPC Client software.
If you are using these lines with another task, wait for the task to complete. If you are using the device through the Traditional NI-DAQ interface, and you want to use it with NI-DAQmx, reset (initialize) the device using the Traditional NI-DAQ interface. If you are resetting the device, wait for the reset to finish.'
In the attached VI i have recreated the basic structure of my real VI (the error is present even here of course...).
How can i do?
I want to have both digital input and digital output with the same PCI-6503 every single cycle... Is it possible?
Please help me!!!
Kind regards.
I love the smell of napalm in the morning
Attachments:
DIO simultaneously error.vi 31 KBHello Maverick,
Did you have any luck with the example Raven sent you?
In Raven's example, it properly passes the DAQmx task from one SubVI to another to avoid having to open the task again. These errors are likely to occur when you have multiple DAQmx calls in a VI that call the same task again without clearing the previously opened task. If at any given time you try to open a task that already is being used, you might receive an error "resource is reserved"... similar to your original example.
If you are interested, here is an awesome link that gives a detailed explanation of the LabVIEW dataflow paradigm
Learn 10 Functions in NI-DAQmx and Handle 80 Percent of Your Data Acquisition Applications
Thanks and good luck!
Jordan Randall
National Instruments Italy
Maybe you are looking for
-
How do I add a new apple ID for a child to my account?
My daughter has an apple ID but it's not connected to a family sharing plan. Is there a way to tell iTunes that she's my daughter, and put the adult password on it so she can't buy anything without asking first? If I try to add her as a family member
-
I recently got a new computer and a new iTunes account. How do I transfer all of the content from my iPod Touch to my new library without it syncing and deleting everything? Thanks!
-
Urgent Need for Freeing space on time machine
unable to free space on time machine for backups. Unable to see option to delete various backups by right clicking on the file name in the list on the right side of the screen. I clicked on the "gear icon" on the actual picture of the backup in Time
-
I have developed local entity bean in weblogic 8.1 but i wouldnt able to get the Initial Context of the Bean. It throws javax.naming.NoInitialContextException But in jndi tree it shows the bean.. the problem is only for Local Bean Remote Beans are wo
-
Having a problem downloading an app from adobe cc exhange panel
I am having a problem downloading an app from adobe exchange panel. It allows me to log in but then just keeps trying to download. it looks a little like a bicycle wheel turning and turning Elizabeth