# [sdiy] Rotary Switch -> illuminated PB w/ multicolor LED?

Mike Bryant mbryant at futurehorizons.com
Mon Feb 21 18:39:27 CET 2022

```Yes that's it.   Even number of 1s or 0s = off, odd = on.  But other encodings are possible or course

-----Original Message-----
From: grant musictechnologiesgroup.com [mailto:grant at musictechnologiesgroup.com]
Sent: 21 February 2022 17:37
To: Mike Bryant; synth-diy at synth-diy.org
Subject: Re[2]: [sdiy] Rotary Switch -> illuminated PB w/ multicolor LED?

Sorry, I forgot about your previous response, and now I'm trying to wrap my head around it. For this one bit, are you just counting the number of 1's in the byte (even/odd) to determine on or off?

> I program a byte at a time.  I start at the first byte with all ones = off,  > so 0x01111111 = on, 0x00111111 = off, etc.  Then when the byte gets  > to zero I move to the next byte and set that to 0x0111111.  And so on  > through the page.
>  Only once the whole page is full of zeros do I erase it.

If my guess is correct, then the final value for the byte (0000 0000) is off and that matches nicely with the initial value (1111 1111) which is also off.

I have to extend that to a larger variable, but I wanted to understand your concept.

GB

------ Original Message ------
From: "Mike Bryant" <mbryant at futurehorizons.com>
To: "grant musictechnologiesgroup.com"
<grant at musictechnologiesgroup.com>; "sleepy_dog at gmx.de"
<sleepy_dog at gmx.de>; "synth-diy at synth-diy.org" <synth-diy at synth-diy.org>
Sent: 2/16/2022 2:01:10 PM
Subject: RE: [sdiy] Rotary Switch -> illuminated PB w/ multicolor LED?

>You need to just do writes to bytes in sequence.  So an all 0's (if it's a clear to 1 memory) represents a null location so move onto the next byte for the real data.  Only once you run out of bytes do you need to do a page erase.
>
>
>-----Original Message-----
>From: Synth-diy [mailto:synth-diy-bounces at synth-diy.org] On Behalf Of
>grant musictechnologiesgroup.com
>Sent: 16 February 2022 21:43
>To: sleepy_dog at gmx.de; synth-diy at synth-diy.org
>Subject: Re: [sdiy] Rotary Switch -> illuminated PB w/ multicolor LED?
>
>Well in this application I'm only concerned with a few bits total, but I wonder one thing about wear leveling: since changing a single byte means erasing a whole page (bank/block whatever you want to call it), don't you need to implement multiple pages (banks/blocks) to see a benefit?
>Or, where is the weakness? Writing or erasing?
>
>

```