Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   sensor interrupts for kick mechanism (http://www.chiefdelphi.com/forums/showthread.php?t=82098)

LinuxArchitect 07-02-2010 06:43

sensor interrupts for kick mechanism
 
Can someone point me to sample code for using interrupts rather than polling sensor inputs, expecially in labview? Or is there VI code that I can't find for supporting something like a force sensor to detect touches? I assume I need to use the Interrupt open/wait/close VIs but I'd love to see an example of how to fit them into the existing framework.

How are other teams implementing a sensor for knowing a ball is in position for their kicking mechanism?

Greg McKaskle 07-02-2010 10:05

Re: sensor interrupts for kick mechanism
 
I think what you are asking for is an asynchronous notification that a trigger condition has occurred. While this could technically be done as interrupts, it most likely doesn't need to be, and is far more extensible if done differently.

I'll discuss the slower and safer approach first, then I'll tell you what I know about the interrupt capabilities.

If you are looking for ball contact, you can probably use a periodic loop to poll either a digital or analog. You should find lower overhead with preregistering the analog trigger values and simply reading the state of the trigger -- the FPGA will do the level comparison for you.

Anyway, you can set up an independent polling loop using either a regular LV loop with a wait of say 5ms, or you can use a Timed loop. If using the timed loop you can even specify a timing source such as the microsecond clock. Be sure to measure the overhead of reading trigger state, digitals, and the like as if you set up the polling loop to run too quickly, you'll use lots of CPU. Again, my guess is that a trigger poll of 5 to 20ms is probably plenty fast and will cost very little in CPU. To communicate the poll results back to the rest of the program such as the teleop, you can use a simple global, an RT FIFO, etc.

To actually use interrupts, the LV Utilities palette contains an Interrupt Open, Wait, and Close. Wire up the appropriate device references and trigger conditions. I couldn't find an example showing the interrupt usage, but it didn't look that difficult. Make a loop that Waits for the interrupt and it seems like it will return each time the FPGA raises the interrupt or when the timeout occurs. From what I read, you should definitely read the documentation so that you can control the program reset, otherwise you may wind up locking things up from time to time.

Ask more detailed questions if needed.
Greg McKaskle

LinuxArchitect 07-02-2010 11:00

Re: sensor interrupts for kick mechanism
 
I think using an analog trigger is the answer. I had seen the example but forgot about it. Thanks for the reminder!


All times are GMT -5. The time now is 01:57.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi