0

A binary number is normally stored with a fixed position MSB and a LSB; from LSB to MSB the weighting is doubled each bit. Are there any other ways of storing a binary number?

the traditional way may be the most efficient way, when requiring the lowest number of logical electronic bits needed to represent a number, but there are some disadvantages with this method. One disadvantage is that when sequentially counting the toggling of the LSB is quite high because it toggles state on each incremental count. I was trying to scramble the weighting of each bit so that when sequentially counting, each bit that represents the binary number has the same amount of toggling. There are many advantages for achieving this method, even though more bits are required for the number.

One advantage is that the life of EEPROM would be extended because an equal amount of toggling occurs in all of the physical cells that represent the stored number. Another advantages when overclocking a cpu, error correction, and more.

If a oscilloscope probe examines a traditional address bus, the LSB has a lot of HARD work, and the MSB is very idle.

traditional method: (number) 0000 0001 0010 0011 0100 new proposed method: (scramble encoder)(number)

gary
  • 11
  • 2
  • This is too broad for stack overflow. Here you should ask questions which have direct answers (the direct answer to your question would be: "yes, of course there are. You can store them however you like", which isn't very useful!). To address your concern about balancing the weight of each bit, you could go to the extreme and use a base-1 type encoding ("count the 1s"), but it would be slow and you wouldn't be able to count very high. – Dave May 16 '15 at 16:43
  • the scramble encoder number prefix, is a look up table for the weighting of each bit position within the memory cells, this way when sequentially counting all memory cells have the same amount of logic state toggling. – gary May 16 '15 at 16:54
  • 1
    I think you're also either operating under a misapprehension or want to reword your question. Generally, the values in an EEPROM are not constantly changing. You set them and leave them, typically as firmware or other ROM. While they can change, an EEPROM will generally have a total number of cycles that you can expect to flash it, but this is not governed by the cycle of individual bits. – David Hoelzer May 16 '15 at 17:39
  • thanks, I was thinking that EEPROM was being used to store the counting, for example the number of times a car door has opened, it would start failing at about 100,000 counts. EEPROM being used because it is non volatile. – gary May 16 '15 at 17:49
  • with my proposed system you could get orders of magnitudes more counts because the LSB memory cell has not died. But you do need some more bits – gary May 16 '15 at 17:56
  • The first scheme that comes to mind for me is [Gray code](http://en.wikipedia.org/wiki/Gray_code), where only one bit toggles with every increment. The LSB still toggles on half the increments, though. – user2357112 May 20 '15 at 22:25

1 Answers1

0

How about a binary number system like this? When counting with a very high bus speed, the transistors do not overheat and therefore limit clock speed.

The solution uses both base-2 and base-1 binary to make a number.

((base-2 binary number)*size_of_in_bits(base-1 binary number)) + base-1 binary number

so for a 16 bit bus, with the high byte binary base-2, and the low byte binary base-1, the maximum count would be ((2^8)-1)*8)+8) = 2048

The solution to the EEPROM life problem could be:

Using a EEPROM that only changes the required cells when writing new data to maximise life.

4 bytes (32bit) for the base-2 part of the number, and 13 bytes (100 bit) for the base-1 part of the number.

((32 bit base-2 binary number) x 100) + (100 bit binary base-1 tally counter)

The maximum count would be (((2^32)-1) *100)+100) = 429,496,729,700

This method should get the maximum life from the EEPROM or FLASH memory, for FLASH memory the base-1 number should be stored inverted, because the erased state is logic 1.

The EEPROM can, read, increment, write, a number 2 orders of magnitude bigger, achieving a count of 1 million instead of ten thousand.

Send me a email and I can give you the program, it works in MVS 2013 console.

lion@palmbeach.freeserve.co.uk

/* a www.goatelectronics.com solution */

/* This program is designed to test eeprom life, writing to the same page and cells */

/* 32 bit base-2 binary number + 100 bit base-1 binary number make the number*/

/* byte 0 - Most significant byte , binary base-2 number */

/* byte 1 - */

/* byte 2 - */

/* byte 3 - Least significant byte, binary base-2 number */

/* byte 4 - 8 bit CRC suffix for 32bit number, to be done later */

/* byte 5 - count 0 to 8 of binary base-1 number */

/* byte 6 - count 9 to 16 of binary base-1 number*/

/* byte 7 - count 17 to 24 of ... */

/* byte 8 - count 25 to 32 */

/* byte 9 - count 33 to 40 */

/* byte 10 - count 41 to 48 */

/* byte 11 - count 49 to 56 */

/* byte 12 - count 57 to 64 */

/* byte 13 - count 65 to 72 */

/* byte 14 - count 73 to 80 */

/* byte 15 - count 81 to 88 */

/* byte 16 - count 89 to 96 */

/* byte 17 - count 97 to 100 */

#include "stdafx.h"
#include <iostream>
#include <conio.h>
using namespace std;

/* emulate the eeprom *here* , byte read and write */
unsigned char eeprom[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
                       0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; 

unsigned int EEPROM_read (void)
{
unsigned char i_u8;
unsigned int value_u32, value_A_u32, value_B_u32, value_C_u32,      value_D_u32 = 0;
unsigned int base_1_u32 = 0;
value_A_u32 = eeprom[0];
value_A_u32 = value_A_u32 << 24;
value_B_u32 = eeprom[1];
value_B_u32 = value_B_u32 << 16;
value_C_u32 = eeprom[2];
value_C_u32 = value_C_u32 << 8;
value_D_u32 = eeprom[3];
value_u32 = value_A_u32 | value_B_u32 | value_C_u32 | value_D_u32;
/* eeprom[4]  reserved location for CRC checksum! */

value_u32 = value_u32 * 100;

for (i_u8 = 5; eeprom[i_u8] == 0xFF; i_u8++)
{
    base_1_u32 = base_1_u32 + 8;
}

switch (eeprom[i_u8])
{
case 0x80: base_1_u32 = base_1_u32 + 1;
    break;
case 0xC0: base_1_u32 = base_1_u32 + 2;
    break;
case 0xE0: base_1_u32 = base_1_u32 + 3;
    break;
case 0xF0: base_1_u32 = base_1_u32 + 4;
    break;
case 0xF8: base_1_u32 = base_1_u32 + 5;
    break;
case 0xFC: base_1_u32 = base_1_u32 + 6;
    break;
case 0xFE: base_1_u32 = base_1_u32 + 7;
    break;
default:; /*if here, faulty EEPROM with base-1 number*/
}

value_u32 = value_u32 + base_1_u32;

return (value_u32);

}

void EEPROM_write(unsigned int number_u32)
{
unsigned char i_u8, remainder_u8;
unsigned int value_u32;

value_u32 = number_u32;

value_u32 = value_u32 / 100;

eeprom[0] = (unsigned char)((value_u32 & 0xFF000000) >> 24);
eeprom[1] = (unsigned char)((value_u32 & 0x00FF0000) >> 16);
eeprom[2] = (unsigned char)((value_u32 & 0x0000FF00) >> 8);
eeprom[3] = (unsigned char)((value_u32 & 0x000000FF));

remainder_u8 = (unsigned char)(number_u32 % 100);
if (!remainder_u8)
{
    for (i_u8 = 5; i_u8 < 18; i_u8++)
    {
        eeprom[i_u8] = 0x00;
    }
}

for (i_u8 = 5; remainder_u8 >=8; i_u8++)
{
    eeprom[i_u8] = 0xFF;
    remainder_u8 = remainder_u8 - 8;
}

switch (remainder_u8)
{
case 1: eeprom[i_u8] = 0x80;
    break;
case 2: eeprom[i_u8] = 0xC0;
    break;
case 3: eeprom[i_u8] = 0xE0;
    break;
case 4: eeprom[i_u8] = 0xF0;
    break;
case 5: eeprom[i_u8] = 0xF8;
    break;
case 6: eeprom[i_u8] = 0xFC;
    break;
case 7: eeprom[i_u8] = 0xFE;
    break;
default:; /**/
}
}


int _tmain(int argc, _TCHAR* argv[])
{
unsigned char i_u8;
unsigned int test_number_u32;
unsigned int loop_u32 = 0;

while (loop_u32 <0xFFFFFFFF)
{
    test_number_u32 = EEPROM_read();
    test_number_u32++;
    EEPROM_write(test_number_u32);

    for (i_u8 = 0; i_u8 < 18; i_u8++)
    {
        printf(" %x", eeprom[i_u8]);
    }
    printf(" \n");
    loop_u32++;
}
gary
  • 11
  • 2