Jump to content

A hand in circular buffer


Recommended Posts

I need to design a circular buffer for my purpose, which consists in :

My data comes from a DSP ( microprocessor) it's sending signals serially to a MAX3420E ( converts serial-usb) which converts it's to a signal tranmitted via USB port. I want LABVIEW to read the signals in te USB port and plot the signals (wave) in a chart.

But the data come to fast, so I want so make a circular buffer to put a part of the wave in the chart every seconds, if I don't to this she signal is 60 hz so would be impossible to distinguish the wave

I'm very new in labview so searching in the net I found this video

which is very good but the sub VI it's a black box and I don't know what's inside.

I also found this article in NI http://zone.ni.com/devzone/cda/tut/p/id/7188 but its this too hard for me too understand . Someone knows a simple way?

Thanks .

Link to comment

I also found this article in NI http://zone.ni.com/d...a/tut/p/id/7188 but its this too hard for me too understand . Someone knows a simple way?

Hi Leonardo

That's the link I would have posted too

It shouldn't get more easier than that - the code is already written for you.

If you are still stuck, maybe it would help to post some specific questions on what are the issues you having and we can try and help you out with those

Link to comment

Hi Leonardo

That's the link I would have posted too

It shouldn't get more easier than that - the code is already written for you.

If you are still stuck, maybe it would help to post some specific questions on what are the issues you having and we can try and help you out with those

JGcode

Thanks for the answer . ABout the code correct if I'm doing something wrong . I've made 3 parts. the inicialize part, the write part and the read part into a graph.

My doubt is these 3 parts are ok? Do I need to link the same data in for all the 3 parts? Because in the same the autor omit some links in his images. So I dont know if I have to wire these components or not.

In my case my data in is coming via a USB device but my partner is responsable for the incoming data. I need to do the buffer. This example woul fit in that case? The data in is a string type.

Thank you.

post-17694-097081300 1280162434_thumb.pn

Edited by leonardovieira
Link to comment

My doubt is these 3 parts are ok? Do I need to link the same data in for all the 3 parts? Because in the same the autor omit some links in his images. So I dont know if I have to wire these components or not.

I agree, the API is not the best - having wrappers around each method (init, read, write) that only exposed the required inputs would be nicer, but you could always do that.

Anyways, to answer your question, you only need to supply the information required for each method e.g. if you are reading from the buffer you do not have to input data.

This image (ref: ni.com) sums up an example best:

image15589.jpg

Link to comment

JGcode

Thanks for the answer again you saving a new in Labview. I wasn't understanding the miss of wires.

As a last question when my device runs, sometimes it' reads the buffer when it's still empty. I've tried to put a wait function but the problem it's exists .At last I 've connect the read part after the write part and put a loop in both. But when i run my project the graph doesnt display anything. Seeing in highlight mode only #0 comes to my graph . Anyone know why?

Like I said before the incoming data is not done yet so i've invented a loop to only imagine a data coming from , only to see if the project works

Thanks

circular buffer.vi

Edited by leonardovieira
Link to comment

Guys please forget my previous post.

Now i've put a simulate wave ( like I would receivef from a instrument)

My problem is : with the circular buffer the data still come too fast it's too "polluted" its dificult to distinguish,in this case my sinal is a simulated 180 V . But in fact when the "real data" ( from a enviroment , for eg a socket) comes , i woul be able to see anything , because my voltage is variant.

I would like to see the wave in a way I could see its amplitude in a visible way..

Thanks .

Cross posted here http://forums.ni.com/t5/LabVIEW/Continuos-read-buffer-using-USB-port/m-p/1196173/highlight/false#M515459

circular buffer wave.vi

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

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