standard with a state machine controls

Hello

I read with VISA to a serial device. I am writing for the series the start character and the device sends data.

Now after reading the data, I want to stop sending in writing to the series a stop character. Separate loop is playing.

I want to do a stop button that written in the series and a start button that writes serial and bed data. Is it possible to do without a state machine?

BTW, are there examples for a series of reading and writing of State machine?

This has proved to be a bit more complicated as I first thought.  If I wrote you a demo.  Just add your series writing and reading the code when indicated.

It is not a state machine.  It looks more like a producer-consumer architecture.  Product event loop start and stop commands.  The other loop is executed according to the orders.  The trick was to get the series reading loop so that it could be stopped at any time and restarted at any time.

Tags: NI Software

Similar Questions

  • State machine, controls, and indicators

    Hey everybody,

    I'm working on the conversion of a VI to use a state machine architecture. In other words, there are several buttons that trigger States through a structure of the event in the standby mode. Two States need write values in the same set of indicators, but the rest should be left alone. Several States also contain a Subvi, which takes a cluster entry. The cluster is composed of about 10 digital/boolean controls. I wonder what is the best way to deal with these two problems. I could use local variables or references, but that seems to be discouraged for most cases. I do not have access to the VI himself at the present time, but it might send more later if necessary.

    You could go with the local population, in this case it should be ok, or have an update-state indicator.

    I have probably to take the easy road and go with local to a simple state machine.

    /Y

  • Problem adding values to a table with the state machine architecture

    Hello

    I currently have a problem that I have to build a program using state machine architecture and now I want to add a value in a table whenever you press a button, but I would like the table to add the new value, rather than deleting the last value. I can't seem to figure out how to make this work without using while loops and similar. It doesn't seem to work properly.

    It is in the case of measurement.

    The idea is I draw several lines then it records the length of the lines in a table and then I'll take one average this so I can convert pixels into real life SO units. But right now I can't seem to add the information in the table.

    There is a little screw Sub, but I think that they should not be important for this question please!

    What's the problem with just the table help build?

  • Engine using a state machine control logic

    Hello

    I'm trying to implement motor control using the logic of the state machine. My requirement is simple. I have a voltage from data acquisition value that corresponds to the couple (initial value = 5). I need my feeding motor a positive (right-hand rotation) and negative (counterclockwise rotation) speed depending on whether the value of this tension is between the top (7 V) and the lower thresholds (3 V).

    In other words, the motor starts to turn in a clockwise direction at the outset; the voltage is declining, as soon as we get to <= 3="" v,="" it="" changes="" direction="" and="" moves="" counterclockwise="" till="" it="" hits="">= 7 V, then changes direction again and this repeatedly for, say user-defined number of cycles. I tried to write this logic, and when I run the program it starts well, is to see the first time, entry happens under a low threshold, changes direction but oscillates at the same position. He won't until > = 7 V.

    I enclose the code for your reference. Logical machine state in queue can be of any help? Also, can I present a State in which after that user-defined cycles are more the engine back to a position where the voltage is 5 V.

    Thank you very much.

    Ravens fan is OK.  You need to know which direction you are moving before deciding what to do comparison.  Look at this simple diagram that shows how to use a shift register to keep track of which direct that you use.

  • problem with the state machine

    Hello! I have a VI to monitor a storage tank. I tried to do by creating a simple state machine that changes the value(on/off) of some faucets based on 2 conditions:

    -When a certain temperature reaches a predetermined value AND its derivative is<0, the="" state="" must="" change="" from="" on="" to="">

    -When some time passes, the State should change from off to on.

    Unfortunately I can't get this working as it never changes state (by example, if I start with him always stay on 'on' and vice versa).

    Could you please tell me what I'm doing wrong? I enclose the screenshots of the 2 States.

    Thank you!

    Sounds like your shift which could not not be wired properly.

  • How to use a structure of the event with a state machine


    I don't know exactly what you're asking, but it sounds as if you want a bunch of script tests and if the user says stop, to immediately stop the current test and abandon others?  I'll assume you know how to clear the table so that it will not abandon the others, so I guess that you have wrong to abandon the current test?  If it is indeed the case, the problem is that you are not able to spread the message of the VI FP main which is the GUI for the sub vi which is the test where the test may or not have a GUI (FP visible) of its own.  Threading is the first thing to come to mind, but it will be may not need the use of events.

    You can do this by passing a refnum of the stop button to the Subvi, where you can then add to wait to the structure of business event.

    I have attached 2 screws, mainvi.vi which is just a loop displays the number * 2 (number of seconds since the race) to be called subvi.vi and then check to see if the button is pressed.  mainvi.VI is in no way a state engine, it's just a simple loop for demonstration purposes.  subvi.VI just waits 2 seconds and leaves, this is a better engine State structured with an init State to start a case of survey to wait events and an exit status to clean.  You can change everything as you wish so that he can do what you want.  You will notice that even if subvi.vi is running, it will automatically end when you press the stop button.

    I hope this helps.

    A

  • State Machine with PID control

    Hi, I currently have a problem with my state machine, I control two cylinders double effect in sequence that works very well. However, there is one point I need to increase the pressure in the cylinder and to maintain this pressure through the sequence of State machine, however when the state machine transitions to the next indicate the PID controller resets, how can I solve this problem? Everything in is also allowed to apply the pressure in the cylinder another (same node IO accessed).

    Thank you I joined my project in a WinZip file, then it will have to be extracted. The two main VI to watch is 'Park Brake FPGA VI New' and 'park brake host VI update 2 "(new)

    Thank you.

    Nevermind I solved the problem with a parallel loop.

  • State machine gets stuck (small problem)

    Hello

    I have a problem with the state machine, I have atteched dummy code that my problem can be considered. When I hit the exit button and the menu popup appears, the YES button works as it should, but when I type no., my program gets stuck. I tried initializing controls, but no effect

    Thank you for your help.

    I think it will be easier to use a case OPI event.

    Jean-Marc

  • State machine running in the mess

    I'm under Labview 2014 with a card USB-6212.  My card/code is used to control a stepper motor and a linear actuator with a built-in potentiometer.  I created a state machine to control the sequence of events and synchronization between the two engines.  What is the general flow of the program. (The program ultimately will save the data, but this feature is not yet written.)

    (1) Init

    (2) take data

    (3) take out the cylinder according to the desired distance.

    (4) increments the position of the actuator to the next desired position.

    (5) repeat steps 2 through 4 until the next desired position is greater than a maximum distance.

    (6) actuator back to the starting position.

    (7) raise the stage with engine step by step an increment.

    (8) repeat 2 to 7, up to a maximum height

    (9) returns the height of the platform to zero.

    I have three main problems with my state machine.

    Problem 1) the counter mentioned in step 4 (found on the case of the ACTUATOR OUT/RECORD DATA in the program) does not invariably increment.  Most of the time, he eventually incrementation of twice the distance that she is supposed to.  I can watch the indicator on the façade increment twice while the linear actuator moves only once.

    Problem 2) program runs correctly in the sequence or consistantly.  Step 7 usually occurs prior to step 6

    Problem 3) program rowed a lot and freezes before it finishes.

    I have worked on this all day and could really use some help.

    Thanks in advance.


  • State concurrent state machine

    Hi guys

    I developed a VI of State machine standard based on a project of motor and vision for the College. His work very well to transition between States, but there's a few instances when I want 2 States to run simultaneously. One for the motor and the other to constantly monitor the temperature, for example.

    Is it possible to have 2 States carried out simultaneously using the standard state machine structure in labview? I really hope it's the last obstacle in my project!

    Any help would be appreciated. Thanks in advance guys.

    No, you can't have two concurrent States.  Blowing just outside any state machine logic.

    You may have either two switching in both States feel between them.  Given that each State should not take a long time to run, they run almost simultaneously.

    Or the temperature of your monitor should not be regarded as a State at all since you said you want to constantly monitor.  It should be its own separate while loop which is not part of the state machine logic.  Then he really run concurrently with the state machine.  There are a number of means for transmitting data of the data acquisition loop the loop of State machine so that the state machine can change the State if necessary according to the temperature data.

  • Storage of data in a State Machine

    Hello

    I am building an optical measurement of fluorescense set-up and plan to control using LabView.
    I need to scan a range of wavelengths and to each acquire a measure. I just realized the best way is to do it with a state machine, which will travel two States (first Set wavelength, second Aquire) until the final page is reached.

    I would draw wavelength acquired data vs (X vs Y, two tables I guess) that the analysis is performed.

    And after several iterations, when the analysis is complete, I want to save all the data to the file (for example, only two columns, one of the wavelengths, the second the acquired data).

    Therefore, for each iteration of the scan, I need store the length of current wave and its correspondents. This information will also have to pass between the States, as I want the plot to be real-time (during scanning).

    As a novice of LabView, I'm not sure what is the best way to do it (shift registers? AE? queues?) and I would appreciate any assistance.

    Thank you!

    Shift registers is the most simple and suggested way.

    Just be a little careful to connect across all States, otherwise you'll ditch the data to halfway.

    /Y

  • 2 parallel state machine

    I have 1 state machine controls a number of sensors of pressure and balances.

    The transducers of pressure and the balance is used to analyze soil samples

    I need an another State machine of the exact type as well as others. The only difference is that the new machine of the State must control another set of sensors of pressure and balances.

    2 state machines must run parallel, then I'll be able to analyze soil samples 2 at the same time.
    The State machines need not run at the same speed. It's alright that the computer of a State is ahead of the other.

    Is there a clever way in LabVIEW to get over this, or do I just copy the first state machine and change the id for sensors of pressure and balances?

    Reentrancy is the key here.  I recommend using prealloue reentrancy Clone for reasons of speed and memory management.  If you made an a high level VI which simply calls this State twice, machine in parallel.  Pass the ID to the state machine and you have two running.

  • creation of structures: state machine with controls

    Hello, I wonder if someone can help me with something. I have a sequence, followed by the event structure / while loop.

    someone can help me. I want to create a STATE MACHINE.

    Here's a basic outline of the current structure, I. and this is what I want it to be. I wonder if its possible and how.

    I'm using labview 7.0.

    Thank you

    This is what I want?

    I looked at your Executive VI.  I don't have an easy way to save in LV 7 now so I'll try to describe in words how I would approach this mess.

    I think it can be done with two loops, a structure of the event, a case structure and not global or local variables.  In fact, there is probably some small business structures and lines inside some of the case, but nothing like as layers of ~ 12 nesting, you're struggling now.

    Look at the design model of producer/consumer (events) as a starting point.

    The loop of producer (event loop) will have the structure of the event.  It will be a case for each control that requires immediate action.  Those that I could identify: get telemetry, side, open Journal printing, abandon, press tank Mode (?) Temp tank (?), Scan, Stop, wait, Step (?) unique, continue and Execute. Most of the buttons must be set on the mechanical action of locking and placed terminals in the case of the event appropriate. So no local population is necessary to reset them.  Those with (?) have no event.  You can have a case of timeout to display Date and time, eliminating which (painful to my eyes) loop.  I don't know about the other stuff in the case of a timeout, but most likely, it is up to the other loop.  If the room 1, 2,... buttons change during trips, they may also need event.  Inside of each event is exactly one element: the Enqueue function.  Create an enum command and make it a typedef. Enqueue this enum value. The queue will be read in the loop of consumer where all the action happens.

    The consumer is your state machine. It has a Dequeue function to get a new order for the structure of the event.  It has several shift registers to transfer data from one case to the other.  These removes your global and local variables.  I'd shift for each of the following registers: the State (typedef enum), cluster of error, temperature (table), pressure (table), results (table), Stat results (table grapes) and a big cluster Indicators_Flags (typedef).  The cluster Indicators_Flags everything that is in the cluster you initialize in the black image sequence (and then never reuse) would have more all indicators except the berries in Maj separate records as well as all your globals and no status indicator, you might need.

    The structure of matter is the heart of the state machine.  All shift registers through it.  It will be the case for what the program does.  Everything in this black initialization setting in about 15 cases of Init.  The while loop to the right of the boot image goes away, but the case inside to become some of the cases of the state machine.  Chassis temperature cycling code goes into 1-3 cases. Mode code pump and read the pressure of your case of timeout event are 1-3 cases.  Code of telemetry: 2 cases.  Print the Page before: 1 case.  Excel code.  Abandonment of code.  Temperature and pressure cycling code of main program: 5-20 cases.  Graphics, record in file: more cases.  Break: 1-2 cases.

    I would like to make a list on paper anyway, you think that you may need and allows to create a typedef enum to control cases.  By making a typedef, it is easy to change without running all over the code looking for the constant in all cases of change.  Enum names will appear on the structure of matter as strings.  Create the loop, shift registers and the structure of the case.  Moving is part of both the original thread can duplicate the case until you have a case for each value in the enumeration of the State.  (Do not use the case of the mark for each value option because it will empty cases that you will then need to wire through.)

    Then copy code from various places in your existing code in the case in the new VI.  Try to avoid copying inhabitants that it will create new controls.  Name bundle to get data in and out of the big bend cluster registry and use ungroup by name.  This provides a free documentation of the data used.

    Check in a month when you have other problems. This will not be a quick fix.  But it will be useful to have a program that works and is easy to manage.

    Lynn

  • Closure of a state machine in queue event with several parallel loops

    I am trying to find the best way to stop a program that consists of an architecture of State machine in line waiting for event with several parallel loops. Can anyone recommend the best way to achieve this in my attached VI? (To browse the forum, this seems to be a frequently asked question, but I have not found a solution that works for me.)

    I look forward to any comments on my as well code, if someone is willing to offer it.

    My program needs:

    If the user press the 'Stop' button, the program should prompt the user with "are you sure you want to stop the program?" and then return to a State of rest or move forward to stop the program. In addition if there is an error, the program should prompt the user to ' clear the error and continue, or stop the program. Then back to the idle state or move forward to stop the program.

    Architectural details:

    The program consists of 3 parallel loops: (1) a loop of event management that places different States of a queue of the State, (2) a State Machine that enters the State that is removed from the queue of the State and (3) a loop error/Shutdown, which deals with errors in the error queue management.

    During normal shutdown, where running handling loop in the case of event 'Program.Shutdown' and 'Shutdown' and the 'Idle' States are added to the queue of the State. In the state machine, the State of 'Stop' is invoked. Special "5000" error code is added to the queue of the error. In the loop of error handling and stopping, "5000" error triggered a prompt that asks the user if they want to stop the program. If the user chooses not to stop, a notifier StopNotif is sent to the State of 'Stop' and 'Program.Shutdown' event case with notification 'Go '. If the user decides to stop, the Notifier sends the notification "Stop". Loop and event management State Machine ends when they receive the notification "Stop".

    In case of error, the program behaves in the same way: If the user chooses to clear the error and continue, the program returns to the status "pending".

    HOWEVER - if the user chooses to stop the program, the program crashes. The author of the notification that is sent to stop the loop of events and State Machine management cannot be read because event Program.Shutdown and the stop State (which contain the function "Waiting to notify") are not active.

    I was able to activate the stop State by Queuing in the loop of error/Shutdown management. But I don't know how to activate the "Program.Shutdown" event by program and thus access the function "Waiting to notify" inside.

    I tried to put the function "Waiting to notify" outside the structure of the event, so the event-handling loop never ends. Placing timeouts on the "wait for declaring" and the structure of the event makes the programme of work, but I want to avoid using timeouts because I don't want to turn my event program into a program of polling stations. I would also avoid using variables or nodes property to stop loops, because that requires the creation of a control/indicator for something that the user does not need to interact with.

    Thank you!

    First of all, close the notifier outside loops with your queues.  Second, you must use a user event to send the message to the event structure loop so that it stop in the case of the stop on an error.

  • Order of generation of the signal with the command START/STOP (State Machine approach)

    Hello

    I met the problem with the realization of control (START/STOP) signal generation using state machine.

    There are 4 States in the computer status (see 4 screenshots below).

    The problem is when I click the button START, only a short series of generated pulses.

    What is the staff of task_in/task_out issue, which is not properly managed?

    Thanks in advance

    Pavel.

    Oh... you have defined with the mechanical switch action up to published... Right click and go to mechanical Action > latch when released. Do the same for your Start button.

    You took a second to read down hold value, because your writing acquisition takes on this subject for a long time, apparently.

    The stop button the Application, I did switch when set to released. It is set to the switch so that it can be used as a local variable in the Acquisition State stop as Idle.

    Here's more info on mechanical actions.

Maybe you are looking for

  • Acer M265 - factory for Win 7 image - is it "encrypted"?

    I want to find something quick.  We have a M265 old Acer of 4 years that we bought with Win XP and Win 7 provided by Acer.  We used the XP version now since the deployment, and now we are eager to move on to the configuration of Windows 7.  We did th

  • The administrator cannot connect to the Internet

    I'm unable to access the internet as an administrator, but can another installation to users. What is the problem and how can I fix?

  • ControlPanel troubleshoot

    I open Control Panel control panel, but nothing here (balnk screen) also when hitting the button customize, it does not open

  • Local group policy Calling-Station-ID AuthZ Cisco ISE

    Is it possible to make a policy AuthZ pointing to a local group of ISE with mac addresses? It works fine, but only 1 MAC address (RADIUS: Called-Station-ID CONTAINS test-ssid AND RADIUS: Calling-Station-ID is equal to 4 c: 7: 5F:C2:7 B: 7 C) I try th

  • Slow performance with laptop computer Windows 8.

    Separated from this thread. Nothing don't you suggested worked. I have a new laptop with Windows 8. I am extremely disappointed by my experience of this new version of windows. Maybe if I had a necessary step for companies their tablet, maybe I'd be