Jump to content

SteveChandler

Members
  • Posts

    161
  • Joined

  • Last visited

  • Days Won

    3

Posts posted by SteveChandler

  1. Cool. Thanks for volunteering. I look forward to seeing what you come up with. :lol:

    I actually wouldn't mind helping on some of it. There are a couple of problems though. One is time. The other is that I don't know if my company would be ok with it even on my own time since they own the software. But I will definitely check into it. But that leaves the first problem.

  2. I think that the day will come when snippets can include subvis. Maybe someone will create a browser plugin that lets you navigate the code. I hereby promise in a public forum that I will buy a beer for the first guy who makes a browser plugin that lets me edit the code. Heck I will buy you a SIX PACK if you do that. :yes:

  3. However, I absolutely agree with JG. Anyone claiming to be an architect--regardless of certification--ought to be familiar with xcontrols.

    Well I am familiar with them for what it's worth ;)

    But I think I will probably just dig in and create one for fun.

  4. Thanks for that positive story.

    Here I would disagree. There is a very important difference between data-flow languages and all other languages.

    At first, this is a bit hidden in the compiler (there are some good explanations in wikipedia, and of course some pretty detailed issues posted mainly by AQ):

    In a text based language I can write

    i=i+1

    where the data before and after this operation is stored at the same memory location.

    In LV you can't. Each wire (upstream and downstream of the +1 prim) is pointing to a unique memory location.

    This data flow paradigm has sever consquences:

    • Parallelism is nativ :wub:
    • We have a duality of by-val (native) and by-ref, while text based compilers are limited to pointer :throwpc:/by-ref.

    Felix

    I think the point is about the representation of the bits in a meaningful way to us humans. I completely agree that the difference between dataflow and everything else is huge! But dataflow and parallelism can be unintuitively implemented in any text based language. They are obviously much more difficult to see at a glance.

    But I think the philosophical principle of Linguistic Relativity applied to programming languages is more interesting than what happens after the compiler gets done with the code.

  5. If you feel like giving some ribbing positive feedback you can quote Alfred Whitehead on the importance of a good notation.

    By relieving the brain of all unnecessary work, a good notation sets it free to concentrate on more advanced problems, and in effect increases the mental power of the race.

    He could have been writing about LabVIEW instead of mathematics.

    Of course any programming language is a graphical language at least to the extent that it uses math. The meaning of the four glyphs "40+2" is the same in English, Chinese, Russian and French.

    LabVIEW just takes this to a higher level. When I am programming in some text based language I often wonder how much more difficult (or at least inconvenient) it must be for someone who does not speak English to use that programming language

  6. If you create a Strings[] property node from your combo box just right click on the input and create constant. Sorry but I forgot to mention that clearing the strings does not clear what is displayed so you also have to write an empty string to the Value property. To keep the write from happening at the same time as some other code you have to enforce dataflow with the error wire.

    post-17905-0-61955400-1302359448_thumb.p

  7. yes, I know that and problem is even i have to wait 10 min first time to see the results. Can i put any button in the timeout case like you can see immediatly or otherwise for every 10 minuts.

    An event case can handle multiple events. right click to edit events handled by this case. At the bottom left there is a blue + to add additional events. Another way to do it with two event cases if you are using the producer consumer is to simply have both cases send the same message to the consumer.

  8. :lightbulb:Seems like a perfect item for the Idea Exchange.

    Jason

    I don't see how that would work. If it is not named you have no way of specifying the element you want to unbundle. But it will work for clusters that are partially anonymous.

    post-17905-0-80378900-1302227782_thumb.p

    Or you could do this

    post-17905-0-88015600-1302228789_thumb.p

    This is not specific to the inplace element structure. There is no way to unbundle a single element of a cluster unless it has a name anywhere in LabVIEW.

  9. You do a multiple choice for a CLA recert. There is an example exam on the web.

    Yea I knew about that. But John made it sound like there were some new options like giving presentations at NI week. If that was some kind of irony it went over my head. I think what he was getting at is how to stay sharp and preparing presentations for NI week is a good way to do that. I'm pretty slow but I think I understand wat he was saying now :rolleyes:

  10. Looking forward to the new options for maintaining my CLA. May have to do an NI Week presentation every other year... tongue.gif

    Congrats!

    What are the new options for maintaining your CLA? I can't seem to find anything about that.

    I am going to give the CLA a try. Not that I think I have much of a chance but I have a couple months left on my training membership so I might as well at least see what it is like.

  11. Steve, I just once look your code and affried to handle that. I am just learning it now. Have you used any state machine in your code. Furthurmore, if i have any doubts then i will post here.

    What is enumerated typedef constant. I don't have any idea about these terms. can you explaine me.

    Thank you.

    I did not use a state machine anywhere.

    An "enumerated typedef constant" . First an enum is a collection of integers that have strings associated with their values. You can find the enum control under Ring & Enum. You right click and select edit items.

    post-17905-0-27430500-1302016804_thumb.p

    You can wire that to a case structure and switch on the name instead of remembering the number.

    post-17905-0-59343200-1302017097_thumb.p

    You can right click the case structure and add a case for every value. Now you will have a case for each element of the enum. One reason you would want to use a number instead of just a string (an enum is a number) is that a number takes much less memory. But more importantly you can also ensure that only values in the list can be used. Somebody could not try to add a "Grape" case because it does not exist in the enum.

    If you right click on the enum terminal and create a constant you have an enum constant. Now for the typedef part.

    You can create your own custom controls in LabVIEW. That is what the .ctl files in the project are. You can make a custom control from the enum by right clicking on the control, selecting advanced, then customize. When you save the ctl file you have three options: "Control", "Type Def" and "Strict Type Def". If you save it as a control then you can easily place the enum on the front panel again by just dragging it there. Now you don't have to add all those items if you want to use this in twenty places in different subvis. The other option would be to copy and paste the enum.

    But what happens if you have a vi that has ten of your enum constants and you decide you want to add grape? You have to right click on each constant and edit the items. Not only that but you have to make sure that the numbers match the strings in each instance. Remember that the datatype is not a string but a number. The string is associated with the number. That means you can do any numeric operations on the enum. In the example above banana+orange=pear because banana is associated with the value 1, orange is associated with 2 and pear is associated with 3. If you do not keep all the constants consistent and have one instance where the value 1 is associated with banana and in another the value 1 is associated with pear you will have problems.

    That is where the typedef comes in. When you save your custom enumerated control as a typedef, then anywhere it is used, either as a control, indicator or constant, they will all be updated when you edit the control. A strict typedef is the same thing as a typedef but it makes sure that all properties get updated when you edit the strict typedef. The project I attached uses strict typedef clusters for your front panel. If you want to change the color just open the .ctl file and edit it. You can also add to the clusters and the cluster constants in your code will be updated. That means that unbundle by name will not break. The error terminal is a built in typedef cluster.

    The comm.vi is an action engine that uses an enumerated typedef (Comm Command.ctl) for the command. It has the values "initialize", "Write and Read" and "Close". If you wanted to add another command such as "Reset" you would add that by opening the .ctl file, right click and edit items, insert the new command and save the file. The action engine will be broken. If you click on the run arrow you will see that this is because the case structure does not have a case for the new value and there is not a default case. You can right click on the case structure and select "add case for every value"

  12. I have one doubt on this model that what is the main difference between before program and this model. Where this program is good compared to previous. Now, i am just learning how this is working. I want to know where the difference is?

    Do you mean the difference between your program and the one I posted or the difference between what gcocde posted and the one I posted?

    The difference between yours and mine is that in mine the communications are all done outside of the user event structure. You mentioned that your front panel would freeze. That will happen if the VISA read is taking a long time in your event structure.

    The difference between mine and the one that gcode posted is that his uses events for error signaling.

    I know the producer/consumer architecture seems more complex than it needs to be but there are significant advantages which is why others have been suggesting this to you. But it really is not that complex once you get to know it.

    This link has some good information for you.

  13. thank you so much i am using LB8.5 and eagerly waiting for starting code.

    This will get you started. It does not have a user event to keep it simple. I integrated some of your code but you will have to add the missing functions. If you study this code and understand how it works you should have no trouble doing the rest. The Comm.vi is a simple action engine.

    Also study gcode's project template. You will probably want to do some better error handling especially when dealing with comm ports and the fact that your device may or may not even be on. The error module in that project will work very well for you.

    I have no way of testing this but maybe something will happen to your device. I hope that something does not involve smoke! :P

    Controller.zip

  14. Can you just make it to some extent then i will do myself after. I don;t where to start. More, what is the difference between my event cases and

    you said something "user events". Please help me.

    User events are events you generate in your code. In a standard producer/consumer design you can send messages from the producer to the consumer. But there is no way to send messages from the consumer back to the producer. This can be necessary if there is an error in the consumer and you want to notify the producer. A user event is much like a queue. The difference is that with a queue you can send from multiple loops to only a single loop whereas a user event can be sent to multiple loops. That detail doesn't matter right now. For sending messages from the consumer loop back to the producer you could also just use another queue but many examples use a user event.

    You use LV8.5 right? I will create an example with some of your code in it to get you started. Why would I do this? I like the practice! It can be hard to come up with an idea just for practice. And if it helps someone all the better.

  15. The program is simple enough. If I can find some time I would be happy to set it up into a producer/consumer design pattern. But I have a couple of questions.

    Forget about the architecture for now. If I were to help you with this I need to know if you are familiar with the following concepts.

    • clusters, bundle and unbundle by name (I see you are unbundling the error wire by name)
    • queues
    • typedefs
    • custom controls
    • user events (different from the events you are using)
    • subvis
    • action engine/functional global
    • state machine

    Until I can get some time to help get you started you should study those things above that you do not understand.

    You have an event for Timing/Phase shift value change. You create a command to send to your controller from that and read a response. You then write that back to the Timing/Phase shift control that triggered the event. You do the same for some other controls. Is it your intent that the controller modifies what the user enters into those controls?

  16. Did you wire the shift register through in the other case, the zero case? That case should be empty other than wiring the shift register through.

    As for the UI freezing this can be expected. The UI will freeze until everything in the event structure is done. You can try right clicking on the event, select edit events handled by this case and unselect Lock front panel at the bottom. That is not the right way to do this and you should read the help to understand what the implications are. It is recommended that you put all of the processing in another loop outside of your event loop. It means rewriting your application to use a producer/consumer architecture. There are many good articles about this.

    Have you used the LabVIEW project? With one vi like you have it doesn't make a lot of sense to use it. But if you were to rewrite this to use a producer/consumer design with subvis and typedefs it really helps.

  17. Now I can see that you are explicitly disabling the termination character so I guess that answers my question and you know your device does not send one.

    You changed the wait to only 5mS. Highlight execution would cause a much longer delay. Try changing it to 100 or even 1,000 as a test to isolate the problem. Maybe you already tried that but it is not clear.

    I can see that the combo box has empty values after the first one. Is that what you see when putting a probe on the input to the Strings[] property node?

    I also notice that you are using the same pattern of write, wait, read in many places. You should make that into a subvi.

    post-17905-0-21319800-1301846366_thumb.p

    I also changed it so that the array of strings is built in a shift register.

    post-17905-0-58595700-1301850443_thumb.p

    But after looking more closely I am kind of confused. I thought that you were creating the combo box entries from the results of the read. It looks like you want to create entries if the read returns something other than zero and the entry is the for loop iteration in hex. I did not notice that the N terminal had a 50 wired to it. I can not figure out how you only have three entries in your combo box instead of 50. Can you try putting an array size function on the input to the property node and see what that returns?

    [EDIT] Ok now it makes sense. The code you posted is not the same as the image you posted above. In the code image above you have a three element string array constant auto indexing the loop. No wonder I didn't notice the 50 wired to the N terminal. It wasn't there before.

    Just a side note and I hope it doesn't sound preachy. Personally I always keep the block diagram as neat as possible and don't worry much about the FP. I live in the BD. When my mind is busy thinking about how to solve a problem I sometimes use that time to clean up wires and arrange nodes. I only do this with parts of the code that have something to do with the problem to keep my thoughts focused.

×
×
  • Create New...

Important Information

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