[Tutor] Magic numbers
Phil
phillor9 at gmail.com
Thu Aug 5 21:08:35 EDT 2021
On 5/8/21 7:32 pm, Alan Gauld via Tutor wrote:
Thank you everyone for your replies, I didn't expect so much interest.
> Incidentally, why are you using bit shifting rather
> than regular arithmetic?
I'm simulating a shift register that can shift either left or right. I
start with bit 0 equal to one and shift it to the right until I hit the
most significant bit , for example 128 for an 8 bit shift register, and
then reverse the shift until I return to bit zero. Looping forever to
create a Cylon effect (everyone remembers Lorne Green in Battlestar
Galactica, don't they?). An and mask is applied to determine the status
of each bit which in turn controls the state of my array of on-screen LEDs.
It all works as expected and I cannot think of any more enhancements, at
the moment, so now I'm looking for a new project.
--
Regards,
Phil
More information about the Tutor
mailing list