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-31-2015 12:35 PM
Hi there, new labview user here. Working on a project and having some issues getting it off the ground.
First question, in the VI below, I'm trying to have a time delay between each input but when I take a look at the Delay control, I don't see how it's supposed to set up. Does the singal flow through the timer.
Question 2, I would like to write to these ports via a xcel file but not certain how to do so..
Thanks for your help in advance..
Solved! Go to Solution.
03-31-2015 01:22 PM - edited 03-31-2015 01:23 PM
I would use a FOR loop to sequence through the values to write. You just need an array of values to write.
Is your file a xlsx file? Could you make it a text file that is written by Excel? If so, then you can just use Read Spreadsheet File. I would recommend having a column for the value and a second colum for your delay.
03-31-2015 01:33 PM
That looks great. The file is a xlsx, I supposed I could change it to a text. If I were to add another column for a differnt port, I would just have another line extending from the spreedsheet?
03-31-2015 01:35 PM
@tonyc_fla wrote:
That looks great. The file is a xlsx, I supposed I could change it to a text. If I were to add another column for a differnt port, I would just have another line extending from the spreedsheet?
Sounds about right
04-02-2015 10:20 AM
Ok, I built what you had and included a the text file I'm using. Seems to be a error though as the timer doesn't seem to be working.
04-02-2015 10:34 AM
I'm assuming that there is a issue with the the txt file using Hex and the block digram using integer.
04-02-2015 11:07 AM - edited 04-02-2015 11:08 AM
Yeah, those values writtne in hex will not translate well with the Read From Spreadsheet File when you also have decimal numbers for the delay. That's fine. We just need to change a few things. Start with using the Read Text File function. Right-click on it and select to read lines (very useful trick there). Set the number of lines to read to -1. That will make it read all of the lines. Now we just use a Scan From String to parse our data. %x will decode the hex values and %d will parse the decimal. So we want "%x\t%d" for our format string (the "\t" is for the tab between the colums).
Now for your text file...You do realize the Wait VI here is defined in seconds. So your first data point will sit there for ~2.8 HOURS. Was that supposed to be 10 seconds?
04-02-2015 11:42 AM
Ok, I built it and modified my text file ( Had random stuff in there for testing) and now getting a error: LabVIEW: Scan failed. The input string does not contain data in the expected format.
I noticed you set the first input to unassined long, I'm not sure how to do this without creating a constant and then changing the representation like I did for the time variable.
Thanks again for the help.
04-02-2015 01:02 PM - edited 04-02-2015 01:07 PM
So when testing it seems to read correctly but the 'read from string' isn't parsing the data correctly.
It's not even sending the right data to the delay.
04-02-2015 02:06 PM
It looks like Excel is adding extra bytes in there for who knows what reason. Save your spreadsheet as a CSV and they seem to go away. Of course, you will need to change the format string to "%x,%d" when you do that.