12-18-2009 02:24 PM
Hello,
I have a hardware set up for measuring the temperature of 40 thermocouples using 5 modules to which are wired 8 thermocouples each. Each module is given a number (1-5) and each channel on each modules is numbered (0-7). To obtain the current temperature of a particular channel the command specifies first the module and then the channel on that module, preceded by the # sign. For example the code to measure the temperature of channel 1 on module 01 is #011. The response from the modules is a temperature in string format (example: +028.65).
I am quite new to Labview, but I have written a Labview VI that uses two 'for' loops within a 'case' structure and all within a 'while' loop to cycle through the modules (outer 'for' loop) and the channels (inner 'for' loop) every 20 seconds and then write the response data to a file. I am currently trying to upgrade this program so that I can have a real-time chart of the temperature data.
I am running into several issues. The first is that because the commands to the modules are driven sequentially by the two 'for' loops, the response is a series of single hexadecimal strings rather 40 individual numbers collected at a single time point. I am learning that this makes plotting them to a chart a bit more challenging.
I am also running into issues because the response data has to passed out of both 'for' loops (so that all modules and all channels are sampled) and by passing it out of both loops the data is reformated into a 2D array, which I cannot connect as an input to the waveform chart.
I've attached the VI (ThermocoupleReadings.vi) with the two subVIs (Send Command.vi and Get Analog Data.vi) and given my limited experience with Labview I would appreciate any feedback on how to plot the response data in a real-time waveform chart given I have these two 'for' loops.
Thank you so much for your help,
Nate
12-18-2009 10:30 PM - edited 12-18-2009 10:30 PM
Use Reshape array to turn your 2-D array into a 1-D array. You will need to wire in a constant of 40 since you will have 40 elements in your new array. Convert the 1-D array to a cluster with Array to Cluster. Right click on that function and set the size of the array to 40. Wire that cluster to the waveform chart. Now each of your 40 values you get after the double For Loops will run will append their new data to the 40 lines on your waveform chart.