The "pipe-lining" fix in the transmitter was still bugging me.
Fortunately I came up with a solution. With the CPU clock slowed down to 62.5kHz, half what I had been required to use, and NOP instructions in both _TXOn and _TXOff, I achieved the jitter free waveform I was after.
I assume that with enough NOP instructions the pipeline was being forced to reload more often and the jitter caused by random reloading was gone.
In my first application, a shed door monitor, I expect a single D cell will last over 4 years. The maths suggest 11 years but can an alkaline battery last that long without leaking and self discharge reducing the life?
Briefly,
: _TXon [ 1 PC_ODR _TxEn ]B! ;
: _TXoff [ 0 PC_ODR _TxEn ]B! NOP NOP NOP NOP NOP NOP ; \ 8 bytes
was changed to
: _TXon [ 1 PC_ODR _TxEn ]B! NOP NOP NOP NOP ;
: _TXoff [ 0 PC_ODR _TxEn ]B! NOP NOP NOP NOP ;
I then used the ]M! command to build up the assembly bytes for a complete On and Off packet without any calls.
No comments:
Post a Comment