What I have done so far:
1. BCD-to-Decimal subroutine:
[DEC]
hv = val >> 4
hl = val and 15
val = hv*10 + hl
wait 2. Decimal-to-BCD subroutine:
[BCD]
d = int( val / 10 )
d1 = d * 10
d2 = val - d1
val = d*16 + d2
waitIf you have any other idea please feel free to share it, looking forward to see smarter solutions that that. I'm sure they are!
Happy breadboarding,
TJ.
Original Article with Test Program Code: ESPBasic Series - DEC to BCD and BCD to DEC conversions
Available on Tindie: https://www.tindie.com/products/nEXT_EVO1/universal-ac-mains-dimmer-mpdmv41/