07-18-2016 08:01 AM
I don't know. I'm talking about whatever code is actually running on the Arduino that reads the pin and transmits the data to LabVIEW. That is the code that determines at what rate the analog signal is being read. If it isn't acquiring data at 1 kHz, then that would explain your problem.
07-18-2016 09:17 AM - edited 07-18-2016 09:18 AM
@holucbme wrote:Arduino code??? You mean the LIFA_Base? I only process the signal in Labview, sir. Where can I find it in the firmware of arduino?
Post your all of LabVIEW code including the part that is using LIFA or LINX with the Arduino.
07-18-2016 07:51 PM
Here is the code I use the LIFA,
Attached is the .txt file, please read it and help me to figure out my problem.
Thank you in advance, two knights.
07-18-2016 08:02 PM
Do you know how long it takes for the two serial writes to occur?
If you delay for 1000 microseconds, but the the actual time to write to the Arduino's serial port is longer than zero, then the actual loop iteration time is going to be the sum of the delaytime, the time to do the serial writes, and also any other loop overhead time.
07-19-2016 07:45 AM
I dont know, where can I find it?
The code in firmware is original, I have not fixed it. As you said, Should I delete that code line (no delay 1000 us) or change the delay time?
07-19-2016 08:06 AM - edited 07-19-2016 08:33 AM
I haven't used an Arduino, so I don't know what programming options are available to you. I can assume they have something that can measure the time before and after some lines of code, kind of like the "tick count" function in LabVIEW. Perhaps there is a "wait until" function that will allow the code to wait at until a certain timer value has occurred.
I think you will need to look around for more Arduino examples for code that is designed for repeated timing of doing something like reading a pin rather than the essentially software timing you are doing now.
07-19-2016 08:20 AM
Thank you so much, RavensFan.
07-19-2016 09:23 AM
@holucbme wrote:Here is the code I use the LIFA,
Attached is the .txt file, please read it and help me to figure out my problem.
Thank you in advance, two knights.
That is LIFA? Looks like Arduino code to me...
You really need to forget LIFA and use LINX.
Using LINX the code on the Arduino basically turns it into a USB DAQ simmilar to a NI USB-6009.
Then it's all LabVIEW with a LINX pallette for the Arduino.
07-19-2016 03:59 PM - edited 07-19-2016 03:59 PM
Sorry sir, I dont have the DAQ devices. I know if using that devices, The spectrum is perfect (no need to use the ADC function)
But I will try to change LIFA to LINX. Thanks all.
07-19-2016 04:11 PM
@holucbme wrote:Sorry sir, I dont have the DAQ devices. I know if using that devices, The spectrum is perfect (no need to use the ADC function)
But I will try to change LIFA to LINX. Thanks all.
I am sorry I do not know what you are talking about. I only mentioned the USN-6009 as an example of a device that has similar functionality to an Ardunio programmed with LINX.
The point I was trying to make is using LINX you do NOT program any Arduino code into the Arduino.
You load the LINX "firmware" onto the Arduino and nothing else.
Once you have the Arduino programmed with LINX 'firmware" you write all your code in LabVIEW and the Arduino basically becomes a USB DAQ device in a sense because now the Arduino can not run stand alone, it must be connected to a computer running LabVIEW or a LabVIEW compiled executable.