Page 1 of 1

Necessity of clearing filter registers at RUN initialization

Posted: Tue Jul 01, 2014 7:29 am
by Digital Larry
I think I've made or copied some filter code that clears the delay registers on program init and then does the SKP RUN thing later to allow normal use of the registers. I'm curious to know if this is really needed. Even garbage values in the registers would probably clear themselves out pretty quickly unless you were hovering on the edge of oscillation. I've also seen programs where the accumulator was cleared at the beginning.

Are the registers/accumulator set to some known value at program init?

Posted: Tue Jul 01, 2014 1:11 pm
by frank
General registers are not initialized but yes, some code like a basic filter generally won't care so you can avoid initializing. Don't recall on the accumulator but always good to assume it is not valid data at the start of the code and initialize it in some manner. Don't have to clear it, could use LDAX to load a register value or SOF to load a constant, depends on the program.