08-14-2008 07:11 PM
I am aware of how to make LabView respond to user interface events (keyboard presses, button presses, mouse moves, etc) and I'm also aware that the same event handling structure can be used to handle external (non-GUI) events- like those generated by a digital edge on a DAQmx input. My question is whether the same event handling structure can be used to handle external events coming in on a CAN network- via NI-CAN or otherwise?
Is there a good reference which summarizes ALL general types of events that can be handled in this way- not just the standard GUI events? I have a feeling that ActiveX and VISA are other ways to generate events, but can't find a good resource in general - or specifics on the NI-CAN side.
Thanks!
Nate
08-15-2008 03:30 AM
Hi Nate,
you can create your own events. Use the user event functions for it. With this functions you can create an event of all "events" you need.
Hope it helps.
Mike
08-15-2008 09:34 AM
Thanks Mike- still not sure I understand. What should I wire to the Create User Event block in order for available events to show up in the dialog which allows me to configure events in a given frame? For example, I have an external micro-controller communicating with LabVIEW using a CAN network. Usually the communication is started by LabVIEW and sends commands out- but I also want to be able to handle asynchronous messages generated by this micro-controller in an event fashion without having do any polling. Is there some reference I can wire to the Create User Event block which will make an event like "Incoming CAN Network Traffic" available to be handled in an event structure?
Thanks again!
08-18-2008 05:10 PM
Hi Nate,
You will have to do a continuous CAN read in a while loop, and have that trigger whenever there is a successful read. Take a look at the CAN Receive.vi example in LabVIEW > Help > Find Examples > Hardware Input and Output > CAN > Frame API > Basic > CAN Receive.vi. You will have to poll the ncGetAttr.vi to see if there is any data on the bus.
CAN works differently from DAQmx so you cannot implement an event trigger the way you want.
Good luck!