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.
09-05-2018 12:50 AM
Hello.
I've been working on a project where I deploy multiple nodes w/ Arduino and XBee. The nodes sends a string to the base station every 8 seconds. I am using the VISA function in LabVIEW. If the sent string is matched, a boolean indicator will turn on. This shows that the node is still connected on the network. However, I dont know how to implement such troubleshooting where if LabVIEW hasn't detect the string of the node after 8 seconds, it will automatically prompt the user to check the specific node.
I really need some help in this situation. Thank you so much!
Solved! Go to Solution.
09-05-2018 01:17 AM
Do you mean that if LabVIEW didn't get string sent from node within 8sec, had LabVIEW fire an Error?
If so, you can set "Timeout" property on VISA.
VISA Read or Write Timeout Error -1073807339
09-05-2018 04:21 AM
Most probably.
There will be 16 nodes to be deployed. Each node sends a string of 1A0/1 ---> 1H0/1 and 2A0/1--->2H0/1. The string signifies the Zone address, Node address, and alarm state (0 for no alarm/connectivity check and viceversa).
LabVIEW acts as the base station. It receives all the strings asynchronously. Based on the image below, the (SD) is a subvi that matches the string received from the different nodes. The 1A1 boolean is for 1A1 string and below is for 1A0 and it goes on.
The nodes are programmed to send 1A0 every 8 seconds therefore the boolean turns on every 8 seconds depending on the string the comes first. However, my problem is what if a node didn't send the string or LabVIEW haven't received the expected string to the corresponding node after 8 sec. LabVIEW should notify the user that there might be a problem to the node that was unable to send the string.
09-05-2018 06:17 AM
1. DO NOT USE THE ABORT BUTTON. Add a way to properly shut down your application, including closing your VISA Session.
2. DO NOT USE THE BYTES AT PORT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! You expect 3 bytes in a message. So just always read 3 bytes or, if your device is sending one, use the termination character to stop the read (try to read more bytes than you ever expect in a message and let the VISA Read stop reading when it reads the termination character).
3. You might want to have a look at the Elaspsed Time Express VI. It can add the delay time you need when when to turn off the LEDs.
4. You should also consider moving your serial interface into a parallel loop and use a Queue or User Event to send the data on to your main loop.
09-05-2018 08:17 PM
1. I have already added VISA close with Simple error handler.
2. How do you propose on reading the 3 bytes or using the termination character?
3. Yes, I'm in the process of implementing the Elapsed Time Express VI.
4. If I'll use the Queue with a parallel loop, will it make the system more simpler? I haven't use the Queue function yet.
09-06-2018 06:05 AM
@PJason wrote:
2. How do you propose on reading the 3 bytes or using the termination character?
Just wire a constant to the VISA Read. If there is no termination character, just wire a 3 to the number of bytes to read. If there is a termination character, then use a number larger than any message you expect to read.
@PJason wrote:
4. If I'll use the Queue with a parallel loop, will it make the system more simpler? I haven't use the Queue function yet.
Yes, things will be simpler because of modularity. It is a way of breaking down the problem into smaller problems that are much simpler to solve. You might want to read up on the Producer/Consumer.
09-11-2018 10:23 PM
Just to avoid Queuing, what if I store the data in a 1D array then I have a process that searches the current element from the newly stored data. If it can't locate from the newly stored data then there will another process.
Would that work?
09-12-2018 06:37 AM
@PJason wrote:
Just to avoid Queuing, what if I store the data in a 1D array then I have a process that searches the current element from the newly stored data. If it can't locate from the newly stored data then there will another process.
Would that work?
What you are describing sounds a lot like a queue. Seriously, dig through the help files and examples. You will want to be using a Queue.