VISA SERIES termination character producer consumer model

Hello

I'm developing a HMI to receive data from a sensor.
Material sensor is built in my company and I have no flexibility with her. Only 2 RX & GND wires, no possibility of
hardware handshake.

The sensor send to an RS232 com port a string hex each 1 s, 10 s, 60 years or more and I can not know the frequency.
So, I scan each data bytes to the serial port and serial port with VISA Read 20ms. At the end of the string hex sent by the sensor
There is a stop character but I don't how to use it.

I use the model producer/consumer do not lose any data.

In fact, I read and concatain received data (with VISA READ) until I got the right number of bytes (because I know the size of)
the sent hexastring is 495 bytes).
But in the real work, I don't know the size of the data to be received by the sensor. (<500>

So, I want to use the character of endpoint to stop the loop of producer that contain VISA READ.

Should what special function or the property node I use to do this?

I've attached a screenshot of JPEG of my code.

PS: for the development of the VI, I simulate the sensor data with another PC that sent the hex string in loop
with the stop character.

CHRI = s = nour wrote:
Hello

But in the real work, I don't know the size of the data to be received by the sensor. (<500>

A method to read an unknown number of bytes: put just the bytes to the Port in the whole loop (not read). Place the output of bytes to the Port into a shift register and compare the latest iteration with the current. When the number stops change (current loop = last loop) then all bytes have arrived. Bail out of the loop so directly while reading VISA.

Tags: NI Hardware

Similar Questions

  • Should I use the design of producer/consumer model (Instead of Globals)?

    Hello everyone.

    I have a request including several loops in it. A loop reading data series and he analyses for use in the other loops, another loop acquires via DAQmx data and performs calculations on it for use in other loops, the other formats the data from two loops and poster and one last test data. I was wondering if this is a good candidate for the design of producer/consumer model.

    For now, I use global variables to send data from the series and DAQmx loops to other loops. I use motors of the action for the different parts of the program that should be used everywhere, as the serial port. The test loop needs than the most recent data to run his test.

    Thanks for your suggestions!

    The short answer is Yes. If nothing else using queues to pass data will allow your various loops inactive if no data is present. By using globals your curls must continuously survey to see if the data has changed. You always are beter off if you can make your request, driven by events rather than to use the polling stations.

  • Buffer could replace the queue in the design of producer/consumer model

    Hello

    I have a question to which the task of buffer to store the data and the queue is also of the same thing so we could use the inplace queue buffer in a design of producer/consumer model.

    No, these examples of buffer not almost equal to a queue, and never "replaces" queue at the producer/consumer.

    The advantage the most important of the queues for the producers/consumers (which none of the other mechanics buffer sharing), it is that it works activities to warn the reader that the data is available. So if you would simply replace the queue by mechanics of tampon too developed that you have attached to your last post, you will lose a large part of the object using producer/consumer.

    Thus, to compare the two mechanics:

    -Tail works activities, while the example of the buffer is not.

    -Tail must allocate memory during execution if several items are written in that corresponding queue. This also applies to the buffer (must be resized).

    -Given that the buffer is actually simply a table with overhead, memory management becomes slow and messy with the increase in fragmentation of memory. Queues to play much better here (but have their limitations, there also).

    -Overload of the buffer (the table manipulation) must be implemented manually. The queue functions encapsulate all the necessary features that you will need. So the queues have a simple API, while the buffer is not.

    -Given that the buffer is simply a table, you will have a hard time sharing the content in two parallel running loops. You will need to implement an additional charge using data value references to manage the buffer or lose a lot of memory using mechanics as variables. Lose the memory, you will probably encounter racing conditions so don't think not even on this subject.

    This led to four '+' for the queue and only a single point where 'buffer' is equal to the queue.

    Hopefully, this clears things up a bit.

    Norbert

  • Data types in the design for the producer consumer model

    Is it possible for me to use any type of data in a model of design producer consumer, without specifying specific data type?

    what I mean is if there is a way to connect to a data type with which I can use any other type of data, not to mention that one that I have connected, and if not, how can I specify the data type for a number or any other data type, for use in a design of producer-consumer model?

    You can make a part of your cluster of data a Variant.  It will take any type of data.  A common architecture for the producer/consumer is a cluster which is an enum and a Variant.  The enum contains all possible "orders", you might want to send.  The variant contains data that could be of any type.

    Ungroup you in the consumer and get the enum and Variant.  Attach the enum to a case structure.  In the specific case, convert the variant type in a data type of regular LabVIEW and with it as you please.

  • acquisition and recording of analog data with producer consumer model

    Someone on this forum, in a separate last week discussion, suggested that I use the producer model consumer data acq.  My ultimate goal is to acquire analog channels 1-4 continuous data, display graphical band style and save the data on the boot disk when the user presses the 'Start Saving' button (and will continue to display recorder cards).  Economy will stop when the user presses the button "Stop Saving" but strip map will continue to operate.

    My attempt to use the producer-consumer model is attached (LV 8.5 only).  It does not work.  I have not tried to implement for recording user controls - just trying to make simple continuous display and save (1 channel) at this stage, using this model.  VI runs, but the graphic Strip is never updated with the actual data, and the data file that is saved has zero byte inside.

    Thank you.

    WCR,

    Looked at your code, and you are right.  It won't work.

    Take a look at this example:

    http://decibel.NI.com/content/docs/doc-2431

    The VI of the acquisition must be inserted in the loop of the producer.  In addition, you must tell him how many samples for (otherwise, it will get 0).

  • Using the producer/consumer with GPIB/VISA model

    Hi all

    So I have a .VI I learned to communicate with my camera, I joined. I tried strip down as much as possible, just to understand the concept. It basically just takes a resource VISA name, use this open VISA, then uses the same resource VISA to write a command that reads the data from my machine (xall?) and then bed in 500 bytes and which prints. If it works, and it's good.

    I try to use producer/consumer model for doing essentially exactly what this guy. I have a RLC, I want to press a button that starts my measure, I want him to taste several times per second, save the data in a text file or .csv and then stop when I press the stop button. Thus, he will be given indefinitely potentially.

    I would like to have the data in a format something like:

    Time C R

    0 5.0 4.3

    ... etc.

    I read the link of model p/c above, but my LabView knowledge is still low. Currently, my plan is to take the part of read/write of my attached VI, which are a sub - VI and then put that in the pink box in the VI for the producer/consumer above page that is labeled "produce data to be placed in the queue":

    What prevents me to do this, it's that I can't get the piece of read/write to work properly as a standalone Subvi.

    What is the right way to go about this?

    Thank you!

    I put if you actually found data of your instrument.  Your instrument is not made to take new measures or just send you the last reading, she did.

    Insofar as the file IO, I recommend that you learn to use the palette for the file IO functions.  You need to create your file before your loop, write in a text file inside and then close after the loop.  I don't do the thing the comment on the express VI entry will do what you want.

  • Programmatically change the number of producers in an architecture of producer/consumer

    Hi all

    I've got 3 momo SoMat I am streaming of data to 10 Hz. I plan on 3 producer loops and loop a consumer to treat.

    I am pretty sure when I show my customer that they want to increase the number of devices. This scuppers then the producer/consumer model unless I change by programming the number of producers and the rest of the architecture associated.

    Is there a way to do this or a better architecture?

    Phil

    As long as there is an ID any in your command of the queue, I do not see why your consumer cannot handle the producers as much as you need.  I would turn the producer code in a Subvi.  Make sure reentrant Subvi.  Then, you can call dynamically that VI as many times as you need, one for each instrument.

  • Shutdown producer/consumer problem

    Hello world

    I need to control one position with a controller of axes and save travel time of the position between two points. I use a producer/consumer model, but the stop key does not complete the program, the second loop is still running. I thought that hitting the stop button would create an error and end the while loop.

    Do you know where is the problem?

    Thank you for your help

    Your VI works as expected. Get rid of the misused sequence frames.

    The last image the question because the queue is destroyed if the two loops have completed. As the loop of consumer requires the queue to be destroyed to finish, this will never happen.

    Norbert

  • Producer/consumer or master/slave, acquisition, control, analysis and recording of data

    Hi all

    I have NEITHER cDaq-9188 and its modules NI 9214 (thermocouple), NI 9203 (HAVE current) and NI 9263 (AO tension). I need to measure the temperature and pressure, and according to these data, I need a frequency converter to drive a compressor control. I've developed acquisition, analysis and recording program by the use of the state machine, the design of producer/consumer model and I have no doubt about their. They all work very well. Now, I need to add a control program in their. The problem is that I need to check the compressor with feedback from temperature data permanently, but I do not necessarily all the data acquired and permanently from the results of the analyses. For example, I need to record data once in 30 seconds. Which model desing should I use for this task?

    Edit: I was not able to find examples of advanced program relevant to the design of master-slave model. If you know where to find them, could you write in this thread please?

    The declarant buffer not data.  Do only the queues.  A new notification replaces the old value if she is ever read or not.  You would be loss of data with the notifiers if the loop of consumers with a notification utility cannot keep up with the data that they fade.

    What I show all the data buffers through the queue in the loop of the producer.  The queue of the consumer removes all data and do stuff with him (such as logging) if the elapsed time is over.  What is the problem with that? That is what for (imstuck) described in his message.

    The other alternative is that you put the timer into the loop of the producer.  Have the Boolean value TimehasElapsed drive a deal structure this place only the data if the time is over.  In this case, only some data gets queued, and consumer loop removes all data as it gets and it opens a session.

  • Producer consumer with the third loop model

    Hello everyone and thank you for looking at this.

    I have a problem that I thought for a while now on the execution of a third loop in a design model of producer consumer (with events).

    I use this type of model for a UI and am happy with how it works. However if I want to add a continuis loop model to test for example how can I control the loop?

    In my example (see table), I use a local variable to run them (or stop) the test and the same to close the application.

    I don't know why, but this feels wrong to me. Is there a better way?

    Thanks in advance

    Chuck

    Nickelback says:

    Is the problem with the consumer loop only runs when it receives a message from producer loops event.

    Nothing says that you can't have a consumer loop enqueue States to itself.  Of course, this is more in a State Machine in queue with the possibility for another loop to the States of the queue.

  • error 1 to queue in a producer/consumer architecture

    Hi all

    I use an architecture-based on producer/consumer queue, as shown in the screenshot below (which is a simplified diagram of what I want to do).

    As you can see:

    1 / in the producer of the loop, I read data from two LV2: map Wafer and HAD current

    2 / in the loop of producer, these LV2 are used as output of a sub - VI, called 'Wafer map change. The Subvi, allows the user to change the 'Wafer map' picture indicator located in the loop of consumption, by double clicking it.

    3 / when the Subvi has run, it displays the picture indicator updated (Wafer card) and the new 'Course DUT' coordinates.

    4 / the two variables are grouped and transformed into a Variant.

    5 / the variant is then enqueud in the queue of the 'hand '.

    6 / this variant is converted from inside the loop of consumption, and photo indicator is unbundled.

    7 / Finally, the map LV2 Wafer is written and the modified photo indicator.

    This type of data flow worked earlier, but now I am facing the following error (it's my french translation):

    Error 1 occurred: Add an element at the end of the queue in GUI.vi of automatic Test Bench

    Possible reasons:

    LabVIEW: An input parameter is not valid. For example, if an entry is a path, it may contain a character that is prohibited by the operating system, as? or @.

    NOR-488: The command requires a PDC GPIB controller.

    I have no idea how it appeared. But now I'm stuck, and I would be grateful if someone can help me with it.

    Thank you.

    Kind regards

    Florian

    Your method to allow the judgment seems suspicious.  Say that there is an error in the loop of consumption.  This stops the loop of consumption and the stop button set to TRUE.  But the value of the stop button will not be read until the next iteration of the loop of producer.  So if you decide to hit the button on the Insert, the queue was already destroyed, then you will get your error.  And all these local variables just shouts "RACE CONDITION" for me.

    Get a mechanical action of the Stop button latch when out.  It is the default setting for a button.  Then place the terminal inside the event (which you already have).  A REAL outside this case, wire OR with wire error to stop the loop of the producer.

    You need to do is create a command to stop the loop of the consumer.  This order will be sent in the case of changing value of stop button.  You should probably send this command after the loop of producer, just in case where the loop of producer created an error.

    You can also use a node property of the button stop to set the Value property (signs).  This will cause the structure of the event to raise.  This will cause the producer loop stop if the consumer has an error.

  • Master/slave producer/consumer Feeback?

    We know that in the models of master/slave and producer/consumer can send information of the master loop or a producer to the loop of the slave or the consumer.  But what to get information of the loop of the slave/consumer back to the master/producer loop?  I think it may return some sort of output or a message saying something like "I finished my work successfully.  This can be done with local variables, but is it really a good idea?  Is there another better way?   In addition, in this case can I just use a sub - vi?    I don't know that I always get the PARALLEL treatment offerred by master/slave and producer/consumer with a sub - vi.

    You can use a notifier to send a return message.  You can use a local variable, but unless you know what you are doing, you might encounter problems with race conditions.

    Sub - VI have nothing to do with producer/consumer architectures.  You can do a p/c with or without sub - VI.  Sub - VI is a way to break the code in significant functional blocks.

  • Problems write in I / O with VISA series (low speed of the program being recorded)

    Hello! I've been monitoring voltage speed of the serial port 230000 baud / s. It is fast and accurate, but when I want to save this data to a tmds, xls, txt file, reduce the speed of the program and buffer overflows in series, which reduces the voltage rate control information. I tried on 2 PC with four core processors. I think that it is not because of the PC.

    Because of what it might be?

    File IO is SLOW.  You must compensate for that somewhere.  Look at the producer/consumer.  The idea here is to have a loop that simply reads the serial port (as fast as it should) and use a queue to pass data to another loop to process and save to disk.

  • First try the producer consumer Architecture: continuous play and dynamically update settings.

    Hello

    I am currently working with two instruments; an Agilent E3646A and a NI 6212 BNC. My goal is to have the 6212 continuously take measures according to predefined parameters while the E3646A parameters can be continuously updated. This combination simple instrument aims to help me learn the manual architecture; continuous measurement, output dynamic controls and instruments more will be added in the future.

    I've already posted on a similar, but more complicated configuration (http://forums.ni.com/t5/Instrument-Control-GPIB-Serial/Split-second-lag-when-controlling-two-instrum... and was advised to try the producer consumer Architecture.) I found the documentation on the website (http://www.ni.com/white-paper/3023/en/, https://decibel.ni.com/content/docs/DOC-2431), searched the forums and built my own VI. While my first attempt at a producer consumer Architecture has solved some of the problems I had when I posted on the subject, however, new questions have been raised regarding the reading and adoption of the VI.

    I am currently able to run the VI and update the settings on the device. Previously, I'd get a freeze while the instrument has been updated and could not switch settings until it was done. This has been resolved, although that reading updates only when a parameter has been updated, although it is outside the structure of the event. In addition, the Stop button does not in any context. I also got occasional mistakes on the part of Deqeue, but the major part of the sentence is error-200279 'A tried to read samples that are no longer available' to DAQmx Read. I realize that there is a problem in my loop of producer but have not been able to find a way to solve it.

    This is my first attempt at a producer consumer Architecture and already I can see that it is a powerful tool. I read as much as I could and looked at examples, but should have some problems at the beginning. Would be very grateful of any advice so I can take full advantage of the architecture.

    Hope to hear from you,

    Yusif Nurizade

    You're going to overflow this buffer, unless the events are generated faster than "sample rate/number of samples.   Period.  Nothing could be simpler.

    You don't need a local to stop your curls.

    Try something like this attachment.  I simply moved the structure of the event in its own loop dedicated since it had nothing to do with acquiring data at all.

    Data acquisition loop stops very well when you destroy the task and destrying the stops of power queue (sending the default values of the queue for the power control) for EXAMPLE, to ADD a group of setting 'Safe shutdown' to a 'package' and it wire to the Center terminal (Prototype).

  • Visa series read write

    Hello..

    I have no problem with reading series. I want to playback multiple visa series... Fist read I want to read the data of 5x8bit uC then if visa data read isnot "NOT" I'm going to send data to the CPU as the character ' end then read data from uC to new but is leght data 2x8bit data...

    Please, help me...

    This is the number of bytes you want to read. You already said you first want to read 5 bytes. If you use VISA set up the Serial Port and the stop character allow to true, you can set a number of high bytes and playback will end when the stop character is detected. The character of default endpoint is a line break. If you set it to false, you can use the bytes VISA to the Serial Port to determine the number of bytes in the buffer is and read this number. This makes the basic example.

    Did you do any debugging serial communication base? I suggest that you use a program like Hyperterminal/Procomm/Putty/.etc before trying to write your own program. It is also difficult to give detailed advice without knowing how you have set the serial communication of the microphone.

Maybe you are looking for

  • When I drop to the bottom of recent history how can I open a second a site already open tab without having to go to "switch to tab"?

    I often have several tabs in the same open site, but using the dropdown won't let me switch to the already open tab. Is there an easy way to do it without having to re - enter the site for each new tab? Disable the option "switch to tab"?

  • HP G62-220: can't 5 G USB Adapter to work

    I have a HPG62-220 and a 5G Router I just through my ISP. Bought a 5G USB wireless adapter. I spent many hours on the phone with the mfr of the adapter and my ISP to get this to work and I can't. My laptop will not update to the adapter network/downl

  • NVIDIA GeFORCE 9400 M drivers / OpenCL error

    Hello I start getting the following error Generation of program journal OpenCL: d LOCAL_SIZE_X = 8 - D LOCAL_SIZE_Y = 8 - D SPLIT_STAGE = 1 - D N_STAGES = - 20 d MAX_FACES = 10000 d LBP input line, ptx ptxas 637 application; error: statement "{atom,

  • marquee selection in the drawing image control

    I would like a vi that draw a marquee selection with the mouse in a control program image. This works so far if the user begins to drag inside the image control. The code is actually robust against start the image and entering again. Unfortunately th

  • Vista Code 80072efe

    Have a HP DV9429US with Vista Home Premium 32 bit Service Pack 2 and I could not update for a while now.  I had various problems of recent virus, even if I run the Microsoft Security Essentials, which was not able to update or another.  I used Malwar