06-15-2014 06:30 PM
06-15-2014 06:40 PM
First, unless you absolutely need the speed, add a synchronization byte or bytes so that you know when a message starts or ends.
I just checked. The PIC 18F4553 has a 12-bit A/D converter. So you can use the 4 extra bits to designate the X and Y channels and which is the high byte and which is the low byte.
Doing this will help you avoid any confusion if the VISA Read ever gets out of synchronization.
Next, what have you tried? What parts are giving you trouble? Have you looked at the serial communications examples? (Although they may not be the most applicable examples for what you are doing, they can still be a good starting place.
If you are completely new to LabVIEW, work through the on-line tutorials to get started. You will save far more time than the tutorials take by what you learn.
Lynn
06-15-2014 06:52 PM
thank you for the reply
So far, all the hard ware and VISA write are working properly. the only problem labview software for data receiving, for example, i want to set a four steps loop in which i can put high byte and low byte of x in a data array and put high byte and low byte of y in another data array, once i am out side of the loop, i can treat data and put x and y in a data array.
i checked all the labview examples, i haven't find an appropriate one.
please give me some hints, if possible show me an example.
06-15-2014 07:30 PM
Here is a very simple example. The Data from PIC is a byte array. This would be replaced by the VISA Read and the conversion from string to numeric. It appears that you already know how to do that. The for loop would probably be replaced with a while loop and a stop button so that you could run indefinitely.
Index Array can be expanded to get all four elements at once. The Join Numbers primitives (from the Numeric >> Data Manipulation palette) takes care of the conversion from bytes to a number. Autoindexing creates the arrays.
Lynn
06-15-2014 08:09 PM
Thank you.
but, how to save and display data collected while the data receiving still keeps going
06-15-2014 08:35 PM
The best way is to use a Producer/Consumer design pattern or template. This moves the display and saving to a parallel loop.
You can build the array in a shift register and display it inside the VISA Read loop but this can lead to memory allocation problems if not handled carefully. Saving to a TDMS file is optimized for speed.
Lynn