04-16-2016 01:49 PM
I'm trying to build a VI in labVIEW that will feed a decimal value based on a binary input into a case structure. The case structure will output a string value depending on the decimal input. The problem I am having is writing the string value to a text file that will continue to write while the Vi is continously running.
Solved! Go to Solution.
04-16-2016 02:45 PM
Here are some suggestions (you'll learn a lot more if you try to do these yourself, rather than my providing you a ready-made "solution").
I haven't actually tried running your code, but don't see anything terribly wrong with it. Try making some of the changes I've suggested (which should allow you to dramatically shrink the size of your VI). Pay particular attention to the "Speed" question. If you need to re-post your "improved" VI (and thanks for posting this one), you might describe a little better "the problem I am having" -- what does it do, or what doesn't it do?
Bob Schor
04-16-2016 03:23 PM - edited 04-16-2016 03:25 PM
Thanks for the quick response!
The sensors are to represent an actual photo-interuptor sensor which will be connected through a myRio. Since I dont have the actual physical sensor I was trying to design digital representation for the each of the interuptors. The grand scheme of the project is to develop a VI that will read an 8-hole punch tape and decode the message into a text file. The guide sensor determines if the tape being fed is off track. That was the only reason I was trying to avoid the array was so I could swap the sensors booleans indicators out with digital outputs from the myRio.
The main issue with my VI the way it is now it will only output whichever case is currently active as opposed to writing out any changes while running.
David Lambert
04-16-2016 03:52 PM
@FNG_1683 wrote:Thanks for the quick response!
The sensors are to represent an actual photo-interuptor sensor which will be connected through a myRio. Since I dont have the actual physical sensor I was trying to design digital representation for the each of the interuptors. The grand scheme of the project is to develop a VI that will read an 8-hole punch tape and decode the message into a text file. The guide sensor determines if the tape being fed is off track. That was the only reason I was trying to avoid the array was so I could swap the sensors booleans indicators out with digital outputs from the myRio.
Are there really 9 sensors, 8 for the 8 holes in the tape and a nineth for a "guide sensor"? Or are you deriving the "guide sensor" reading from 8 photo-interruptors?
In any case, I hope you see the virtue of creating an 8-bit Boolean control into which you wire 8 1-bit sensors (using the Array-to-Number function I mentioned). If you have 8 digital outputs from your myRIO, and an 8-bit Boolean Array, you simply use Build Array, wire the 8 digital outputs into 8 elements of Build Array (which gives you ... let's see ... an 8-element Boolean Array).
The main issue with my VI the way it is now it will only output whichever case is currently active as opposed to writing out any changes while running.
David, I'm sorry to say I don't have any idea what you mean by that last sentence. Maybe you could write a narrative (in English, no code required) of what you want this thing to do. For example, it could be something like "Every second, tell me the value of all 8 Boolean lines", or "Tell me the value of all 8 Boolean lines right now, and update this whenever any one or more of them changes, also telling me how much time has elapsed since the last change, or since I started recording".
Bob Schor
04-16-2016 07:09 PM - edited 04-16-2016 07:24 PM
There will be 9 sensors according to the instructor. 8 to read the tape message and one for the guide/track sensor.
I will play around with some of the array suggestion you've given. I'm somewhat of a newb when it comes to the array functions but i'm sure with the help dialog boxes I can piece it together.
The goal of the VI is to read the punch tape via the sensors and write the results to a text file. I will definetly throw a wait timer in there too slow down the loop a little.
I've attached a file that describes the layout of the punch tape.
David Lambert
I
04-16-2016 08:37 PM
OMG! You really meant Punch Tape! This is a great project -- you definitely should use my 8-bit "punch reader" with a one-bit "tape sensor". I've actually used Paper Tape, so I know the "trick" that makes decoding it a piece of cake. I'm trying to remember the speed at which tape chattered through the reader -- the mechanical readers ("teletype") were about 10 characters per second, but the "fast" ones might have been 100 characters per second.
You've got most of what you need for this Project. Take a look at the picture you sent me, see if you find any interesting patterns in it. See if you can "find a rule".
Bob Schor
04-16-2016 10:17 PM
No luck with the rule and sadly I dont think we will get to have some hands on with an actual punch tape reader. The way my professor keeps talking makes it sound like this is mostly theory, but I was excited to build a circuit that would mimic the reader.
For the issue with the text output I was forgetting to put in a set position after the "open file", so each output was just overriding the last.
Check out the latest VI.
Also, thanks again for your help with this.
04-17-2016 08:57 AM
After the mid 1970's, you would be hard pressed to find a paper tape reader ... I see that you ignored most of my suggestions, probably just as well.
Bob Schor
04-17-2016 10:16 AM
@Bob_Schor wrote:After the mid 1970's, you would be hard pressed to find a paper tape reader
I recently (4-5 years ago) worked with a paper tape type writer. The tape was used by a special tape reader for putting encrypted codes into an RF reciever that could blow up a rocket if it went off course. The lab manager was trying to throw it away one day (possibly the only time he ever tried to throw anything away). I had to step up to keep it. Since I was the one trying to get rid of old junk, you could say our roles were reversed.
04-17-2016 11:57 AM
I doubt we would have used a real but it would of been nice to get to build a circuit that shared it's functionality.
Thanks again for all your help!
Was unaware of the kudos thing, pretty new to the forums.