PDA

View Full Version : Bumpless Transfer PIC18F



retepsnikrep
- 8th March 2021, 21:15
I have a pic 18F project which has incoming data every 10ms in a word.

The top nibble of the word high byte is flags, either %1111 or 0000 (we can ignore/mask them out)

The lower 12 bits is a value 0-4095

If a button is pressed I modify the 12 bit value and then send it back out again.

If the button is not pressed the data passes through unchanged.

All good so far!


Now if the incoming 12 bit data is say 4095, I want to modify that to be 0 and send it out with a gradual change.

When my button is released I want the same thing to happen in reverse i.e. change from 0 back to the 4095.

I basically want the system to smoothly change from the incoming value to mine and back again in say 500ms.

So maybe increments of 80 every 10ms>

I believe this sort of transition is caused 'bumpless transfer' so was wondering if anyone had any clever ideas or code for it..

Thanks

richard
- 8th March 2021, 22:11
looks like a pretty classic state machine solution would be in order

enum state [idle, beginning, held , releasing]; button states



process each incoming val according to present state

while state idle: full pass val
transition --> to beginning, redux = 80 ,pass val-redux, transition --> state to held ; [button pressed detected]
while state held: pass val-redux , redux += 80 until redux=val ; [button held]
transition --> to releasing ,redux -= 80 ; pass val-redux, [button release detected]
while state releasing: pass val-redux , redux -= 80 , until redux=0 ,transition --> state to idle

HenrikOlsson
- 9th March 2021, 05:45
What if the incoming value changes as the output is ramping towards one end? Should that change in input signal be ignored or should there be an equal change in the output?

richard
- 9th March 2021, 06:08
i would expect 'bumpless transfer' to mean that the final condition should gently ramp back up to the initial condition
so as to to not cause alarming output swings after manual intervention is completed. the incoming input during the
"tampering process" would be irrelevant in that case

retepsnikrep
- 9th March 2021, 17:35
We can ignore the incoming signal during the period it is being replaced/overridden,
but as soon as the manual intervention is finished the system needs to gently return to what the incoming signal is saying.