ni.com checkout is currently experiencing issues.
Support teams are actively working on the resolution.
ni.com checkout is currently experiencing issues.
Support teams are actively working on the resolution.
04-30-2013 09:08 AM
How can i use the millis() function in labview?
04-30-2013 04:05 PM
That depends on what you are trying to do with it. Could you explain in detail what you are needing?
05-01-2013 03:49 AM
I am trying to make this code to labview:
void loop()
{
delay(100);
int rpm=getRPM();
}
int getRPM()
{
// sample for sampleTime in millisecs
int kount=0;
boolean kflag=LOW;
unsigned long currentTime=0;
unsigned long startTime=millis();
while (currentTime<=sampleTime)
{
if (digitalRead(hallPin)==HIGH)
{
kflag=HIGH;
}
if (digitalRead(hallPin)==LOW && kflag==HIGH)
{
kount++;
kflag=LOW;
}
currentTime=millis()-startTime;
}
int kount2rpm = int(60000./float(sampleTime))*kount;
return kount2rpm;
}
05-02-2013 11:07 AM
Something like this cannot be easily implemented with an unmodified version of LIFA.
To calculate the speed of a device (with your sensor) you would want to use a counter implemented with the Arduino interrupts. I would recommend using this method even without LabVIEW.
So, the first step would require that you convert your algorithm to be a counter using the interrupts and then either calculating the speed on the arduino first and then send the speed value to LabVIEW with a custom LIFA function or sending the raw count data to LabVIEW with a custom LIFA function and then calculating the speed there. The former of the two is probably the more accurate method.