Jump to content
Sign in to follow this  
FZJ_Teststand

Serial port and event trigger

Recommended Posts

Hi to all out there,

i've learned a lot the last weeks about LabView and its possibilities, but now i get stuck and don't know whether it can be done or not...

The problem: I have several devices connected by serial port (I have at least 4 USB-Serial-Adapters for that..). At the moment, commands to the different devices were send and the serial ports are polled by a timed loop. If any of the devices sends data, its data is collected from the appropriate serial port, and processed. Why you ask? Well, the different devices have different baud rates, and different processing times. So i collect the data for a certain time period and then a kind of data compressing is done. But during this collection time, one device delivers say 100 data points per minute, while the other delievers only 40 data points per minute.

Nevertheless I wanted to change the structure from a very complex diagram (mine is several screens wide, you would beat me for that :laugh: ) to a more simple one. So i thought, i can create an event for each serial port, whenever one or more bytes are present in the input buffer. But the problem is, that for this serial port operation i can not find a way to create an event. Or is there a different way to handle this operations?

Share this post


Link to post
Share on other sites

Hi,

You could try the VISA wait on event. I don't think it will help in making the diagram any smaller, just saves you from polling the port all the time.

I have attached a VI in which I have done this for a IR remote control it is a modified example. The event structure is there just to stop the VISA wait instead of waiting for it to time out. It will always return an error will you stop it this way but that's not why the error is not wired to the stop I was getting framing errors all the time from the remote.

Kelvin

Download File:post-2707-1124710746.vi

Share this post


Link to post
Share on other sites

@kel712

Now i got a closer look to your proposal. It's interesting - but not the thing i was looking for. I want to know, if it is possible, like for DAQ cards or Buttons of the frontpanel, to create an event for the serial port, which can be handled with an event case.

I'm looking for something like this:

RS232 -> any char arriving -> event triggered -> at some time the event is handled by an event case (dynamically ?? static ??) -> spare time for the program ...

Share this post


Link to post
Share on other sites
@kel712

Now i got a closer look to your proposal. It's interesting - but not the thing i was looking for. I want to know, if it is possible, like for DAQ cards or Buttons of the frontpanel, to create an event for the serial port, which can be handled with an event case.

I'm looking for something like this:

RS232 -> any char arriving -> event triggered -> at some time the event is handled by an event case (dynamically ?? static ??) -> spare time for the program ...

5766[/snapback]

I don't think you can program serial communication that way yet.. but look at Scott Hannah's Serial Server which is freeware. It will give you an idea of how to configure serial comm.

Basically, trigger off of "Bytes at Serial Port" being non-zero. If it is, then read serial, else loop back.

Put serial reads/writes in their own parallel fast loops (10ms or less loop time), and the UI (display, parsing etc). in a slower parallel loop.

Pass data between the two with Q's. When data is read by the serial loop, throw it on a Q, and then the UI slow loop reads Q elems, and parses them, at leisure.

Neville.

Share this post


Link to post
Share on other sites

Thanks Neville D,

that seems to be a solution to me. Nevertheless, 'googleing' the name led to some strange results ;) , and also '+serial +server +labview' is a neverending search (>25pages). Please, can you give me a hint, where to find the mentioned freeware? Up to now, i don't have any experience in programming Q's - so having a look at it will help me :) ...

Share this post


Link to post
Share on other sites
Thanks Neville D,

that seems to be a solution to me. Nevertheless, 'googleing' the name led to some strange results ;) , and also '+serial +server +labview' is a neverending search (>25pages). Please, can you give me a hint, where to find the mentioned freeware? Up to now, i don't have any experience in programming Q's - so having a look at it will help me :) ...

5790[/snapback]

Here is a link to Scott's site: Check out the Serial Terminal VI's. He does not have a Q architecture in them, but there are a lot of examples in LV that you can take a look at.

http://hannahsmac.magnet.fsu.edu/labview/vi_library.html

Neville.

Share this post


Link to post
Share on other sites

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.

Sign in to follow this  

×
×
  • Create New...

Important Information

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