Jump to content

pkeny

Members
  • Content Count

    12
  • Joined

  • Last visited

Community Reputation

0

About pkeny

  • Rank
    Active

LabVIEW Information

  • Version
    LabVIEW 2013
  • Since
    2014
  1. Hello, I have made an attempt to get this. Based on my text file, column 0 is pin number, column 4 is status. I have it so column 1 (status) is working. The next parts are not, which is an iteration. I tried to do this in the while loop, but I cannot seem to figure it out. Anyways, what I want in the while loop is, based on my text file is: (Start at column 2) 1)Wait 2 seconds, turn boolean array index 0 off 2)wait 3 seconds, turn boolean array index 1 off. 3)wait 2 seconds, turn boolean array index 2 on. 4) wait 4 seconds, turn boolean array index 3 on. 5)wait 4 seconds, turn boolean array index 0 on. 6) wait 3 seconds, turn boolean array index 1 on. 7)Wait 2 seconds, turn boolean array index 2 off. 8) Wait 2 seconds, turn boolean array index 3 off. 9) repeat steps 1-8 if there are more columns...in this case there aren't. text test.txt
  2. Very good and efficient code. Close to what I want. Your code reads it row by row. I want to read it column by column. So, using my attached text file as an example, your code will go row by row. So, it will first turn on pin 0, then wait 1ms then turn it off then wait 1ms and then turn it on, and then turn pin 1 on...and so on... What I want is for it to read column by column. So what I want is that it will first perform: pin 0 on, pin 1 on, pin 2 off, pin 3 on....to pin 10.... and then it will wait 1 ms and turn pin 0 off, wait 1 ms turn pin 1 off, wait 1 ms turn pin 2 on....all the way to pin 10, Then wait 1 ms turn pin 0 on, wait 1 ms turn pin 1 on, wait 1 ms turn pin 2 on....all the way to pin 10 and then stop. So, in general, I want it to read the whole second column (status) first, and then read the next two columns, row by row: wait, status, (next line), wait, status, (next line)...until pin 10, and then go on to the next set two columns: wait, status, (next line), wait, status....etc. I know this is quite confusing and obscure haha. So, I have uploaded an excel file with an example, with the order of operation. I think that will really clarify everything and explains everything. text test.txt Book1.xls
  3. I apologize if I have not been clear. I do not want something complex, but I understand that I might need to have something complex. Anyways, it really does not matter whether I have it sequentially, or simultaneously, but since I already have it so the delay happens sequentially it is okay for such. So, what I want is: 1. Pin > 2. Status > 3, Wait > 4. Iterate through step 2 and step 3 until no more columns left in text file. So, for step 4, the iteration should look like: Status>Wait>Status>Wait>status>wait>status>wait>status>end. The method I think to make something like that is a for loop with shift registers, however, I cannot wrap my head around for loops and shift registers in labVIEW for some reason. I will try something later in the afternoon and post it here. Maybe from there I can get some more help. Actually, just explaining it so I have a clear vision in my head helps out. Hopefully I have been clear. I really appreciate all the help. Thank you
  4. Thank you for that, Also, I am just using the stop command for now as a placebo to remind me to fill in that section later. Now, I have another question, how can I accomplish my task programmably versus me hardcoding it in. For an example, currently on the text document one can have a maximum of one delay, so labVIEW will go through pins status once, then delay, then go through the pins status again. However, can someone help me with the logic to create a way to do that programmably so instead I can go through the pins status 100 times with a delay in between?
  5. Hey all, I am trying to create a fairly large program. What I want to do is for someone to upload a text file, customized so I can create statements for it, and then labVIEW will read the the text file and perform actions. Specifically, the text will contain pin numbers, on/off status, wait delay, and another on/off status. The pin numbers correspond to a Boolean indicator array. The on/off status tell the Boolean indicator array to turn on/off. The wait delay tells the program to wait how long before changing the indicator array value again, and the second on/off status turns the Boolean array on/off after the wait delay. I cannot get the part where I want the Boolean array to change status after the wait delay. I am thinking the method of doing this would be a local variable, or a property value node. But, when I tried it, it would not even let the original status to turn on/off the indicator Boolean array, let alone changing the status after the wait delay. I have attached my code and text file (tab delimited) for another method of explanation. Altenbach wrote a big portion of the code for educational purposes If you delete the local variable, you will notice that the boolean array changes based on the first text column, versus it being constantly Gray if you have the local variable. ExcelTest.txt Text Boolean.vi
  6. Thank you Infinite, I could not figure out how to setup my event structure so that it will execute when my data array changes, and it will still set the local variable to false. However, I found a workaround using a case structure instead of an event structure. The case structure will occur when the stop button is pressed and then it will set the local variable to false. Now, I have another question, hopefully this is the last one. When I open my program my boolean array is not initialized on the front panel. It is grayed out. So, the program will have an error since my task contains 8 lines, and when the boolean array is grayed out is has zero lines. How can I make it so when the VI file is opened, it will have all eight, false initialized boolean array, versus a grayed out boolean array. I have attached a picture of my front panel when I open the file.
  7. To me, it seems that the logic is correct. When the stop button is pressed it returns a value of true. So I send it through a not gate, which will make it false. Then use that false value to initialize an array containing all false values with the same size as the number of elements in the switch array. Next, I send it to the event structure which will execute if the stop value changes. So when the stop value changes, it will give a false value to the boolean switch array's local variable, which should set them all to false. I cannot understand why it would set them to true. And especially I cannot understands why it would set them to true if I change the timeout constant to 5ms, versus 1ms. What do I seem to be missing in my thinking? But, regarding the picture with the conditional event logic. Can someone explain to me the shift register's role in that? I somewhat understand how shift registers work but I am unable to figure out how to incorporate them into a program. I know that they are used to pass data along a for loop, and they can store previous iteration values.
  8. Ah, thank you for clarifying that. I believe I have made a much more efficient daq VI. However, I have a problem that I cannot figure out. In this VI, I have made a task that includes 8 lines. Then I have a boolean array of push buttons which will toggle the write data on/off. I also have a stop button that will end the while loop and stop writing. However, I want to make it so that the when the user presses the stop button, it will reset all the boolean switches to off (false). So, in order to do that I made an event structure that contains a local variable for the boolean switches. However, for some reason when the timeout is at 5ms and I press the stop button it switches all the boolean switches to on (true). But, if I make the timeout at 1ms and I press the stop button it switches all the boolean switches to off (false), which is what I want. Can someone explain to me why it is doing this, and maybe what would be a better way in accomplishing my task? Thanks Digital Outs.vi
  9. Thank you guys for your answers, After moving my stop, clear, and error daq blocks to outside the loop, the program now is able to switch on and off in about a second. I have been told using daq assistant is a very bad idea from other people. They tell me they always get errors and using daq accomplishes the same task as using daq assistant but more efficiently (I'm probably not using daq correctly so using daq assistant might be better). So, anyways I really want to learn efficient use of daq.
  10. That example can only write to one line at a time since the channel line entering through that while loop only contains one line (At least that is what I think it does). However, I think the reason why my code is inefficient is because I am stopping and clearing every time in my while loop. And my stop button logic has way to many not gates I could probably combine it into one not gate and send that out to multiple writes. Is that something that would fix my inefficiency? Or could it be that I have a fatal flaw in my program that I am not realizing through this example and my program.
  11. Hello, I have created a vi that controls multiple writes (individually) by a switch. I have it so one individual switch controls one individual write (And is linked to individual clear, stop, error daqmx blocks). I do not think this is efficient as it takes about 4-6 seconds for the switch to actually write (True or False). So, I was wondering if someone could help me make my code more efficient so it would run a bit faster. Thank you Digital Outs fine.vi
  12. Hello, I am having trouble on learning what to do after you input a file into labVIEW. I cannot seem to find help on this topics. I have seen many videos and tutorials on how to read and write excel/text (.csv) files. But, I am not able to do anything after importing an text/excel file into labVIEW. So, I was wondering if someone had a simple VI that they could share. In the end, I want to do some automation so it will read a number and a status from excel. And then that number and status will either turn on or off a switch which controls something else. Anyways, I would greatly appreciate if someone could share a VI as an example of how to manipulate the data to control something after you import a text/excel file into labVIEW.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.