Jump to content

merlin

Members
  • Posts

    13
  • Joined

  • Last visited

    Never

Posts posted by merlin

  1. Well it kind of hard to tell what you are doing wrong if you don't include a working VI fragment that demonstrates the problem. The only thing wrong I can see from the screenshot you included is that there is no way to terminate the external loops and no way to recycle the event structure once you activate it the first time. Perhaps the pair of them is what is causing the behavior you are seeing. One click of the Terminate takes you out of the event structure (and is discarded) but doesn't stop the external loops and a second click of the Terminate then stops everything immediately because it is not discarded.

    See the attached VI for an example of something like I think you are trying to accomplish that seems to work.

    Hi Wmassey,

    first i would like to thank you for the example file. Very useful. I still have a problem: When the user clicks on the abort-button (or types Ctrl-[dot]), there is no question of wether he wants "really" to exit.. Doesn't that fire an event?

    I think i understood the strategy of deleting the queue and thereby declaring that the vi has to be closed. Nice.

    thnx. merlin.

  2. I have yet another question:

    I'm trying to avoid the vi from stopping before i deinit all open io-sockets and write every ini-file and so on. To achieve that i created an "EXIT"-state, which should be queued, when the event "Application Exit?" is triggered. Though i linked "Discard?" to "False", the program is still stopping before "asking my permission".

    post-1543-1134486991.jpg?width=400

    Could someone help please?

    merlin

    PS: Nevermind that you can't see the stop sign or that the subvi (which closes the sockets) hasn't got a nice icon, i'm still justing "testing".

  3. Are the four subVIs at the bottom driven by strictly by timers or by events?

    timers, but the timer frequency could change.

    Does one have priority over another?
    no
    Is there any race condition you need to watch out for?

    could you please explain? Or link to some ressource??

    Have you thought about incorporating them directly into the idle state of the DECIDE structure so that there didn't need to be communication between them and DECIDE?
    I don't think this is possible, since the timer needs to be running all the time, even if another state is running.
    If you do choose to go with queues, you don't need the DECIDE structure to loop - just make it hang on a queue read operation.

    can i make a timeout to such an operation? I need this so i can check for "hanging" hardware (or software for that matter).

    As far as the control interface goes, it depends on its complexity and what you are trying to do. Go with whichever method is simpler and easier to understand.
    The interface consists of two or three graphs (!) and some controls (for pid-controller) and perhaps some numeric indicators.
    If there is no reason to use the data outside the DECIDE structure then definitely go with the shift registers.

    Thanks man.

    now at least i can start coding.

    cya. merlin

  4. Hello everybody,

    i am still trying to rap my head around the idea of the state machine. My problem consists in that my "states" are neither sequential nor do they (normally) "know" what other state should follow them.

    would you please look over my structure "plan" and tell me especially if it's ok to (ab)use queues for determining the "next" state of the state machine in this way??

    post-1543-1134395619.jpg?width=400

    The small subvis at the bottom should set a queue item with a defined name, so that "DECIDE" can decide which state to go into next. Since the frequency with which DECIDE is executed is much higher than the frequency of the other states (100ms, 200ms, 500ms and 1s) this should ensure, that there isn't much delay between Queue setting and execution of desired state. In general i could use user events instead of queue and in that case i won't need DECIDE to run every x ms.

    By the way, what about the interface in this scenario, should each control handle the interface or is it wiser to let one extra state update the whole interface?

    Another question: what is better in this case using shift registers or LV2-Global variables to transport the variables (IO-acquired and to-write Data) between states??

    And please do ask, if the grafic or the text isn't comprehendable.

    cya and thnx. merlin

  5. Hi,

    First, do not use global variables. They make maintenance and debugging a nightmare. Not to mention they are terrible on resources. If you have to use globals then look up LV2 style globals. If your program is structured correctly you should not need them except for a few special cases.

    As you noticed my main problem is that READ - CONTROL and WRITE have to run completely independent. So i need all the data (both input and output) to be "global". I am still looking into that LV2-globals and i found these two pages about it:

    A small explanation:

    http://www.icon-tech.com.au/faq_blockdiagram.html#LV2Globals

    A small example:

    http://physics.wku.edu/phys318/notes/n07.html

    In the example-page i find:

    Built-in global variables (discussed below) are preferred over LV2 style global variables (in plain vanilla form like above) because they are faster and more efficient.
    Nevertheless, even if this is out to debate, i like the LV2-method because apparently i don't need any sznchroniyation (i.e. samphores..).

    But do i really have to build an LV2-global for each variable i need? Since some variables have to be read/written at the same time, is it "ok" to change the lv2-structure to something like this:

    post-1543-1133185627.jpg?width=400

    ?
    Your main issue seems to be program structure (or lack of). Look up state machines. This is the best way to program in LV.

    I think i understand what a statemachine is, but i don't know where i should be using it in my special case. Mind you the iterations of READ, WRITE and CONTROL aren't the same iterations.

    Also make sure your file structure is well defined (do not use LLBs. They strip the file structure and offer nothing in return but bugs. There is a post on this subject.). Look at the program I've provided for an example of how to structure your code and files.

    I only got LV7.0, so i can't look into this file.

    Thank you very much. At least the LV2-globals will help me. If you got any more tips, please don't spare me.

    cya. merlin

  6. Hi,

    i really don't know, if this can be understood as "Large Application", so i'm sorry, if not.

    I'm working together with another student on a control application. Each one of us has to control some signals. Both projects could run independently but we have to integrate them.

    What i've done so far: the io-parameters are stored as globals (so first question would be: is that the most wise thing to do?), inside the main-vi there should be at least four sub-vis running simultaniously: INPUT, OUTPUT, FORCE-Control (my part) and SPEED-Control (his part).

    My second question is concerning handling the interface:

    FIRST OPTION: Each Control (FORCE and SPEED) has it's own interface that covers half of the monitor. This way they are integrated within Subpanels. I should mention, that the user should be able to switch from automatic-control to manual control (for both controls). This would mean, that everyone of us, has to make two different sub-vis (auto and manual).

    post-1543-1132579968.jpg?width=400

    SECOND OPTION: We build one vi, that controls all of the interface, but it has to rely on (again) global variables, that are being passed by each of our controls. That means, that the interface is being set every x msecs.

    I hope, that i made clear what the problem is and also hope, that some of you could give me some hints..

    cya and thnx.

    merlin

  7. Hi,

    as the title says, i am thinking of using an svg-file as a front-end-solution to labview. Svg ist scalable verctor grafix. It renders very fast and is easy to script. I need two things.

    Mainly i would need labview to integrate the svg-file as an activex-component. Adobe provides an activex-object, but it doesn't seem to work with labview. In the second stage i'd like to access the dom-objects inside the svg-document. Or at least i would like to start some function inside svg..

    Has anyone any experience with this kind of connection between labview and svg?

    Thnx in advance.

    merlin

    PS: svg: http://www.w3.org/Graphics/SVG/

  8. Merlin,

    Did you try the picture ring for your purposes? There you embed the images directly into the control (at design-time) and select the desired picture by index at runtime. It is located in the Ring & Enum palette.

    Select Image by Image from Menu>>Import Picture from File and then with RMB on the control select Import Picture on the desired ring item.

    Didier

    4027[/snapback]

    Hi,

    thank you, that seems to be exactly what i need. Problem is still, that i'm not able to read the pictures, but i hope this will sort itself out.

    thnx again.

    merlin

  9. not static images. I need to change them.

    explanation: i built a function, that would draw a list of items onto an image and select one of them. Select means, that it would put a box around the item with a background and change the item's color.

    So to that function i pass a background image, the items (as a array of strings) and the colors. The function returns the new image (possibly the list has to be displaced, so that the selected item is still visible...). So everytime the user presses arrowdown for example i would pass a pos+1 to the function and the next item will be selected. Then i route the output image to a picture-control. As i said before, the picture is 600x256px big.

    The first time the picture is loaded it needs about a second or two to load. After that it's much faster but still not fast enough. When you go down in a listing, you wouldn't expect to see the picture flash...

    Please tell me, if that's still not clear.

    thnx.

  10. Hello Everyone.

    In my vi-application, i am using some images, that are loaded using "load jpg"/"load png"-functions. Now everytime i load an image, this takes too much time (for my needings; pictures are 600x256px big.)

    It gets even slower, when i write to the picture-control using the reference (from inside a subvi).

    I was thinking about storing the images in the final exe. Is that possible? And how would i go about to load the pictures then?

    thnx in advance.

  11. The first thing we really need to know is how are you trying to interface to the CANcard.  Are you using the DLL or are you trying to use some sort of activeX object or method?

    I have experience with the CANcard.DLL, you can interface to it using the methods listed in the back of the CAN driver manual.  You can only read the card when NO other CAN applications are running, including CANalyzer or CANoe.

    There is a ActiveX method to interface to the CANalyzer/CANoe software, but it seemed like a slow limited method when I tried it.

    I mention this because each method is completely different in what you can do for filtering

    Back to your question

    You can make an object or notifier that will inform you when a specific message is found, but be aware that it will not work like normal.  You will usually have to poll all messages found in the CAN receive buffer, then loop thru them until you find the message you are looking for.  If you set the CAN mask and filter to be extremely tight, you can filter for only that message, then poll the CAN interface until you find it.

    I would suggest reading the manual that came with the CAN card.

    P.S.  The Vector people have a library of VI's for interfacing to Labview, but you can only get it if you buy a specific support package, otherwise you will have to write your own from scratch like my company did.

    Please repost or contact me if you have more questions

    3825[/snapback]

    Hi first and thnx.

    i am actually using the vis that come with the CanCardX Driver Library. Actually i found an update version on the vector-site (for free):

    http://www.vector-cantech.com/index.html?....ndriverlib.html

    Right now, i'm having the carcardx being polled every cycle. The problem i think is known: this way i eventually miss a message or my laptop dies of cpu-ageage. I'm thinking of transfering the whole thing to visual basic, there is a sample visual basic source in the driver library, that explains how to set up events for the cancard.

    Another thing: At this time i do use the cancardx with two applications: labview is polling for new events and at the same time canoe is doing a rest-bus-simulation in the background - on the same channel.

  12. Hi everyone

    i am new to labview. Trying to program a vi to receive and transmit CAN-messages with vector's CANcardX [1]. I need a structure like the c++-type of WaitforsingleObject(...). How can i do this with labview and is it then possible to set a number of such WaitForSingleObjects()?? Or could someone who has allready used the cancardx with labview point me to some info in that matter (other than the sample-vi)?

    Thanks in advance.

    [1]: http://www.vector-cantech.com/index.html?....ndriverlib.html

×
×
  • Create New...

Important Information

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