Jump to content

SteveChandler

Members
  • Posts

    161
  • Joined

  • Last visited

  • Days Won

    3

Posts posted by SteveChandler

  1. Many of you have probably seen this, but for those of you who do not frequent the ni forums, I wrote an Apple][ emulator in LabVIEW.

    http://forums.ni.com...ary/m-p/2017254

    [Edit: I just stripped out the ROMs and posted the code on Sourceforge . https://sourceforge.net/projects/labviewapple2/ Feel free to criticize :) ]

    Contains sound

    <object width="560" height="315"><param name="movie" value="http://www.youtube.com/watch?v=l6rnUHIffOA?version=3&hl=en_US&rel=0"></param><param'>http://www.youtube.com/watch?v=l6rnUHIffOA?version=3&hl=en_US&rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/watch?v=l6rnUHIffOA?version=3&hl=en_US&rel=0" type="application/x-shockwave-flash" width="560" height="315" allowscriptaccess="always" allowfullscreen="true"></embed></object>

    • Like 2
  2. Thanks everybody. I think I have read about the command pattern in the past but never fully understood it. The parts that I did understand must have been stuck somewhere in back of my head because I ended up implementing it.

    The mini LVOOP Design Pattern KB is awesome! I have never seen those three patterns summed up so concisely like this.

    jgcode, I am working on something that might end up being cool if I am successful, but mostly I am working on improving my skills. If I ever do anything cool I will definitely share it.

  3. I think that I might take a different approach. The above obviously doesn't work.

    [Edit: I just saw jgcodes post New LVOOP Design Pattern KB. Is what I am doing below considered the Command Pattern?]

    What I am thinking is to separate the parent from the children. What used to be the parent in my example will not have any children. Instead I will create another "execution" class that Child A, Child B and Child C inherit from. They will have a dynamic exec.vi that takes the class that used to be the parent as their input. These dynamic VIs will modify the data in that class through it's accessors. I know what I am trying to do is not unique and there is probably a design pattern for this.

    post-17905-0-71318800-1328415462_thumb.p

    The dynamic VIs look like this

    post-17905-0-12095500-1328415509.png

    And just for reference here is the "Get Type" VI in the first image.

    post-17905-0-64309700-1328415787.png

  4. I have a class with some attributes. Based on an external integer input I want to execute an algorithm to manipulate the attributes. In the simple example the parent class has a string as it's private data. If the external input is a 0 I want a dynamic VI to store 'Child A' in the private data, 1 stores 'Child B', and 2 stores 'Child C'. The dynamic VIs take no inputs as shown.

    I got it working. I had the target and reference reversed! I attached the project. Is this the best way to accomplish this type of thing?

    post-17905-0-21589600-1328409644_thumb.p

    Children.zip

  5. Do you ever create a control or indicator on a front panel by copying an existing one rather than going to the palette? Maybe you set a bunch of properties on the original and want to copy from that so you don't have to set them again on another control.

    What is the very first thing you do after copying a new control? You edit the label to give it a new name. But after you make a copy the control is selected and not the label text. This idea is to select the text in the label after making a copy so that it is ready to start typing the new name. About ten percent of the time that I double click the text to select it all I end up turning off size to text. Grr..

  6. I have not had any serious problems since upgrading to LV2011. 2010 would crash on me when doing anything with a lot of classes.

    But what I did not realize is that if I use a class in a library then all classes get loaded into memory. I have some libraries with a lot of classes in them and now have to think about breaking things up somewhat. Again, it has not proven to be an issue yet but I want to be proactive. I have a development system with lots of horsepower and ram but the applications get deployed on systems with fewer resources. I use the factory pattern to load a preconfigured child class of an abstract parent because I didn't want to load all of the classes. But the parent and children are all in the same library so I guess that defeats the purpose. From a library standpoint it makes sense (to me) to include all those classes in the same library.

    Do you have any specific guidelines on what goes into a library as far as class hierarchies go?

    Is there any way this could change? Could it be possible to load pieces of a library without loading the rest? I ask because maybe it is something for the idea exchange. I don't want to post it yet because I don't know if it is a good idea or if it is even doable.

  7. See this thread on ni.com. Some good comments from Ben and a link to another thread. In those threads you can find links to easily contact your representatives online. A simple "I wish to express my sincere opposition to SOPA and PIPA" is all it takes. Beleive it or not but these politicians actually do not want to piss you off *. They actually want your vote.

    * although they are not doing a very good job of that with an 11% approval

  8. I really enjoyed the Advanced Architectures class in Austin. Nancy Hollenback is an excellent instructor if you are lucky enough to get her! However advanced is relative and it sounds like you wouldn't get as much out of this as I did.

    AQ, you should add the Actor Framework to one of the courses! Or maybe a separate class on just that. Maybe at least an excellent webcast like the LVOOP webcast...

  9. No, it doesn't give everyone the right to use it... but the person posting it is testifying that they do have the right to use it, and if that happens to not be true, it is the person posting who becomes the legal shield for everyone else -- in other words, it's the poster who is liable for all downstream damages, not the person who uses it.

    That actually makes a lot of sense and is what I thought but... ouch! I have only ever posted original example code, or modified something that I downloaded from there in order to try answering a question. But I don't think many people pay much attention to that.

  10. That contradicts what I've been told directly face-to-face by our lawyers. If you find a bug in a LV VI and post the fix, I will ask you to post it on ni.com because the lawyers tell me that you've granted us license to use anything you post there in any sort of repackaging we like without attribution or compensation -- my understanding is that that extends not just to NI, but to any other user on the forums who downloads your posted VI.

    But what happens with examples that someone creates and posts on ni.com in which they used some OpenG or GPL? Surely that doesn't grant everybody the right to do with it as they please. I think that the laws are suffering from the legal equivalent of code rot. I have heard of tax situations where you have only two choices to make, each of which violates a different regulation. I wish I could remember the details.

  11. If I understand correctly there is no ambiguity on copyright. The creator of the work automatically owns the copyright. The murkyness is in licensing. If I create an original work and post it to the NI forums I own the copyright and grant a perpetual license to NI that allows them to do what they like with my copyrighted work. My only compensation is usage of their site. That seems simple enough.

    Where it gets murky is when someone uploads something they didn't own the copyright to.

    What if I upload an example to the forums that uses an open source toolkit like OpenG? Surely it is OK to distribute OpenG code but NI cannot violate the BSD license. That example is too easy. What if it is licensed under something more restrictive that allows distribution such as the GPL?

    No wonder lawyers always win.

  12. My comments on this topic are here: http://forums.ni.com...c-p/927234#M577 After you disagree with me, you can add your kudos to the idea exchange entry. :-) Proud to be a unicorn!

    Can't kudo it because it was declined. I see it was pretty popular there and is also popular here on Lava.

    When I started using LabVIEW I used icons. Once I gained a lot of experience I switched to the more popular small terminals. Later still I switched back to icons influenced greatly by your arguments in the link you provided. :)

    There just are not enough controls on any of my diagrams to worry much about the space savings. As for straight wires I just gave up long ago. You can't wire the small terminals to the inputs of a multiply prim without bends for example so it makes no difference in that regard. It is impossible to code in LabVIEW without wire bends so I just quit worrying about it. I do try to limit the number of bends to two at most.

    Since it is just not possible to avoid wire bends with or without icons that argument doesn't go very far. The only things I know of that you can wire a vertically compressed stack of small control terminals to without wire bends is another stack of indicators or bundle/unbundle by name. You can't wire them straight to adjacent subVI terminals except in one ironic situation. If you deselect view subVI as icon and drag down the nodes so it looks like a bundle by name or more accurately like an express VI. How many people knew you have the option NOT to view a VI as an icon? Does anyone do that? :lol:

    post-17905-0-96966700-1319755009.png

    As for quickly identifying if it is a control or a VI, well they just look like controls and I can immediately tell by where they are located. You just get used to a particular style after a while I guess and anything else just looks weird and wrong.

    There are two situations where I regularly show small terminals. If there is a reason I need to put the terminal in a loop or something or if it is not on the connector pane then I do not show it as an icon. I don't know where I picked that up and just realized that's what I do.

    • Like 1
  13. I have two devices. One has an RS232 interface and the other has an Ethernet interface. The API is identical. They accept the same commands and return the same responses. The only difference is the hardware interface.

    I have a parent class with a dynamic Query.vi method which is overridden by a serial child class and an Ethernet child class. The parent has a bunch of static methods that send commands to the query method, parse the results and return the data. Easy stuff.

    However I can not figure out how to create a dynamic Initialize method since one takes a VISA resource name and baud rate and the other takes an IP address and Ethernet port. Different connector panes. All I can think of is to put both the serial and Ethernet configuration parameters on the connector pane but that seems sick and wrong.

    The way I am doing things works. I have a static initialize method for each child. But that does not allow me to only load one child class into memory. It's not a big deal and is more of a curiosity.

  14. I have a question. What is the best way to handle multiple instances of a slave? Specifically I want to write a slave loop that does communications with an RS232 device but I have at least two of these devices. What I am not clear on is how best to handle slave responses in my mediator loop. The slaves will send messages on the output queue but how do I differentiate between the slaves so I know who (which instance) sent what?

    One thing I was thinking is to maybe give the slave loop a name property. The name would be set when the slave is created and become part of the response message name. Cases in my mediator would be something like:

    • SerialDevice:DeviceA:Response
    • SerialDevice:DeviceA:Error
    • SerialDevice:DeviceB:Response
    • SerialDevice:DeviceB:Error

×
×
  • Create New...

Important Information

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