From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
03-02-2016 03:11 PM
Solved! Go to Solution.
03-03-2016 05:50 AM
Hi,
Pl check the below points
1) Although Arduino programming is not officially supported by National Instruments, a third party toolkit exists, called "Labview interface for Arduino Toolkit". Following link provides procedure and softwares required.
https://decibel.ni.com/content/docs/DOC-15971
2) For VISA communication pl search for simple serial example VI in labview and try using this code.
3) For Communication the link below might help you from Arduino Form.
http://forum.arduino.cc/index.php?topic=252724.0
Regards
M.Kishan ,
-AE team ,NI India.
03-03-2016 10:15 AM
Hi Ahsial! While the above comment is correct that National Instruments does have a Labview Interface for Arduina (LIFA), there is a newer (shinier) toolkit called LINX! I've personally used Linx and the ease of use is glorious, highly recommend.
03-06-2016 06:47 AM
03-06-2016 07:43 AM
@Ahsial wrote:
While I am able to individually write or read at a time, I am unable to do it consecutively. I have used advanced read and write vi for the verification of my code but to no avail. The error reads " timeout before execution". Please let me know where I may be going wrong.
Please share your code. That is the only way we can help you debug your issue.
@Ahsial wrote:
Also is there a way to write code for hx711 using labVIEW
Change your string control to use Hex Display (right click on it). Then you can type in 0711. Wire up that string to your VISA Write.
03-06-2016 10:16 AM
i was trying to debug using these two codes
i have modified the advanced serial read and write (available online)
i testes the code using serial monitor and individually tried the labview code for write and read (by making minor changes in the arduino code).
I get a timeout error on running the vi
// follwoing is the arduino code using which i want to test the serial read and write for now
void serialEvent(){
while (Serial.available()){
char inChar=(char)Serial.read();
if (inChar =='a')
{Serial.println("B\n");
}
else if(inChar =='b')
{Serial.println("A\n");
}
}
03-06-2016 11:18 AM - edited 03-06-2016 11:19 AM
1. You do not need the "\n" on your println() commands. That command already adds an End Of Line character to the message.
2. You are getting the error because you have a loop around your Read. After the first read (well technically the second due to you adding an additional End Of Line character), there is nothing left in the port. Therefore you will get the timeout.
3. You really should look into using an Event Structure. This way you only do the write and read when you press the Write button and you can also use the event structure to make the loop stop. I also go so far as to close the port inside of the Stop->Value Change event.
03-07-2016 10:36 AM
thanks for the solution but there still might be a lttle problem somewhere. I am very new to the software so please bear with me here.
the code that i have written runs and doesnt stop on pressing the stop button. secondly on runny the vi , the value i write to the buffer doesnt affect the output on the read string at all. It just starts with the first output (on pressing the write button) and then switches to the second output( on pressing the write button again).
also if my arduino code were to change to this, would this vi still be effective?
void serialEvent(){
while (Serial.available()){
char inChar=(char)Serial.read();
if (inChar =='a')
{digitalWrite(LeftMotorForward, HIGH); // turn the Left Motor ie the conveyor ON
delay(10000);
digitalWrite(LeftMotorForward, LOW); // wait for 10 seconds
digitalWrite(RightMotorForward, HIGH);
delay(2000);
digitalWrite(RightMotorForward,LOW);
Serial.print(scale.getGram(), 1);
Serial.println(" g");
delay(200);
Serial.println("B");
}
else if(inChar =='b')
{Serial.println("A");
}
}
03-07-2016 12:48 PM
Ahsial wrote: the code that i have written runs and doesnt stop on pressing the stop button.
Make an event case for pressing the stop button. You really should have the stop button inside of its event case as well.
Ahsial wrote: the value i write to the buffer doesnt affect the output on the read string at all. It just starts with the first output (on pressing the write button) and then switches to the second output( on pressing the write button again).
What value did you have in the Write string control? If you had "ab" then I could see that happening.
03-08-2016 10:09 AM