LabVIEW Embedded

cancel
Showing results for 
Search instead for 
Did you mean: 

LM3s8962 ISR communication..

I have a problem talking between the RT vi and the RT ISR.  The isr itself works just fine and communicating my couple of values via Global variables also works... but the Global variables don't provide an wait for event type capability... so how do you know your data is current???  I have tried using notifiers and RTfifos, but they appear to be taboo in the isr as i get compiler errors in their creation.  I've considered using another Global variable as a flag, but that just feels so wrong.
0 Kudos
Message 1 of 4
(6,422 Views)

You can use "Set Occurrence" in the ISR handler VI to send notifications.(of source, the occurrence refnum will be stored in the Global vi, as well).

 

how do you know your data is current???

 

1) Perhaps you are also thinking here to synchronization. I imagine you read continuously the globals and cannot distinguish between old values and ISR updated ones. Well, you could continue with this polling manner, and add a global counter (i.e.. Increment the counter in ISR, and compare this counter with a local one in the main VI).

 

2) Be aware about data passed between handler and VIs. You should pass only scalars for at least two reasons:

 - writing/reading up to 4 bytes are always atomic operations;

 - there is KI 44734(http://digital.ni.com/public.nsf/allkb/270545BCCF971FE9862574F20049095C)

 

However, keep in mind general rules, such "time spent in interrupts should be kept at minimum". Also, the overall design matters (e.g.. how fast are those interrupts? do you really need an interrupt handler? or you could trigger a timed loop?). 

 

0 Kudos
Message 2 of 4
(6,412 Views)

The latency time between the interrupt and the isr is very consistant, so  i'm using external hardware on a daughterboard to trigger the sampling of a periodic waveform.  I want the a/d in the isr since the timing is critical. 

 

Polling is only desirable in politics and you know how reliable that is... and a lot of wasted time.    Can i use the RTFIFO or a notifier  be used as you suggested for the "set occurance" (global refnum)?  It seems the creation of these objects in the isr is where the problem lay.

 

David 

0 Kudos
Message 3 of 4
(6,403 Views)
No, you cannot use anything requiring memory allocation (strings, arrays, queues, notification, etc., as is described in KI 44734). More than that, RTFIFO use mutual exclusion which is not allowed in interrupts. Perhaps you are getting runtime errors, not compile ones.

However, it seams you need the occurrence, which is an old but powerful synchronization tool. You can notify a waiting VI whenever an event occurs. Notice that the consumer process might loose some events if the ISR frequency is too high (in the simple example attached Timer1 has been configured for 4 KHz, but works fine at 2 KHz).
OK, instead of polling your micro may sleep while waiting for events (attach 2). Perhaps this will happen also in the newly elected European Parliament.

Download All
0 Kudos
Message 4 of 4
(6,385 Views)