Warning: these procedure can not be called from both normal and interrupt code in the same program due to local variable allocation.