LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Blackfin Timer Access

Hello All
    I am currently evaluating the Blackfin BF537 EZ-Kit w/LabView Embedded. I would like to use this unit for an application that requires measuring the time between triggers. What I would like to do is create an interrupt driven application that would raise an interrupt when a trigger occurs on the timer's input terminal. The interrupt handler would then read out, and reset the timer. The 32 bit counters on the blackfin would be ideal, but I cannot find a reference or an example to illustrate how to access and configure the counter/timers to perform this function. Would I have to use a code window to work with the timers, or is there a VI that already does this? In the Blackfin>Device>Common palette, there are VI's that would seem to be able to create a connection to the timers, but they require a device reference? What are the device references for the BF537?

Thank you for any help you can provice

Sean Sexton


0 Kudos
Message 1 of 13
(4,379 Views)
There are no VIs in the current version of LabVIEW Embedded for Blackfin (2.0) to access the timers on the Blackfin processor. To do this, you will need to use the Inline C Node to call the ADI System Services library.

Include an external C code file that interfaces to the timers, and create your interrupt service routine in C as well. You could write to a global variable in the C ISR, then read from that global in an Inline C Node to get that information into LabVIEW.

Here is the location in the VDSP System Services help where I recommend you start:

Manuals -> Software Tools Manual -> Device Drivers and System Services -> VisualDSP++ 4.5 Device Drivers and System Services Manual for Blackfin Processors -> Timer Service
--
Michael P
National Instruments
0 Kudos
Message 2 of 13
(4,356 Views)
Michael
    Thank you for the information. I will check that out.
Sean Sexton
I
0 Kudos
Message 3 of 13
(4,345 Views)

Michael

I was able to initiallize the timers using an inline C node, with calls to the ADI System Services library. What I'm not sure about is; If I create an interrupt routine in a separate c code file(instead of an inline node in a vi), how do I tell the project (.lvproj) that this file is an interrupt routine? Does the library routine adi_tmr_InstallCallback() handle this for me?

 

Sean Sexton

InnerSea Technology Inc.

0 Kudos
Message 4 of 13
(4,246 Views)
Hi Sean,

In the current version of the LabVIEW Embedded Module for Blackfin Processors, installing a timer callback on a VI is very difficult. However, you could install a timer callback on a C function just as you would in VisualDSP++, as described here[local compiled help link] in the VisualDSP++ 4.5 documentation.

In the next version of the LabVIEW Embedded Module for Blackfin Processors (soon to be released), all of this can be done from VIs!
--
Michael P
National Instruments
0 Kudos
Message 5 of 13
(4,240 Views)
Michael
 
Thank you for the information, however the link did not work. I was able to find an example in VDSP++ called TimerWithCallback that illustrates the method. What I dont understand is how to tie the c code into my lvproj. Do I add the file to the build specifications? Also would I use global variables to pass values to the rest of the lvproj? Can I declare the variables under labview, and write to them from the c code file?
 
Thank You
Sean Sexton
0 Kudos
Message 6 of 13
(4,221 Views)
Hi Sean,

You might want to take the link and copy it into Start>>Run. It should work if you have VDSP++ 4.5 installed in the default location.

There are several ways to import external C code into LabVIEW. The one I recommend is the Inline C Node. This node is located on the Structures palette. You can type C code directly into it, just like you type text into the Formula Node or the Mathscript Node.

You could also use the Inline C Node to call a function that is defined in an external C file. If you do this, you should also right-click on the node and Add a header file that prototypes the function. You could then add an external C file to your build specification that implements this function.

You can add inputs and outputs to the Inline C Node. That is the recommended way to pass data to/from LabVIEW and C.
--
Michael P
National Instruments
0 Kudos
Message 7 of 13
(4,209 Views)

Michael

I found the document you were referencing. Thank You.

If I understand correctly, then I should be able to create the interrupt handler, and the access routines, inside an inline c node, and not have to compile and reference separate code files. Is this correct?

Is the updated version of the Blackfin tookit due in the next week or so, or is it further out?

Thank You

Sean Sexton

0 Kudos
Message 8 of 13
(4,202 Views)
The Inline C Node is not really meant for defining functions, but for calling them, or doing memory mapped I/O access. I would recommend that you implement the interrupt handler and access routines in an external C file, then make the function call in the Inline C Node to initialize everything from your VI.

I cannot share the expected release date of the next version of the module with you, but it should hopefully release very soon!
--
Michael P
National Instruments
0 Kudos
Message 9 of 13
(4,185 Views)

Michael

I have the external library created, and linked into a simple .vi that calls the configuration routine. Now what I need to do is get the timer data out of the coded interrupt routines, into a data stream. Currently the interrupt routine writes the value to a variable that is declared in the library. What would be the best way to get that data out into a stream within the .vi? I would think a queue structure would be the best way, but I don't see a clear cut way of getting the data in there.

Thank you for your help

Sean Sexton

Inner Sea Technology Inc.

Message Edited by sesexton on 09-18-2007 10:14 AM

0 Kudos
Message 10 of 13
(4,109 Views)