Real-Time Workshop | ![]() ![]() |
Asynchronous Rate Transition Block
The VxWorks Asynchronous Rate Transition blocks are meant to be used to interface signals to asynchronous function-call subsystems in a model. This is needed whenever a function-call subsystem has input or output signals and its control input ultimately connects (sources) to the VxWorks Interrupt Control block or Task Synchronization block.
Because an asynchronous function-call subsystem can preempt or be preempted by other model code, an inconsistency arises when more than one signal element is connected to it. The issue is that signals passed to and/or from the function-call subsystem can be in the process of being written or read when the preemption occurs. Thus, partial old and partial new data will be used.
This situation can also occur with scalar signals in some cases. For example, if a signal is a double (8 bytes), the read or write operation may require two assembly instructions.
The Asynchronous Rate Transition blocks can be used to guarantee the data passed to and/or from the function-call subsystem is all from the same iteration.
The Asynchronous Rate Transition blocks are used in pairs, with a write side driving the read side. To ensure the data integrity, no other connections are allowed between the two Asynchronous Rate Transition blocks. The pair works by using two buffers ("double buffering") to pass the signal and, by using mutually exclusive control, allow only exclusive access to each buffer. For example, if the write side is currently writing into one buffer, the read side can only read from the other buffer.
The initial buffer is filled with zeros so that if the read side executes before the write side has had time to fill the other buffer, the read side will collect zeros from the initial buffer.
Asynchronous Rate Transition Block Parameters
There are two kinds of Asynchronous Rate Transition blocks, a reader and a writer. The picture below shows the Asynchronous Rate Transition block's dialog boxes.
Both blocks require the Sample Time parameter. The sample time should be set to -1 inside a function call and to the desired time otherwise.
Asynchronous Rate Transition Block Example
This example shows how you might use the Asynchronous Rate Transition block to control the execution of an interrupt service routine.
The ISR0
subsystem block, which is configured as a function-call subsystem, contains another set of Asynchronous Rate Transition blocks.
![]() | Task Synchronization Block | Unprotected Asynchronous Rate Transition Block | ![]() |