08-13-2014 05:07 AM
Ranjeet_Singh wrote:
For example
@*AB$*AC$*AA$*AD$#
This will read the analog value of A0,A1,A2 and A3 and send it back. I cant post my arduino code because its official.
Since we are in the LIFA forums, the following suggestion will be in the context of LIFA, not LINX (but it should be similar if not the same).
If you have an encapsulated function that accepts a string to do what you want (and doesn't take that long to execute), you could sent the string as a byte array where the byte array is your data. You would then need to build this into a string on the Arduino and finally pass that string to your function. All of this requires a custom LIFA function to be created which requires both a modification in the LIFA firmware and a new LIFA-based subVI.
But, because the string you have is 18 characters long, you will need to have the "Bytes per packet" set to at least 20. Another caveat here is that you would need to make sure that you know the number of bytes that will be returned to LabVIEW prior to calling the function so that LIFA knows how many bytes to expect.
Ranjeet_Singh wrote:
Just tell me if I am using MEGA 2560 and LV2011 then in WIN XP SP3 it is failing after few communication but same code is working fine at WIN7. What could be the issue. Next time I need to reconnect the arduino to make it work.
In my testing I send 30-40 command to arduino. Sometime in SP3 for 2-3 testing works fine but after sometime it fails
Since that is not related to the topic in this discussion, it would be best to create a new discussion about that topic. I've used the Arduino Mega 2560 on Windows XP SP3 with LabVIEW 2011 (that was my first Arduino project) and I never had any issues with communication.
08-13-2014 05:16 AM
Then why it is failing? Any issue with my current VI?
08-13-2014 05:40 AM
Since the discussion is more appropriate over in the other forum, I have replied there.
08-13-2014 01:09 PM
I am confused about how you are using Arduino and LINX. In particular do you have an Arduino sketch you created and are you trying to use LINX to send commands to your sketch? This will not work with the standard version of LINX. The standard version of LINX installs a set of functions on an Arduino board and the LINX VIs will only work with these functions. If you were to install LINX on an Arduino board and then install your Arduino sketch the Arduino sketch installation over writes the previous LINX installation. This means LINX can no longer communicate with the Arduino board.
Hence you have two choices.
One. Only use the functions provide by LINX to control and collect data from your experiment.
Two. Create a custom version of the LINX firmware that meets your requirements.
hrh1818
08-13-2014 10:01 PM
Dont confuse, what I was doing is intiallly using normal VISA to communicate with arduino but after few run in between arduino stops communicating and I need to reconnect the arduino to make it work.
I though of using LINX for communication so here I am .
08-14-2014 12:17 AM
He is not and cannot use LIFA or LINX in his application.
08-14-2014 11:38 AM
Ranjeet,
I am coming in late into this but my god this VI is in serious need of sub VIs. Also it does not seem you are using 'clean up' button- sub VIs and clean up should be constantly practiced rules.
By no measure I would say I could understand your VI
Note one important issue with sequences is that nothing gets updated until after the sequence is exited
I am particularly interested fate of this VI since I would like to learn string serial interaction with Arduino boards
I think I have most of the hardware it needs. What do I need to actually run this VI?
Regards
Barddy
08-14-2014 02:32 PM
Just as an FYI barddya, there is a full discussion about his Testing.vi over in the LabVIEW forums. It would probably be best for everybody to discuss it there.
http://forums.ni.com/t5/LabVIEW/2-COM-port-swithching-at-once/td-p/2934152/page/8