02-11-2014 02:31 PM
Dear all,
I need help to solve my problem which about synchronize the input voltage with output. I am trying to write a code that can synchronize the output voltage ( to the actuator) with input voltage (from the sensor) with changing the offset voltage (Dc voltage) while the code is running.
I have tried to test the code by connecting the input with output voltage as can be seen in the attached figure.
I found there is a delay between generating a date and acquiring a data by (Fs* number of sample). For example, if i set the number of sample (10000 )and sampling rate (1000 Hz), the delay is 10 s. I need to improve the code where it can write and read simultaneously with changing the offset voltage (Dc voltage).
Could do you please help me to improve this code.
Khalid
02-11-2014 02:33 PM
Synchronization input with output
02-11-2014 02:45 PM
Yes, reading 10k samples at a rate of 1k samples/sec takes 10 secs ...
Read 1k samples at a time, e.g.
/Y
02-11-2014 02:53 PM
hi Yamaeda,
Thank you very much for your reply.
Actually, I need to chane the dc voltage while running a code, but the code does not acquire with generate the voltage simultaneously. Do you have any clue how i improve the code. I need this code to do control system.
Khalid
02-11-2014 03:05 PM
In general, you want a Feedback node (shift register) in the loop to push information between loop iterations. In this case you'll need the output as feedback to next iteration to correct/change the output.
Drag the output to the loop border and change it to Shift register, then you can use the "previous iteration information" in the next iteration.
/Y
02-11-2014 03:43 PM
Hi Yamaeda,
I have added shift register to the task out as can be seen in the attached file, but still facing the same problem.
Khalid
02-11-2014 04:29 PM
Hi Yamaeda,
Actually, I am new and not expert in this field. Could do you help me please?
I do not know which output I should drug it to the board to do shift register?
Best regards,
Khalid
02-12-2014 12:30 AM
Hi, Khalid1,
How about disconnect the terminal of number of samples per channel of the DAQmx Read.vi?
02-12-2014 02:35 AM
Hi Khalid. Placing the VISA resource in a shift register is recommended, so it's all good. What you're after, however, is to send the actual reading to a shift register so you can access it and correct your values, probably the current input also. That way you can adjust the input depending on what the output was last iteration.
Do that and run the VI in Highlight and Retain values mode (the 2 lights on toolbar) and you'll see how it works.
/Y
02-12-2014 02:40 AM