Post Go back to editing

How to create non-blocking variable loop LED blink logic during communications on BF706 and any-other Blackfin...

#re-entrant loop counter

The idea behind this update was to modify the previous UART code, but make the buffering of incoming data faster, so that someday soon I can run a pipeline straight into the console from another process and update my DSP internal variable via an named pipe process. I'm not going to get into too much of the details of this since I have a solution based on C# WPF that makes a dynamic process more pleasant by auto-feeding rapidly changing variables inside collections of structured arrays utilizing and serializing data streams from those variables based on an interactive event triggering mechanism. What this requires is a means to update feedback events very quickly as the graphic utility functions send their updates via these internal triggered events. In a nutshell this means that my receiving logic via UART needs to respond very fast without having major delays that could hiccup during the transmission of serial events. To achieve this, I created an re-entrant counter function based on static variables. Unlike my previous example, this version, updates the led blinking counter/timer via post-decrements and when it returns to zero, toggles to a different state and vectors after the reset of the counter into a different section of assembly code. 

The two sections are called _ledon and _ledoff. They are no longer blocking with loop counters structure and return right the way for another iteration of the unblocking static counter until it resets, then it toggles back to the other section. A toggle is thus an simple two state, state machine.  

Following bad naming convention, I should not have called it MyPotential...blah...blah...anything, But it goes to illustrate the idea of re-entrant code. For simplicity I will show two different processes but this could really be merged into one section instead of two based on the toggle state! So yeah, its a bit inefficient having an code butterfly laid out for visualization, which generally serves the illustrative purpose of demoing simple symmetric processing logic. Here is the improved final version below...

If you decide to test this implementation, it will run full speed no matter which counter delay parameters you pass in, because it bypasses unnecessarily long loop counters inside the assembly logic. This whole static loop logic could easily be implemented entirely in assembly! I may do just that on the next released version!